diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2013-05-31 08:58:13 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2013-05-31 13:44:50 +0200 |
commit | 5903ff1d85c4a6ce8198cd8f8694dec725008539 (patch) | |
tree | c2b9f7c7003fb4c42383c13417c0a5ed01e31d50 | |
parent | ba28e7eecac43361dfb64948d05e1257ff8ee0bb (diff) |
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
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 63b2b78e97d5..9bfcc5ad005a 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; } } |