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

Thorsten Behrens tbehrens at suse.com
Fri May 31 00:36:59 PDT 2013


 vcl/source/gdi/gdimtf.cxx |   60 +++++++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 27 deletions(-)

New commits:
commit c2530b02311c46529eed53ee688bf6c83ce4b86e
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Fri May 31 08:58:13 2013 +0200

    Band-aid fix for bnc#795857 and the pdf export black background.
    
    Problem is the general un-awareness of the code base for inline
    alpha. Needs larger rework eventually.
    
    Change-Id: I01430d9087f98615819f0a7085b93f1c318e8b0b

diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index ffee748..019e18e 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -446,39 +446,45 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
                 }
 
                 SalBitmap* pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
-                // I don't quite understand this, but the old code didn't work properly on X11 when alpha was used,
-                // and the commit that changed to the new code relied on alpha support in bitmap
-                // (which that commit implemented only in X11SalBitmap) and so it didn't work on Windows.
-                // So keep both.
 #if defined(UNX) && !defined(ANDROID) && !defined(IOS) && !defined(MACOSX) && !defined(LIBO_HEADLESS)
                 X11SalBitmap* X11Bmp = static_cast< X11SalBitmap* >( pSalBmp );
-                X11Bmp->SetHasAlpha( true );
-                if( X11Bmp->Create( xBitmapCanvas, aSize ) )
-                {
-                    Bitmap aBitmap( X11Bmp );
-                    if ( pOut->GetMapMode() == MAP_PIXEL )
-                        pOut->DrawBitmap( rPos, aBitmap );
-                    else
-                        pOut->DrawBitmap( rPos, rLogicDestSize, aBitmap );
-                    return true;
-                }
-#else
-                SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
 
-                if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) )
+                // for pdf export metafile recording, don't break
+                // other code's assumption that Bitmap with alpha
+                // channel comes as BitmapEx
+                if( !pOut->GetExtOutDevData() )
                 {
-                    Bitmap aBitmap( pSalBmp );
-                    Bitmap aMask( pSalMask );
-                    AlphaMask aAlphaMask( aMask );
-                    BitmapEx aBitmapEx( aBitmap, aAlphaMask );
-                    if ( pOut->GetMapMode() == MAP_PIXEL )
-                        pOut->DrawBitmapEx( rPos, aBitmapEx );
-                    else
-                        pOut->DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx );
-                    return true;
+                    X11Bmp->SetHasAlpha( true );
+                    if( X11Bmp->Create( xBitmapCanvas, aSize ) )
+                    {
+                        Bitmap aBitmap( X11Bmp );
+                        if ( pOut->GetMapMode() == MAP_PIXEL )
+                            pOut->DrawBitmap( rPos, aBitmap );
+                        else
+                            pOut->DrawBitmap( rPos, rLogicDestSize, aBitmap );
+                        return true;
+                    }
                 }
-                delete pSalMask;
+                else
 #endif
+                {
+                    // for Windows and Mac, exclusively use this code
+                    // path. The inline alpha on X11 is a hack.
+                    SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
+                    if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) )
+                    {
+                        Bitmap aBitmap( pSalBmp );
+                        Bitmap aMask( pSalMask );
+                        AlphaMask aAlphaMask( aMask );
+                        BitmapEx aBitmapEx( aBitmap, aAlphaMask );
+                        if ( pOut->GetMapMode() == MAP_PIXEL )
+                            pOut->DrawBitmapEx( rPos, aBitmapEx );
+                        else
+                            pOut->DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx );
+                        return true;
+                    }
+                    delete pSalMask;
+                }
                 delete pSalBmp;
             }
         }


More information about the Libreoffice-commits mailing list