summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-05-28 14:10:46 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-05-28 14:12:42 +0200
commit4e93ac7f5c2b6a438f384a0f22ae0c18c1d73c0e (patch)
treeca6fc81850d566ca974dc99fe557d51b6a1fb37b /vcl/source
parentdd5fa48bf345c9be6374557b48a8c850765e9dd2 (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
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/gdimtf.cxx37
1 files changed, 33 insertions, 4 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 526196dc1054..63b2b78e97d5 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -48,6 +48,14 @@
#include <com/sun/star/graphic/XGraphicRenderer.hpp>
#include <comphelper/processfactory.hxx>
+#ifdef UNX
+#include <tools/prex.h>
+#include "unx/Xproto.h"
+#include <tools/postx.h>
+#include <unx/salunx.h>
+#include <unx/salbmp.h>
+#endif
+
using namespace com::sun::star;
// -----------
@@ -494,18 +502,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;
}
}