[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Fri May 29 04:26:31 UTC 2020


 drawinglayer/source/primitive2d/glowprimitive2d.cxx     |   16 ----------------
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   15 +++++++--------
 include/drawinglayer/primitive2d/glowprimitive2d.hxx    |    5 -----
 3 files changed, 7 insertions(+), 29 deletions(-)

New commits:
commit c9f4952b98da9adad1b556414c5fcecafedca473
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu May 28 17:51:15 2020 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri May 29 06:25:48 2020 +0200

    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 at collabora.com>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

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;
diff --git a/include/drawinglayer/primitive2d/glowprimitive2d.hxx b/include/drawinglayer/primitive2d/glowprimitive2d.hxx
index 5c3029882de2..62a585276b85 100644
--- a/include/drawinglayer/primitive2d/glowprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/glowprimitive2d.hxx
@@ -52,11 +52,6 @@ public:
     virtual basegfx::B2DRange
     getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
 
-    ///  create decomposition
-    virtual void
-    get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
-                       const geometry::ViewInformation2D& rViewInformation) const override;
-
     /// provide unique ID
     virtual sal_uInt32 getPrimitive2DID() const override;
 };


More information about the Libreoffice-commits mailing list