Skip to content

Commit cd6b805

Browse files
committed
Fix #2330 and improve code style
1 parent 2cf3327 commit cd6b805

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

core/2d/Label.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,11 @@ class LabelLetter : public Sprite
165165
{
166166
displayedOpacity = 0.0f;
167167
}
168-
Color color(_displayedColor, displayedOpacity);
168+
Color color(_displayedColor, displayedOpacity / 255.0f);
169169
// special opacity for premultiplied textures
170170
if (_opacityModifyRGB)
171-
{
172-
color.r *= displayedOpacity / 255.0f;
173-
color.g *= displayedOpacity / 255.0f;
174-
color.b *= displayedOpacity / 255.0f;
175-
}
171+
color.premultiplyAlpha();
172+
176173
_quad.bl.color = color;
177174
_quad.br.color = color;
178175
_quad.tl.color = color;

0 commit comments

Comments
 (0)