[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - vcl/source

Thorsten Behrens tbehrens at suse.com
Fri May 31 00:05:25 PDT 2013


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

New commits:
commit 243340c6e516892520907a8eb74f244e513dc065
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 63b2b78..9bfcc5a 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -502,39 +502,48 @@ 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.
 #ifdef UNX
                     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