[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - 2 commits - drawinglayer/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 10 09:18:01 UTC 2021


 drawinglayer/source/processor2d/vclprocessor2d.cxx |   40 ++++++++-------------
 1 file changed, 17 insertions(+), 23 deletions(-)

New commits:
commit 3d343f870df96a96f133429c9df0d0d4488137db
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Mar 4 15:35:44 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Mar 10 10:17:32 2021 +0100

    make RenderMaskPrimitive2DPixel() clip using clipping (tdf#140797)
    
    The original implementation had this peculiar idea of implementing
    clipping using transparency, which slows everything down, because
    contents need to be copied and then alpha-blended. Keep that only
    for when edges of the clip are to be smoothed.
    As a side-effect this also seems to fix tdf#115843 again.
    The commit also adjusts the test for tdf#133477 to not rely
    on the rounding introduced by the optimization from tdf#115843.
    
    Change-Id: Iebae5996159cf9f17066205985c5b591abdae105
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111966
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 6b8c157a0b4f37a09fdbf656919b2df06a3abc3e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112217
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112249

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index e937ac0e8fad..3b469af3a145 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -757,7 +757,7 @@ void VclProcessor2D::RenderPolyPolygonGraphicPrimitive2D(
     }
 }
 
-// mask group. Force output to VDev and create mask from given mask
+// mask group
 void VclProcessor2D::RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate)
 {
     if (rMaskCandidate.getChildren().empty())
@@ -769,6 +769,17 @@ void VclProcessor2D::RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive
         return;
 
     aMask.transform(maCurrentTransformation);
+
+    // Unless smooth edges are needed, simply use clipping.
+    if (basegfx::utils::isRectangle(aMask) || !getOptionsDrawinglayer().IsAntiAliasing())
+    {
+        mpOutputDevice->Push(PushFlags::CLIPREGION);
+        mpOutputDevice->IntersectClipRegion(vcl::Region(aMask));
+        process(rMaskCandidate.getChildren());
+        mpOutputDevice->Pop();
+        return;
+    }
+
     const basegfx::B2DRange aRange(basegfx::utils::getRange(aMask));
     impBufferDevice aBufferDevice(*mpOutputDevice, aRange);
 
@@ -785,19 +796,11 @@ void VclProcessor2D::RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive
     // back to old OutDev
     mpOutputDevice = pLastOutputDevice;
 
-    // if the mask fills the whole area we can skip
-    // creating a transparent vd and filling it.
-    if (!basegfx::utils::isRectangle(aMask))
-    {
-        // draw mask
-        // with AA, use 8bit AlphaMask to get nice borders; no AA -> use 1bit mask
-        VirtualDevice& rMask = getOptionsDrawinglayer().IsAntiAliasing()
-                                   ? aBufferDevice.getTransparence()
-                                   : aBufferDevice.getMask();
-        rMask.SetLineColor();
-        rMask.SetFillColor(COL_BLACK);
-        rMask.DrawPolyPolygon(aMask);
-    }
+    // draw mask
+    VirtualDevice& rMask = aBufferDevice.getTransparence();
+    rMask.SetLineColor();
+    rMask.SetFillColor(COL_BLACK);
+    rMask.DrawPolyPolygon(aMask);
 
     // dump buffer to outdev
     aBufferDevice.paint();
commit e0348118fc7ce7591782b4929c338d4832f3365d
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Aug 20 00:06:18 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Mar 10 10:16:05 2021 +0100

    Deduplicate some code
    
    Change-Id: I37c492adef30db748eaa975247d386dcd953257b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100949
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112248

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index ffb649da3554..e937ac0e8fad 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -790,22 +790,13 @@ void VclProcessor2D::RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive
     if (!basegfx::utils::isRectangle(aMask))
     {
         // 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);
-        }
+        // with AA, use 8bit AlphaMask to get nice borders; no AA -> use 1bit mask
+        VirtualDevice& rMask = getOptionsDrawinglayer().IsAntiAliasing()
+                                   ? aBufferDevice.getTransparence()
+                                   : aBufferDevice.getMask();
+        rMask.SetLineColor();
+        rMask.SetFillColor(COL_BLACK);
+        rMask.DrawPolyPolygon(aMask);
     }
 
     // dump buffer to outdev


More information about the Libreoffice-commits mailing list