[Libreoffice-commits] core.git: 2 commits - canvas/source

Caolán McNamara caolanm at redhat.com
Thu Oct 6 08:59:53 UTC 2016


 canvas/source/cairo/cairo_canvashelper.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit c5d355e9c9cbc94eede8f438895e192d834f7096
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 6 09:56:29 2016 +0100

    Resolves: tdf#103026 invalid dash causes CAIRO_STATUS_INVALID_DASH state
    
    Change-Id: I072635ff7c67022ebfd5bdb475e390f3aab7a51c

diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 773dbfa..b2f673b 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -1226,7 +1226,10 @@ namespace cairocanvas
                     break;
             }
 
-            if (strokeAttributes.DashArray.getLength() > 0)
+            //tdf#103026 If the w scaling is 0, then all dashes become zero so
+            //cairo will set the cairo_t status to CAIRO_STATUS_INVALID_DASH
+            //and no further drawing will occur
+            if (strokeAttributes.DashArray.getLength() > 0 && w > 0.0)
             {
                 auto aDashArray(comphelper::sequenceToContainer<std::vector<double>>(strokeAttributes.DashArray));
                 for (auto& rDash : aDashArray)
commit e713ec442de1370829f6d0e01d73b5d6ed6cd0f8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 6 09:48:12 2016 +0100

    use a vector here instead of manual mem management
    
    Change-Id: Ic0944837bc49f4a0e86f67bcb5dccc8c1854a396

diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 77a693d..773dbfa 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -1226,13 +1226,12 @@ namespace cairocanvas
                     break;
             }
 
-            if( strokeAttributes.DashArray.getLength() > 0 )
+            if (strokeAttributes.DashArray.getLength() > 0)
             {
-                double* pDashArray = new double[ strokeAttributes.DashArray.getLength() ];
-                for( sal_Int32 i=0; i<strokeAttributes.DashArray.getLength(); i++ )
-                    pDashArray[i] = strokeAttributes.DashArray[i] * w;
-                cairo_set_dash( mpCairo.get(), pDashArray, strokeAttributes.DashArray.getLength(), 0 );
-                delete[] pDashArray;
+                auto aDashArray(comphelper::sequenceToContainer<std::vector<double>>(strokeAttributes.DashArray));
+                for (auto& rDash : aDashArray)
+                    rDash *= w;
+                cairo_set_dash(mpCairo.get(), aDashArray.data(), aDashArray.size(), 0);
             }
 
             // TODO(rodo) use LineArray of strokeAttributes


More information about the Libreoffice-commits mailing list