summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2016-01-22 11:39:41 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2016-01-29 12:02:11 +0000
commit6f12c93703b676b1b3839caaf2c21788e5d68477 (patch)
treeb62b26ed86f6e656ca66d85e828abd2475f03bc0 /drawinglayer
parent1d0f08cdf1b9396e97e068f97fd78f31b5906748 (diff)
tdf#91017 Enhance WMF import of EMR_ALPHABLEND action
The EMR_ALPHABLEND action was added 2012/2013, but missed support for Bitmaps with Mask/Alpha. Due to that files with WMF containing these actions may look different from before. Added suport to load contained Mask/Alpha information in DIBs and the needed additional processing through the display chain. WMF import is still based on Metafile creation, when it would be using Primitives more original data could be preserved. Change-Id: I577569848cee2528328181fa0c7eb7f87857d094 Reviewed-on: https://gerrit.libreoffice.org/21709 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/processor2d/vclhelperbufferdevice.cxx40
1 files changed, 37 insertions, 3 deletions
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index c9ef7ab24ad1..62d11c44673b 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -297,6 +297,9 @@ namespace drawinglayer
// copy AA flag for new target
mpContent->SetAntialiasing(mrOutDev.GetAntialiasing());
+
+ // copy RasterOp (e.g. may be ROP_XOR on destination)
+ mpContent->SetRasterOp(mrOutDev.GetRasterOp());
}
}
@@ -325,28 +328,50 @@ namespace drawinglayer
const Point aEmptyPoint;
const Size aSizePixel(maDestPixel.GetSize());
const bool bWasEnabledDst(mrOutDev.IsMapModeEnabled());
+#ifdef DBG_UTIL
static bool bDoSaveForVisualControl(false);
+#endif
mrOutDev.EnableMapMode(false);
mpContent->EnableMapMode(false);
Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel));
+#ifdef DBG_UTIL
if(bDoSaveForVisualControl)
{
- SvFileStream aNew( "c:\\content.bmp", StreamMode::WRITE|StreamMode::TRUNC);
+ SvFileStream aNew(
+#ifdef WNT
+ "c:\\content.bmp",
+#else
+ "~/content.bmp",
+#endif
+ StreamMode::WRITE|StreamMode::TRUNC);
WriteDIB(aContent, aNew, false, true);
}
+#endif
+
+ // during painting the buffer, disable evtl. set RasterOp (may be ROP_XOR)
+ const RasterOp aOrigRasterOp(mrOutDev.GetRasterOp());
+ mrOutDev.SetRasterOp(ROP_OVERPAINT);
if(mpAlpha)
{
mpAlpha->EnableMapMode(false);
const AlphaMask aAlphaMask(mpAlpha->GetBitmap(aEmptyPoint, aSizePixel));
+#ifdef DBG_UTIL
if(bDoSaveForVisualControl)
{
- SvFileStream aNew( "c:\\transparence.bmp", StreamMode::WRITE|StreamMode::TRUNC);
+ SvFileStream aNew(
+#ifdef WNT
+ "c:\\transparence.bmp",
+#else
+ "~/transparence.bmp",
+#endif
+ StreamMode::WRITE|StreamMode::TRUNC);
WriteDIB(aAlphaMask.GetBitmap(), aNew, false, true);
}
+#endif
mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask));
}
@@ -355,11 +380,19 @@ namespace drawinglayer
mpMask->EnableMapMode(false);
const Bitmap aMask(mpMask->GetBitmap(aEmptyPoint, aSizePixel));
+#ifdef DBG_UTIL
if(bDoSaveForVisualControl)
{
- SvFileStream aNew( "c:\\mask.bmp", StreamMode::WRITE|StreamMode::TRUNC);
+ SvFileStream aNew(
+#ifdef WNT
+ "c:\\mask.bmp",
+#else
+ "~/mask.bmp",
+#endif
+ StreamMode::WRITE|StreamMode::TRUNC);
WriteDIB(aMask, aNew, false, true);
}
+#endif
mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aMask));
}
@@ -374,6 +407,7 @@ namespace drawinglayer
mrOutDev.DrawBitmap(maDestPixel.TopLeft(), aContent);
}
+ mrOutDev.SetRasterOp(aOrigRasterOp);
mrOutDev.EnableMapMode(bWasEnabledDst);
}
}