Skip to content

Commit 55b5c68

Browse files
committed
Improve code style
1 parent 137e5fd commit 55b5c68

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

core/2d/Label.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,18 +2466,16 @@ void Label::updateColor()
24662466
// special opacity for premultiplied textures
24672467
if (_isOpacityModifyRGB)
24682468
{
2469-
color.r *= _displayedOpacity / 255.0f;
2470-
color.g *= _displayedOpacity / 255.0f;
2471-
color.b *= _displayedOpacity / 255.0f;
2469+
color.r *= color.a;
2470+
color.g *= color.a;
2471+
color.b *= color.a;
24722472
}
24732473

2474-
ax::TextureAtlas* textureAtlas;
2475-
V3F_C4F_T2F_Quad* quads;
24762474
for (auto&& batchNode : _batchNodes)
24772475
{
2478-
textureAtlas = batchNode->getTextureAtlas();
2479-
quads = textureAtlas->getQuads();
2480-
auto count = textureAtlas->getTotalQuads();
2476+
auto textureAtlas = batchNode->getTextureAtlas();
2477+
auto quads = textureAtlas->getQuads();
2478+
auto count = textureAtlas->getTotalQuads();
24812479

24822480
for (int index = 0; index < count; ++index)
24832481
{
@@ -2899,7 +2897,7 @@ bool Label::multilineTextWrap(const std::function<int(const std::u32string&, int
28992897
{
29002898
recordPlaceholderInfo(letterIndex, character);
29012899
AXLOGW("LabelTextFormatter error: can't find letter definition in font file for letter: 0x{:x}",
2902-
static_cast<uint32_t>(character));
2900+
static_cast<uint32_t>(character));
29032901
continue;
29042902
}
29052903

@@ -3115,11 +3113,11 @@ void Label::recordLetterInfo(const ax::Vec2& point, char32_t utf32Char, int lett
31153113
LetterInfo tmpInfo;
31163114
_lettersInfo.emplace_back(tmpInfo);
31173115
}
3118-
_lettersInfo[letterIndex].lineIndex = lineIndex;
3119-
_lettersInfo[letterIndex].utf32Char = utf32Char;
3120-
_lettersInfo[letterIndex].valid = _fontAtlas->_letterDefinitions[utf32Char].validDefinition && utf32Char != ' ';
3121-
_lettersInfo[letterIndex].positionX = point.x;
3122-
_lettersInfo[letterIndex].positionY = point.y;
3116+
_lettersInfo[letterIndex].lineIndex = lineIndex;
3117+
_lettersInfo[letterIndex].utf32Char = utf32Char;
3118+
_lettersInfo[letterIndex].valid = _fontAtlas->_letterDefinitions[utf32Char].validDefinition && utf32Char != ' ';
3119+
_lettersInfo[letterIndex].positionX = point.x;
3120+
_lettersInfo[letterIndex].positionY = point.y;
31233121
_lettersInfo[letterIndex].atlasIndex = -1;
31243122
}
31253123

@@ -3134,4 +3132,4 @@ void Label::recordPlaceholderInfo(int letterIndex, char32_t utf32Char)
31343132
_lettersInfo[letterIndex].valid = false;
31353133
}
31363134

3137-
}
3135+
} // namespace ax

0 commit comments

Comments
 (0)