Skip to content

Commit

Permalink
Merge pull request cocos2d#14443 from zilongshanren/fix-scalesprite-o…
Browse files Browse the repository at this point in the history
…pacity

fix scalesprite opacity issue.
  • Loading branch information
zilongshanren committed Nov 23, 2015
2 parents a789e31 + 9328a7c commit 51e2e36
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cocos/ui/UIScale9Sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1198,8 +1198,18 @@ namespace ui {
const unsigned short sliceQuadIndices[] = {4,0,5, 1,5,0};
const unsigned short simpleQuadIndices[] = {0,1,2, 3,2,1};

auto displayedColor = _scale9Image->getDisplayedColor();
auto displayedOpacity = _scale9Image->getDisplayedOpacity();
Color4B color4( displayedColor.r, displayedColor.g, displayedColor.b, displayedOpacity );

// special opacity for premultiplied textures
if (_scale9Image->isOpacityModifyRGB())
{
color4.r *= displayedOpacity/255.0f;
color4.g *= displayedOpacity/255.0f;
color4.b *= displayedOpacity/255.0f;
}

Color4B color4 = Color4B(_scale9Image->getDisplayedColor());
int vertexCount = (int)(vertices.size() - 1);

for (int j = 0; j <= vertexCount; ++j)
Expand Down

0 comments on commit 51e2e36

Please sign in to comment.