[Libreoffice-commits] core.git: vcl/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Oct 2 01:32:54 PDT 2015


 vcl/source/gdi/bmpacc2.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 4caaa09d4da0f7bd5aa0fae3233d66bd977f185e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Oct 2 10:31:35 2015 +0200

    vcl tiled rendering: avoid 'Pixel represents color values!' warnings
    
    Which happens e.g. during rendering tiles:
    OutputDevice::BlendBitmapWithAlpha() produces an RGB alpha
    (255,255,255), then tries to set a pixel in the 8bit alpha channel using
    it, so when BitmapReadAccess::SetPixelFor_8BIT_PAL() tries to get the
    color index, we try to get it from a color that is not indexed.
    
    Let's assume that when the color is not indexed, it's always gray, so it
    doesn't matter what color we pick for the alpha mask needs.
    
    Change-Id: I325c1d70514fd176fdc9cc39683b444447adf07f

diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index d664c4b..286ea8f 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -79,7 +79,11 @@ BitmapColor BitmapReadAccess::GetPixelFor_8BIT_PAL(ConstScanline pScanline, long
 
 void BitmapReadAccess::SetPixelFor_8BIT_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
 {
-    pScanline[ nX ] = rBitmapColor.GetIndex();
+    if (rBitmapColor.IsIndex())
+        pScanline[ nX ] = rBitmapColor.GetIndex();
+    else
+        // Let's hope that the RGB color values equal, so it doesn't matter what do we pick
+        pScanline[ nX ] = rBitmapColor.GetBlueOrIndex();
 }
 
 BitmapColor BitmapReadAccess::GetPixelFor_8BIT_TC_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask)


More information about the Libreoffice-commits mailing list