diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-03-29 14:05:55 +0000 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-04-18 12:26:15 +0200 |
commit | 6affe1576e34d6bc111d1db38416492375fd5fcc (patch) | |
tree | 609fc920e0d3e43cf6caf058c59b9b58b11b5ee6 /drawinglayer | |
parent | a601e0867d0ac2c80342308622bfcc3546fce746 (diff) |
tdf#115843 avoid using transparent virtualdevice when 100% opaque
which for the common case avoids the narrowing of hidpi outputdevices
through non-hidpi bitmaps
Change-Id: Ibdc004a0946e8cb118818e58a01e5791c869353a
Reviewed-on: https://gerrit.libreoffice.org/69930
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit b1f961e3a459d2772f12da556ab74fa635d6a46a)
after...
copy between the outputdevices without interim Bitmap
Change-Id: I6c0097b1b069cad2771c94210986714d59431e4f
Reviewed-on: https://gerrit.libreoffice.org/69929
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 11fe18ea21974e4fdc01a3f4a455725cec8ce11a)
Reviewed-on: https://gerrit.libreoffice.org/69938
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor2d/vclhelperbufferdevice.cxx | 9 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclprocessor2d.cxx | 45 |
2 files changed, 31 insertions, 23 deletions
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index b22ddabf00a0..53c9b4876927 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -334,7 +334,6 @@ namespace drawinglayer mrOutDev.EnableMapMode(false); mpContent->EnableMapMode(false); - Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel)); #ifdef DBG_UTIL if(bDoSaveForVisualControl) @@ -346,6 +345,7 @@ namespace drawinglayer "~/content.bmp", #endif StreamMode::WRITE|StreamMode::TRUNC); + Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel)); WriteDIB(aContent, aNew, false, true); } #endif @@ -373,6 +373,7 @@ namespace drawinglayer } #endif + Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel)); mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); } else if(mpMask) @@ -394,17 +395,21 @@ namespace drawinglayer } #endif + Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel)); mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aMask)); } else if(0.0 != fTrans) { sal_uInt8 nMaskValue(static_cast<sal_uInt8>(basegfx::fround(fTrans * 255.0))); const AlphaMask aAlphaMask(aSizePixel, &nMaskValue); + Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel)); mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); } else { - mrOutDev.DrawBitmap(maDestPixel.TopLeft(), aContent); + mrOutDev.DrawOutDev(maDestPixel.TopLeft(), aSizePixel, + aEmptyPoint, aSizePixel, + *mpContent); } mrOutDev.SetRasterOp(aOrigRasterOp); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index de94ac307120..40c36abac9e9 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -726,29 +726,32 @@ namespace drawinglayer // back to old OutDev mpOutputDevice = pLastOutputDevice; - // draw mask - if(getOptionsDrawinglayer().IsAntiAliasing()) + // if the mask fills the whole area we can skip + // creating a transparent vd and filling it. + if (!basegfx::utils::isRectangle(aMask)) { - // with AA, use 8bit AlphaMask to get nice borders - VirtualDevice& rTransparence = aBufferDevice.getTransparence(); - rTransparence.SetLineColor(); - rTransparence.SetFillColor(COL_BLACK); - rTransparence.DrawPolyPolygon(aMask); - - // dump buffer to outdev - aBufferDevice.paint(); - } - else - { - // No AA, use 1bit mask - VirtualDevice& rMask = aBufferDevice.getMask(); - rMask.SetLineColor(); - rMask.SetFillColor(COL_BLACK); - rMask.DrawPolyPolygon(aMask); - - // dump buffer to outdev - aBufferDevice.paint(); + // draw mask + if(getOptionsDrawinglayer().IsAntiAliasing()) + { + // with AA, use 8bit AlphaMask to get nice borders + VirtualDevice& rTransparence = aBufferDevice.getTransparence(); + rTransparence.SetLineColor(); + rTransparence.SetFillColor(COL_BLACK); + rTransparence.DrawPolyPolygon(aMask); + } + else + { + // No AA, use 1bit mask + VirtualDevice& rMask = aBufferDevice.getMask(); + rMask.SetLineColor(); + rMask.SetFillColor(COL_BLACK); + rMask.DrawPolyPolygon(aMask); + } } + + // dump buffer to outdev + aBufferDevice.paint(); + } } } |