summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-23 15:17:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-26 07:20:38 +0100
commit736ebd9a184752bcb756754e3af6b80cd2f4c480 (patch)
tree5a87a3f7d8b643ea9f926a339cb968d4a5a3d771
parentace95cf48ee88d78a17765e5f4f26bb93d5940cf (diff)
fix alpha computation in chart2 getColorAsVector
The alpha value was not being shifted, and because of associativity, the alpha color was also not being inverted before being divided by 255. Found while doing other Color work. This was introduced in commit a0842e53b999cee3cddbd209b43e313874760f0b Date: Mon May 12 05:22:52 2014 +0200 more sal_Int32 to sal_uInt32 and simplification Change-Id: I99b9e866a4f63676e194e65d64c31fb4c0442e0a Reviewed-on: https://gerrit.libreoffice.org/50245 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/view/main/GL3DRenderer.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index b1b8510347c6..9067553dd588 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -44,10 +44,11 @@ GLfloat texCoords[] = {
glm::vec4 getColorAsVector(sal_uInt32 nColor)
{
- return glm::vec4(((nColor & 0x00FF0000) >> 16) / 255.0f,
- ((nColor & 0x0000FF00) >> 8) / 255.0f,
- (nColor & 0x000000FF) / 255.0f,
- (0xFF - (nColor & 0xFF000000)/255.0));
+ auto red = ((nColor & 0x00FF0000) >> 16) / 255.0f;
+ auto green = ((nColor & 0x0000FF00) >> 8) / 255.0f;
+ auto blue = (nColor & 0x000000FF) / 255.0f;
+ auto alpha = (0xFF - ((nColor & 0xFF000000) >> 24)) / 255.0;
+ return glm::vec4(red, green, blue, alpha);
}
}