[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/headless

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 25 15:29:20 UTC 2019


 vcl/headless/svpgdi.cxx |   90 +++++++++++++++++++++++++++---------------------
 1 file changed, 51 insertions(+), 39 deletions(-)

New commits:
commit 171cb9e16caa2a5023d36d7cae07cd1ae1e126d5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 23 17:25:32 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Thu Jul 25 17:28:42 2019 +0200

    Resolves: tdf#126227 calc red change tracking rectangles missing their top
    
    cairo_set_matrix doesn't appear to have any effect on an existing path,
    so set a new path on both fill and stroke so the matrix set for line
    will have an effect, so drop cairo_fill_preserve to cairo_fill and
    rely on the path cache.
    
    Change-Id: I31f16b094c920b107467a9492c7194bb578c1924
    
    also featuring such commits as...
    
    Related: tdf#126227 don't need preserve variant here
    
    we're calling cairo_fill_preserve so we can reuse the same
    path to stroke. We don't use this path again after stroke.
    
    this change should have no visual effect
    
    Change-Id: I1ad6af875b0a58a0699b5d9801c76510cc242ab9
    
    Related: tdf#126227 factor out setting the polygon path
    
    this change should have no visual effect
    
    Change-Id: Id93519e6b74e2c9bc4ddf20e7ab903689d7d8ee3
    
    Related: tdf#126227 follow the same pattern as drawPolyPolygon
    
    in drawAlphaRect so the rect path is set after the matrix
    
    Change-Id: I3ded9383f6f16f77902c5ad576e520f37326e8af
    Reviewed-on: https://gerrit.libreoffice.org/76204
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 205c1153e02b..9eb040b46eee 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -554,16 +554,16 @@ bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
     // To make releaseCairoContext work, use empty extents
     basegfx::B2DRange extents;
 
-    cairo_rectangle(cr, nX, nY, nWidth, nHeight);
-
     if (bHasFill)
     {
+        cairo_rectangle(cr, nX, nY, nWidth, nHeight);
+
         applyColor(cr, m_aFillColor, fTransparency);
 
         // set FillDamage
         extents = getClippedFillDamage(cr);
 
-        cairo_fill_preserve(cr);
+        cairo_fill(cr);
     }
 
     if (bHasLine)
@@ -574,12 +574,14 @@ bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
         cairo_matrix_init_translate(&aMatrix, 0.5, 0.5);
         cairo_set_matrix(cr, &aMatrix);
 
+        cairo_rectangle(cr, nX, nY, nWidth, nHeight);
+
         applyColor(cr, m_aLineColor, fTransparency);
 
         // expand with possible StrokeDamage
         extents.expand(getClippedStrokeDamage(cr));
 
-        cairo_stroke_preserve(cr);
+        cairo_stroke(cr);
     }
 
     releaseCairoContext(cr, false, extents);
@@ -1377,6 +1379,45 @@ bool SvpSalGraphics::drawPolyPolygonBezier( sal_uInt32,
     return false;
 }
 
+namespace
+{
+    void add_polygon_path(cairo_t* cr, const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DHomMatrix& rObjectToDevice, bool bPixelSnap)
+    {
+        // try to access buffered data
+        std::shared_ptr<SystemDependentData_CairoPath> pSystemDependentData_CairoPath(
+            rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPath>());
+
+        if(pSystemDependentData_CairoPath)
+        {
+            // re-use data
+            cairo_append_path(cr, pSystemDependentData_CairoPath->getCairoPath());
+        }
+        else
+        {
+            // create data
+            for (const auto & rPoly : rPolyPolygon)
+            {
+                // PixelOffset used: Was dependent of 'm_aLineColor != SALCOLOR_NONE'
+                // Adapt setupPolyPolygon-users to set a linear transformation to achieve PixelOffset
+                AddPolygonToPath(
+                    cr,
+                    rPoly,
+                    rObjectToDevice,
+                    bPixelSnap,
+                    false);
+            }
+
+            // copy and add to buffering mechanism
+            // for decisions how/what to buffer, see Note in WinSalGraphicsImpl::drawPolyPolygon
+            pSystemDependentData_CairoPath = rPolyPolygon.addOrReplaceSystemDependentData<SystemDependentData_CairoPath>(
+                ImplGetSystemDependentDataManager(),
+                cairo_copy_path(cr),
+                false,
+                false);
+        }
+    }
+}
+
 bool SvpSalGraphics::drawPolyPolygon(
     const basegfx::B2DHomMatrix& rObjectToDevice,
     const basegfx::B2DPolyPolygon& rPolyPolygon,
@@ -1409,49 +1450,18 @@ bool SvpSalGraphics::drawPolyPolygon(
         cairo_set_matrix(cr, &aMatrix);
     }
 
-    // try to access buffered data
-    std::shared_ptr<SystemDependentData_CairoPath> pSystemDependentData_CairoPath(
-        rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPath>());
-
-    if(pSystemDependentData_CairoPath)
-    {
-        // re-use data
-        cairo_append_path(cr, pSystemDependentData_CairoPath->getCairoPath());
-    }
-    else
-    {
-        // create data
-        for (const auto & rPoly : rPolyPolygon)
-        {
-            // PixelOffset used: Was dependent of 'm_aLineColor != SALCOLOR_NONE'
-            // Adapt setupPolyPolygon-users to set a linear transformation to achieve PixelOffset
-            AddPolygonToPath(
-                cr,
-                rPoly,
-                rObjectToDevice,
-                !getAntiAliasB2DDraw(),
-                false);
-        }
-
-        // copy and add to buffering mechanism
-        // for decisions how/what to buffer, see Note in WinSalGraphicsImpl::drawPolyPolygon
-        pSystemDependentData_CairoPath = rPolyPolygon.addOrReplaceSystemDependentData<SystemDependentData_CairoPath>(
-            ImplGetSystemDependentDataManager(),
-            cairo_copy_path(cr),
-            false,
-            false);
-    }
-
     // To make releaseCairoContext work, use empty extents
     basegfx::B2DRange extents;
 
     if (bHasFill)
     {
+        add_polygon_path(cr, rPolyPolygon, rObjectToDevice, !getAntiAliasB2DDraw());
+
         applyColor(cr, m_aFillColor, fTransparency);
         // Get FillDamage (will be extended for LineDamage below)
         extents = getClippedFillDamage(cr);
 
-        cairo_fill_preserve(cr);
+        cairo_fill(cr);
     }
 
     if (bHasLine)
@@ -1461,12 +1471,14 @@ bool SvpSalGraphics::drawPolyPolygon(
         cairo_matrix_init_translate(&aMatrix, 0.5, 0.5);
         cairo_set_matrix(cr, &aMatrix);
 
+        add_polygon_path(cr, rPolyPolygon, rObjectToDevice, !getAntiAliasB2DDraw());
+
         applyColor(cr, m_aLineColor, fTransparency);
 
         // expand with possible StrokeDamage
         extents.expand(getClippedStrokeDamage(cr));
 
-        cairo_stroke_preserve(cr);
+        cairo_stroke(cr);
     }
 
     // if transformation has been applied, transform also extents (ranges)


More information about the Libreoffice-commits mailing list