From e9ba5420efc430180086e5b6dcde977afa120209 Mon Sep 17 00:00:00 2001 From: halx99 Date: Wed, 19 Aug 2020 12:10:29 +0800 Subject: [PATCH] Refine code --- cocos/2d/CCLabel.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 0ce325c829..7bac40c8b6 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -245,7 +245,7 @@ void Label::BatchCommand::setProgramState(backend::ProgramState* programState) std::array Label::BatchCommand::getCommandArray() { - return std::array{&textCommand, & shadowCommand, & outLineCommand}; + return std::array{&textCommand, &shadowCommand, &outLineCommand}; } Label* Label::create() @@ -1911,8 +1911,7 @@ void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) continue; auto &batch = _batchCommands[i++]; - auto &&commands = batch.getCommandArray(); - for (auto command : commands) + for (auto command : batch.getCommandArray()) { auto *programState = command->getPipelineDescriptor().programState; Vec4 textColor(_textColorF.r, _textColorF.g, _textColorF.b, _textColorF.a); @@ -1932,7 +1931,7 @@ void Label::updateBlendState() setOpacityModifyRGB(_blendFunc != BlendFunc::ALPHA_NON_PREMULTIPLIED); for(auto &batch: _batchCommands) { - for(auto *command : batch.getCommandArray()) { + for(auto command : batch.getCommandArray()) { auto & blendDescriptor = command->getPipelineDescriptor().blendDescriptor; updateBlend(blendDescriptor, _blendFunc); }