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

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


 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 7f8f7e7284e29cc0e8a0f282761abea428d0eb33
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri May 29 11:15:56 2020 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri May 29 11:25:57 2020 +0200

    tdf#101181: disable antialiasing for mask
    
    Since we need objects' bounds here, antialiasing them would make the
    resulting non-fully-transparent areas thicker, thus making the effect
    also thicker. Disable it here; also slightly increases performance.
    
    We can't do that for soft edge: the effect draws all its children as
    bitmap, so disabling AA would make all children areas unaffected by
    soft edge to have worse image quality.
    
    Change-Id: Ifc9a60ec7894bfe9d0209e04532c9ca0a1eb3867
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95096
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index d4ee5f39b7a0..8d217dcf18db 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -989,6 +989,9 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const primitive2d::GlowPrimitiv
         // remember last OutDev and set to content
         OutputDevice* pLastOutputDevice = mpOutputDevice;
         mpOutputDevice = &aBufferDevice.getContent();
+        // We don't need antialiased mask here, which would only make effect thicker
+        const auto aPrevAA = mpOutputDevice->GetAntialiasing();
+        mpOutputDevice->SetAntialiasing(AntialiasingFlags::NONE);
         mpOutputDevice->Erase();
         process(rCandidate);
         const tools::Rectangle aRect(static_cast<long>(std::floor(aRange.getMinX())),
@@ -996,6 +999,7 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const primitive2d::GlowPrimitiv
                                      static_cast<long>(std::ceil(aRange.getMaxX())),
                                      static_cast<long>(std::ceil(aRange.getMaxY())));
         BitmapEx bmpEx = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), aRect.GetSize());
+        mpOutputDevice->SetAntialiasing(aPrevAA);
 
         AlphaMask mask
             = ProcessAndBlurAlphaMask(bmpEx.GetAlpha(), fBlurRadius, fBlurRadius, nTransparency);
@@ -1033,6 +1037,8 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D(
         OutputDevice* pLastOutputDevice = mpOutputDevice;
         mpOutputDevice = &aBufferDevice.getContent();
         mpOutputDevice->Erase();
+        // Since the effect converts all children to bitmap, we can't disable antialiasing here,
+        // because it would result in poor quality in areas not affected by the effect
         process(rCandidate);
 
         const tools::Rectangle aRect(static_cast<long>(std::floor(aRange.getMinX())),


More information about the Libreoffice-commits mailing list