Blame SOURCES/0170-vcl-tiled-rendering-avoid-Pixel-represents-color-val.patch

f325b2
From 95c0e2be5e09f8e658295ea12f814706664c431f Mon Sep 17 00:00:00 2001
f325b2
From: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
Date: Fri, 2 Oct 2015 10:31:35 +0200
f325b2
Subject: [PATCH 170/398] vcl tiled rendering: avoid 'Pixel represents color
f325b2
 values!' warnings
f325b2
f325b2
Which happens e.g. during rendering tiles:
f325b2
OutputDevice::BlendBitmapWithAlpha() produces an RGB alpha
f325b2
(255,255,255), then tries to set a pixel in the 8bit alpha channel using
f325b2
it, so when BitmapReadAccess::SetPixelFor_8BIT_PAL() tries to get the
f325b2
color index, we try to get it from a color that is not indexed.
f325b2
f325b2
Let's assume that when the color is not indexed, it's always gray, so it
f325b2
doesn't matter what color we pick for the alpha mask needs.
f325b2
f325b2
Change-Id: I325c1d70514fd176fdc9cc39683b444447adf07f
f325b2
(cherry picked from commit 4caaa09d4da0f7bd5aa0fae3233d66bd977f185e)
f325b2
---
f325b2
 vcl/source/gdi/bmpacc2.cxx | 6 +++++-
f325b2
 1 file changed, 5 insertions(+), 1 deletion(-)
f325b2
f325b2
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
f325b2
index d664c4b769fd..286ea8fca26a 100644
f325b2
--- a/vcl/source/gdi/bmpacc2.cxx
f325b2
+++ b/vcl/source/gdi/bmpacc2.cxx
f325b2
@@ -79,7 +79,11 @@ BitmapColor BitmapReadAccess::GetPixelFor_8BIT_PAL(ConstScanline pScanline, long
f325b2
 
f325b2
 void BitmapReadAccess::SetPixelFor_8BIT_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
f325b2
 {
f325b2
-    pScanline[ nX ] = rBitmapColor.GetIndex();
f325b2
+    if (rBitmapColor.IsIndex())
f325b2
+        pScanline[ nX ] = rBitmapColor.GetIndex();
f325b2
+    else
f325b2
+        // Let's hope that the RGB color values equal, so it doesn't matter what do we pick
f325b2
+        pScanline[ nX ] = rBitmapColor.GetBlueOrIndex();
f325b2
 }
f325b2
 
f325b2
 BitmapColor BitmapReadAccess::GetPixelFor_8BIT_TC_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask)
f325b2
-- 
f325b2
2.12.0
f325b2