[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - canvas/source

Tor Lillqvist tml at kemper.freedesktop.org
Sun Mar 18 23:25:55 PDT 2012


 canvas/source/cairo/cairo_canvashelper.cxx |    8 ++++----
 canvas/source/vcl/canvashelper.cxx         |   28 +++++++++++-----------------
 2 files changed, 15 insertions(+), 21 deletions(-)

New commits:
commit bed182f5f3059e30c3e53a163a031de1f0c2bc46
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Tue Mar 6 23:07:00 2012 +0100

    Another partial fix for fdo#45219
    
    Make sure transparent polygons really only cover the polygonal area,
    not the whole bounding box for sprites.
    
    (cherry picked from commit 50309b9574c43de93a05576904813881eb7bc898)
    
    Signed-off-by: Tor Lillqvist <tlillqvist at suse.com>

diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index 055edff..c5c5943 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -500,27 +500,21 @@ namespace vclcanvas
 
             if( mp2ndOutDev )
             {
-                if( !nTransparency || bSourceAlpha )
+                // HACK. Normally, CanvasHelper does not care
+                // about actually what mp2ndOutDev is...
+                // well, here we do & assume a 1bpp target.
+                if( nTransparency > 127 )
                 {
-                    // HACK. Normally, CanvasHelper does not care
-                    // about actually what mp2ndOutDev is...
-                    if( bSourceAlpha && nTransparency == 255 )
-                    {
-                        mp2ndOutDev->getOutDev().SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT |
-                                                              DRAWMODE_WHITEGRADIENT | DRAWMODE_WHITEBITMAP );
-                        mp2ndOutDev->getOutDev().SetFillColor( COL_WHITE );
-                        mp2ndOutDev->getOutDev().DrawPolyPolygon( aPolyPoly );
-                        mp2ndOutDev->getOutDev().SetDrawMode( DRAWMODE_BLACKLINE | DRAWMODE_BLACKFILL | DRAWMODE_BLACKTEXT |
-                                                              DRAWMODE_BLACKGRADIENT | DRAWMODE_BLACKBITMAP );
-                    }
-                    else
-                    {
-                        mp2ndOutDev->getOutDev().DrawPolyPolygon( aPolyPoly );
-                    }
+                    mp2ndOutDev->getOutDev().SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT |
+                                                          DRAWMODE_WHITEGRADIENT | DRAWMODE_WHITEBITMAP );
+                    mp2ndOutDev->getOutDev().SetFillColor( COL_WHITE );
+                    mp2ndOutDev->getOutDev().DrawPolyPolygon( aPolyPoly );
+                    mp2ndOutDev->getOutDev().SetDrawMode( DRAWMODE_BLACKLINE | DRAWMODE_BLACKFILL | DRAWMODE_BLACKTEXT |
+                                                          DRAWMODE_BLACKGRADIENT | DRAWMODE_BLACKBITMAP );
                 }
                 else
                 {
-                    mp2ndOutDev->getOutDev().DrawTransparent( aPolyPoly, (sal_uInt16)nTransPercent );
+                    mp2ndOutDev->getOutDev().DrawPolyPolygon( aPolyPoly );
                 }
             }
         }
commit a1a4b8cdd14843457e520fa9494892e9704557d4
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Tue Mar 6 20:36:06 2012 +0100

    Consistent use of alpha in cairocanvas
    
    Use GetIndex() instead of GetBlue() (does the same, but more
    self-documenting); use opaque when no alpha channel consistently.
    
    (cherry picked from commit 83114b27fac8ef723cbbaa734237210d9ad56a15)
    
    Signed-off-by: Tor Lillqvist <tlillqvist at suse.com>

diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 6accc39..c5876a7 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -368,7 +368,7 @@ namespace cairocanvas
     case BMP_FORMAT_8BIT_PAL:
         pReadScan = pAlphaReadAcc->GetScanline( nY );
         for( nX = 0; nX < nWidth; nX++ ) {
-        nAlpha = data[ nOff ] = 255 - ( pAlphaReadAcc->GetPaletteColor( *pReadScan++ ).GetBlue() );
+            nAlpha = data[ nOff ] = 255 - ( pAlphaReadAcc->GetPaletteColor( *pReadScan++ ).GetIndex() );
         if( nAlpha != 255 )
             bIsAlpha = true;
         nOff += 4;
@@ -377,7 +377,7 @@ namespace cairocanvas
     default:
         OSL_TRACE( "fallback to GetColor for alpha - slow, format: %d", pAlphaReadAcc->GetScanlineFormat() );
         for( nX = 0; nX < nWidth; nX++ ) {
-        nAlpha = data[ nOff ] = 255 - pAlphaReadAcc->GetColor( nY, nX ).GetBlue();
+        nAlpha = data[ nOff ] = 255 - pAlphaReadAcc->GetColor( nY, nX ).GetIndex();
         if( nAlpha != 255 )
             bIsAlpha = true;
         nOff += 4;
@@ -541,7 +541,7 @@ namespace cairocanvas
                             if( pAlphaReadAcc )
                                 nAlpha = data[ nOff++ ];
                             else
-                                nAlpha = data[ nOff++ ] = pReadScan[ 3 ];
+                                nAlpha = data[ nOff++ ] = 255;
                             data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( pReadScan[ 2 ] ) )/255 );
                             data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( pReadScan[ 1 ] ) )/255 );
                             data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( pReadScan[ 0 ] ) )/255 );
@@ -550,7 +550,7 @@ namespace cairocanvas
                             if( pAlphaReadAcc )
                                 nAlpha = data[ nOff + 3 ];
                             else
-                                nAlpha = data[ nOff + 3 ] = pReadScan[ 3 ];
+                                nAlpha = data[ nOff + 3 ] = 255;
                             data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( *pReadScan++ ) )/255 );
                             data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( *pReadScan++ ) )/255 );
                             data[ nOff++ ] = sal::static_int_cast<unsigned char>(( nAlpha*( *pReadScan++ ) )/255 );


More information about the Libreoffice-commits mailing list