Refine code

This commit is contained in:
halx99 2020-08-19 12:10:29 +08:00
parent 82ceee2fdb
commit e9ba5420ef
1 changed files with 3 additions and 4 deletions

View File

@ -245,7 +245,7 @@ void Label::BatchCommand::setProgramState(backend::ProgramState* programState)
std::array<CustomCommand*, 3> Label::BatchCommand::getCommandArray() std::array<CustomCommand*, 3> Label::BatchCommand::getCommandArray()
{ {
return std::array<CustomCommand*, 3>{&textCommand, & shadowCommand, & outLineCommand}; return std::array<CustomCommand*, 3>{&textCommand, &shadowCommand, &outLineCommand};
} }
Label* Label::create() Label* Label::create()
@ -1911,8 +1911,7 @@ void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
continue; continue;
auto &batch = _batchCommands[i++]; auto &batch = _batchCommands[i++];
auto &&commands = batch.getCommandArray(); for (auto command : batch.getCommandArray())
for (auto command : commands)
{ {
auto *programState = command->getPipelineDescriptor().programState; auto *programState = command->getPipelineDescriptor().programState;
Vec4 textColor(_textColorF.r, _textColorF.g, _textColorF.b, _textColorF.a); Vec4 textColor(_textColorF.r, _textColorF.g, _textColorF.b, _textColorF.a);
@ -1932,7 +1931,7 @@ void Label::updateBlendState()
setOpacityModifyRGB(_blendFunc != BlendFunc::ALPHA_NON_PREMULTIPLIED); setOpacityModifyRGB(_blendFunc != BlendFunc::ALPHA_NON_PREMULTIPLIED);
for(auto &batch: _batchCommands) for(auto &batch: _batchCommands)
{ {
for(auto *command : batch.getCommandArray()) { for(auto command : batch.getCommandArray()) {
auto & blendDescriptor = command->getPipelineDescriptor().blendDescriptor; auto & blendDescriptor = command->getPipelineDescriptor().blendDescriptor;
updateBlend(blendDescriptor, _blendFunc); updateBlend(blendDescriptor, _blendFunc);
} }