From 736ebd9a184752bcb756754e3af6b80cd2f4c480 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 23 Feb 2018 15:17:22 +0200 Subject: 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 Reviewed-by: Noel Grandin --- chart2/source/view/main/GL3DRenderer.cxx | 9 +++++---- 1 file 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); } } -- cgit v1.2.3