diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-05-28 17:51:15 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-05-29 10:31:31 +0200 |
commit | f510bdfa98014ca0ae596dcd0dfd487cfc90f3eb (patch) | |
tree | 0d4ade22773f02da721f1a86a048b4836338464c /drawinglayer/source | |
parent | c8787b8469053bfa1105697d7852dbdac4a184ba (diff) |
tdf#101181: use buffer device with alpha in glow effect
Change-Id: Iddc94a5cfdee03befdf245ee086a872f0bfaf7a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95051
Tested-by: Jenkins
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit c9f4952b98da9adad1b556414c5fcecafedca473)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95082
Diffstat (limited to 'drawinglayer/source')
-rw-r--r-- | drawinglayer/source/primitive2d/glowprimitive2d.cxx | 16 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 15 |
2 files changed, 7 insertions, 24 deletions
diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx b/drawinglayer/source/primitive2d/glowprimitive2d.cxx index bf49b8e215b5..fb6a599ab4e2 100644 --- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx @@ -60,22 +60,6 @@ GlowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation return aRetval; } -void GlowPrimitive2D::get2DDecomposition( - Primitive2DDecompositionVisitor& rVisitor, - const geometry::ViewInformation2D& /*rViewInformation*/) const -{ - if (getChildren().empty()) - return; - - // create a modifiedColorPrimitive containing the *black* color and the content. Using black - // on white allows creating useful mask in VclPixelProcessor2D::processGlowPrimitive2D. - basegfx::BColorModifierSharedPtr aBColorModifier - = std::make_shared<basegfx::BColorModifier_replace>(basegfx::BColor()); - - const Primitive2DReference xRef(new ModifiedColorPrimitive2D(getChildren(), aBColorModifier)); - rVisitor.append(xRef); -} - // provide unique ID ImplPrimitive2DIDBlock(GlowPrimitive2D, PRIMITIVE2D_ID_GLOWPRIMITIVE2D) diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 3c1a1087adcf..d4ee5f39b7a0 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -983,30 +983,29 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const primitive2d::GlowPrimitiv // Consider glow transparency (initial transparency near the object edge) const sal_uInt8 nTransparency = rCandidate.getGlowColor().GetTransparency(); - 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. The black color replacement is added in 2d decomposition of - // glow primitive. mpOutputDevice->Erase(); process(rCandidate); 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()); + BitmapEx bmpEx = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), aRect.GetSize()); - AlphaMask mask = ProcessAndBlurAlphaMask(bitmap, fBlurRadius, fBlurRadius, nTransparency); + AlphaMask mask + = ProcessAndBlurAlphaMask(bmpEx.GetAlpha(), fBlurRadius, fBlurRadius, nTransparency); // The end result is the bitmap filled with glow color and blurred 8-bit alpha mask const basegfx::BColor aGlowColor( maBColorModifierStack.getModifiedColor(rCandidate.getGlowColor().getBColor())); - bitmap.Erase(Color(aGlowColor)); - BitmapEx result(bitmap, mask); + Bitmap bmp = bmpEx.GetBitmap(); + bmp.Erase(Color(aGlowColor)); + BitmapEx result(bmp, mask); // back to old OutDev mpOutputDevice = pLastOutputDevice; |