summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-05-28 15:13:15 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-05-29 10:31:03 +0200
commita89d2a19930ba4f14bc498978664c45bfd3e8b58 (patch)
tree51cac26ae704aab92de19900f1abbaedbcf176e9 /drawinglayer
parentbb591a57cf62714af291e1b0807e017c0763cd48 (diff)
tdf#49247: Reimplement soft edges to keep object transparency
So the objects that were semi-transparent don't become opaque upon applying soft edge effect. This requires that the objects are actually semi-transparent, so that we can get alpha mask from bitmap Change-Id: Ic4af9bea19e5e71139d3f065797583f7c7c78815 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95034 Tested-by: Jenkins Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 425125e31f9053e0e4895fb13e1e267ec5d26487) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95079
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx21
1 files changed, 8 insertions, 13 deletions
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 9e44ef292d34..3c1a1087adcf 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1027,33 +1027,28 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D(
// Blur radius is equal to soft edge radius
const double fBlurRadius = aRadiusVector.getLength();
- impBufferDevice aBufferDevice(*mpOutputDevice, aRange);
+ impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
if (aBufferDevice.isVisible())
{
// remember last OutDev and set to content
OutputDevice* pLastOutputDevice = mpOutputDevice;
mpOutputDevice = &aBufferDevice.getContent();
- // Processing will draw whatever geometry on white background, applying *black*
- // replacement color
mpOutputDevice->Erase();
- rCandidate.setMaskGeneration();
process(rCandidate);
- rCandidate.setMaskGeneration(false);
+
const tools::Rectangle aRect(static_cast<long>(std::floor(aRange.getMinX())),
static_cast<long>(std::floor(aRange.getMinY())),
static_cast<long>(std::ceil(aRange.getMaxX())),
static_cast<long>(std::ceil(aRange.getMaxY())));
- Bitmap bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), aRect.GetSize());
-
- AlphaMask mask = ProcessAndBlurAlphaMask(bitmap, -fBlurRadius, fBlurRadius, 0);
+ BitmapEx bitmap = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), aRect.GetSize());
- // The end result is the original bitmap with blurred 8-bit alpha mask
+ AlphaMask aMask = bitmap.GetAlpha();
+ AlphaMask blurMask = ProcessAndBlurAlphaMask(aMask, -fBlurRadius, fBlurRadius, 0);
- mpOutputDevice->Erase();
- process(rCandidate);
- bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), aRect.GetSize());
+ aMask.BlendWith(blurMask);
- BitmapEx result(bitmap, mask);
+ // The end result is the original bitmap with blurred 8-bit alpha mask
+ BitmapEx result(bitmap.GetBitmap(), aMask);
// back to old OutDev
mpOutputDevice = pLastOutputDevice;