[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/unx

David Tardon dtardon at redhat.com
Tue Jun 18 02:59:19 PDT 2013


 vcl/unx/generic/gdi/salgdi2.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 5ef3c40ff0e70704cbc7d846722db9618d01ca53
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Jun 18 11:55:59 2013 +0200

    fdo#65844 use right colors from palette
    
    It is not correct to expect that the palette will always be the same as
    default-constructed from VCL. For example, 1bit PICT images use reversed
    white and black.
    
    Change-Id: I6b5e7cd19af98202e80f4cff17fddaa3a3f0e3af
    (cherry picked from commit 1b3a39bfa10177aed40a4a9a69d0fe1970229422)
    
    Signed-off-by: David Tardon <dtardon at redhat.com>

diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx
index 0288e05..3a54d53 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -471,8 +471,10 @@ void X11SalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSa
             const BitmapPalette& rPalette = pBitmapBuffer->maPalette;
             if (rPalette.GetEntryCount() == 2)
             {
-                aNewVal.foreground = rColMap.GetPixel(ImplColorToSal(rPalette[0]));
-                aNewVal.background = rColMap.GetPixel(ImplColorToSal(rPalette[1]));
+                const BitmapColor aBlack( rPalette[rPalette.GetBestIndex( Color( COL_BLACK ) )] );
+                const BitmapColor aWhite( rPalette[rPalette.GetBestIndex( Color( COL_WHITE ) )] );
+                aNewVal.foreground = rColMap.GetPixel(ImplColorToSal(aWhite));
+                aNewVal.background = rColMap.GetPixel(ImplColorToSal(aBlack));
             }
         }
 


More information about the Libreoffice-commits mailing list