summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-05-28 14:04:40 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-05-28 14:11:24 +0200
commit19caa204bd1a366ff8452c0f4bbb79fd0ef549f2 (patch)
tree67b84baa8ad0249ff8325b5d5f44900b515fc4c4
parente39e9e4cd8a7c9a1d465eeec88aa5581de535fa6 (diff)
fix emf transparency handling (bnc#820385)
46e53913e9dcc84ffed8fb5f1b4959c70c7e5649 fixed some transparency emf problems on X11, it however did it by implementing alpha support in X11SalBitmap only and made generic code rely on it. Now it doesn't work at least on Windows, after reverting it works on Windows but not on X11. As I have no idea what the real problem is, at least keep both code paths. Change-Id: I2f2cf247becfcd777b4f3d129efe4d6a5d641f7b
-rw-r--r--vcl/inc/salbmp.hxx1
-rw-r--r--vcl/source/gdi/gdimtf.cxx33
2 files changed, 29 insertions, 5 deletions
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index be181f9e5e68..09b40d9b74f4 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -48,7 +48,6 @@ public:
Size& rSize,
bool bMask = false ) = 0;
virtual bool HasAlpha() const { return false; }
- virtual void SetHasAlpha( bool ) { }
virtual void Destroy() = 0;
virtual Size GetSize() const = 0;
virtual sal_uInt16 GetBitCount() const = 0;
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 5fdcba0447fd..7ca07e136a5c 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -47,6 +47,10 @@
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/graphic/XGraphicRenderer.hpp>
+#ifdef UNX
+#include <unx/salbmp.h>
+#endif
+
using namespace com::sun::star;
#define GAMMA( _def_cVal, _def_InvGamma ) ((sal_uInt8)MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0L,255L))
@@ -442,18 +446,39 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
}
SalBitmap* pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
- pSalBmp->SetHasAlpha( true );
-
- if( pSalBmp->Create( xBitmapCanvas, aSize ) )
+ // 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( pSalBmp );
+ 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 ) )
+ {
+ 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;
+#endif
delete pSalBmp;
}
}