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>
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index b22ddab..53c9b48 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 de94ac3..40c36ab 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();
// 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);
}
}
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();
}
// dump buffer to outdev
aBufferDevice.paint();
}
}
}