diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2013-05-31 08:58:13 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2013-05-31 09:36:28 +0200 |
commit | c2530b02311c46529eed53ee688bf6c83ce4b86e (patch) | |
tree | 77ab0e65502a89ecd6bc2ecff3f8c5f9bf3e3fb2 /vcl | |
parent | a400b31069a913830b257ac8a1b2131665067ec5 (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
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index ffee7480cda8..019e18e0df84 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; } } |