diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-01-22 11:39:41 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-02-05 08:53:58 +0000 |
commit | bc257df73af5fdaf973c8229a743a3ea0ce06a67 (patch) | |
tree | ff0b2ca3d7aa3879bd9edfd66fad666ae61c88db /drawinglayer | |
parent | 17336c2aec3946144026dac509917acb6846e1c8 (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.
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>
(cherry picked from commit 6f12c93703b676b1b3839caaf2c21788e5d68477)
Change-Id: I577569848cee2528328181fa0c7eb7f87857d094
Reviewed-on: https://gerrit.libreoffice.org/22053
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor2d/vclhelperbufferdevice.cxx | 40 |
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); } } |