Kaydet (Commit) fefab3bb authored tarafından Thorsten Behrens's avatar Thorsten Behrens

Fixup alpha bitmap generation for Windows.

This improves upon d6f58fd2 by
using the BitmapEx ctor instead of manual initialisation. Several
EMF+ files would otherwise show up horribly mangled on Windows.

Change-Id: I1808cb45818f3f0118653164c83c49d6134b9324
üst 4548ed5e
...@@ -868,9 +868,6 @@ bool BitmapEx::Create( const ::com::sun::star::uno::Reference< ...@@ -868,9 +868,6 @@ bool BitmapEx::Create( const ::com::sun::star::uno::Reference<
::com::sun::star::rendering::XBitmapCanvas > &xBitmapCanvas, ::com::sun::star::rendering::XBitmapCanvas > &xBitmapCanvas,
const Size &rSize ) const Size &rSize )
{ {
SetEmpty();
Size aSize( rSize );
uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, uno::UNO_QUERY ); uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, uno::UNO_QUERY );
if( xFastPropertySet.get() ) if( xFastPropertySet.get() )
{ {
...@@ -890,38 +887,17 @@ bool BitmapEx::Create( const ::com::sun::star::uno::Reference< ...@@ -890,38 +887,17 @@ bool BitmapEx::Create( const ::com::sun::star::uno::Reference<
pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap(); pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap(); pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
if( pSalBmp->Create( xBitmapCanvas, aSize ) ) Size aLocalSize(rSize);
if( pSalBmp->Create( xBitmapCanvas, aLocalSize ) )
{ {
#ifdef CLAMP_BITDEPTH_PARANOIA if ( pSalMask->Create( xBitmapCanvas, aLocalSize, true ) )
// did we get alpha mixed up in the bitmap itself
// eg. Cairo Canvas ... yes performance of this is awful.
if( pSalBmp->GetBitCount() > 24 )
{
// Format convert the pixels with generic code
Bitmap aSrcPixels( pSalBmp );
aBitmap = Bitmap( rSize, 24 );
BitmapReadAccess aSrcRead( aSrcPixels );
BitmapWriteAccess aDestWrite( aBitmap );
aDestWrite.CopyBuffer( aSrcRead );
}
else
#endif
aBitmap = Bitmap( pSalBmp );
aBitmapSize = rSize;
if ( pSalMask->Create( xBitmapCanvas, aSize, true ) )
{ {
aMask = Bitmap( pSalMask ); *this = BitmapEx(Bitmap(pSalBmp), Bitmap(pSalMask) );
bAlpha = sal_True;
aBitmapSize = rSize;
eTransparent = !aMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP;
return true; return true;
} }
else else
{ {
bAlpha = sal_False; *this = BitmapEx(Bitmap(pSalBmp));
eTransparent = TRANSPARENT_NONE;
return true; return true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment