From 1e89b32c654b471f5fdce65d63d49cfcc90826b1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 5 Mar 2018 11:16:12 +0200 Subject: tdf#116001 Incorrect Colors in Chart Wall Area (2nd attempt) regression from commit b10c7022f1be6e4825269bd5872575b5b53744ef "use RawBitmap in BPixelRasterToBitmapEx" fix attempt at fixing it in commit 3d400321910ff0fe89ab8c70c59432e676cb1340 "tdf#116001 Incorrect Colors in Chart Wall Area" was incomplete. the drawinglayer code was (a) not initialising the background transparency on all pixels and (b) not calling the Color constructor correctly. Change-Id: I1cf7d7d5eb67ba472e17790b18c33d8e4b97ae4c Reviewed-on: https://gerrit.libreoffice.org/50764 Tested-by: Jenkins Reviewed-by: Noel Grandin --- drawinglayer/source/primitive2d/sceneprimitive2d.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 98fb19bfe172..98aa9aba0b1c 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -84,11 +84,13 @@ namespace if(nOpacity) { aContent.SetPixel(y, x, Color( + 255 - static_cast(nOpacity), static_cast(nRed / nDivisor), static_cast(nGreen / nDivisor), - static_cast(nBlue / nDivisor), - 255 - static_cast(nOpacity))); + static_cast(nBlue / nDivisor) )); } + else + aContent.SetPixel(y, x, Color(255, 0, 0, 0)); } } } @@ -104,8 +106,10 @@ namespace if(rPixel.getOpacity()) { - aContent.SetPixel(y, x, Color(rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue(), 255 - rPixel.getOpacity())); + aContent.SetPixel(y, x, Color(255 - rPixel.getOpacity(), rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue())); } + else + aContent.SetPixel(y, x, Color(255, 0, 0, 0)); } } } -- cgit v1.2.3