[Libreoffice-commits] core.git: canvas/source vcl/headless vcl/unx vcl/win

Armin Le Grand Armin.Le.Grand at cib.de
Thu Jul 28 09:42:36 UTC 2016


 canvas/source/cairo/cairo_canvashelper.cxx |   12 +++++++-----
 vcl/headless/svpgdi.cxx                    |    8 +++++---
 vcl/unx/generic/gdi/salgdi.cxx             |    8 +++++---
 vcl/win/gdi/gdiimpl.cxx                    |   13 ++++++-------
 4 files changed, 23 insertions(+), 18 deletions(-)

New commits:
commit ffa1c7bc86093b8445656bab1538939b9d3a6d88
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Thu Jul 21 11:10:53 2016 +0200

    tdf#101026 Create more correct replacement control vector
    
    Change-Id: I909adaab3dca3c1bac4331b164343cdbc1205df2
    Reviewed-on: https://gerrit.libreoffice.org/27365
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>

diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index cd9a79e..46f71a1 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -1026,16 +1026,18 @@ namespace cairocanvas
 
                             // tdf#99165 if the control points are 'empty', create the mathematical
                             // correct replacement ones to avoid problems with the graphical sub-system
-                            if(basegfx::fTools::equal(nAX, nLastX) && basegfx::fTools::equal(nAY, nLastY))
+                            // tdf#101026 The 1st attempt to create a mathematically correct replacement control
+                            // vector was wrong. Best alternative is one as close as possible which means short.
+                            if (basegfx::fTools::equal(nAX, nLastX) && basegfx::fTools::equal(nAY, nLastY))
                             {
-                                nAX = nLastX + ((nBX - nLastX) * 0.3);
-                                nAY = nLastY + ((nBY - nLastY) * 0.3);
+                                nAX = nLastX + ((nBX - nLastX) * 0.0005);
+                                nAY = nLastY + ((nBY - nLastY) * 0.0005);
                             }
 
                             if(basegfx::fTools::equal(nBX, nX) && basegfx::fTools::equal(nBY, nY))
                             {
-                                nBX = nX + ((nAX - nX) * 0.3);
-                                nBY = nY + ((nAY - nY) * 0.3);
+                                nBX = nX + ((nAX - nX) * 0.0005);
+                                nBY = nY + ((nAY - nY) * 0.0005);
                             }
 
                             cairo_curve_to( pCairo, nAX, nAY, nBX, nBY, nX, nY );
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 7482a68..af26bd1 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -651,14 +651,16 @@ static void AddPolygonToPath(cairo_t* cr, const basegfx::B2DPolygon& rPolygon, b
 
             // tdf#99165 if the control points are 'empty', create the mathematical
             // correct replacement ones to avoid problems with the graphical sub-system
-            if(aCP1.equal(aLast))
+            // tdf#101026 The 1st attempt to create a mathematically correct replacement control
+            // vector was wrong. Best alternative is one as close as possible which means short.
+            if (aCP1.equal(aLast))
             {
-                aCP1 = aLast + ((aCP2 - aLast) * 0.3);
+                aCP1 = aLast + ((aCP2 - aLast) * 0.0005);
             }
 
             if(aCP2.equal(aPoint))
             {
-                aCP2 = aPoint + ((aCP1 - aPoint) * 0.3);
+                aCP2 = aPoint + ((aCP1 - aPoint) * 0.0005);
             }
 
             cairo_curve_to(cr, aCP1.getX(), aCP1.getY(), aCP2.getX(), aCP2.getY(),
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 66c9e62..72daa71 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -825,14 +825,16 @@ bool X11SalGraphics::drawPolyLine(
                     // miter graphics (and maybe others) when empty control points
                     // are used, so fallback to the mathematical 'default' control
                     // points in that case
-                    if(aStart.equal(aCP1))
+                    // tdf#101026 The 1st attempt to create a mathematically correct replacement control
+                    // vector was wrong. Best alternative is one as close as possible which means short.
+                    if (aStart.equal(aCP1))
                     {
-                        aCP1 = aStart + ((aCP2 - aStart) * 0.3);
+                        aCP1 = aStart + ((aCP2 - aStart) * 0.0005);
                     }
 
                     if(aEnd.equal(aCP2))
                     {
-                        aCP2 = aEnd + ((aCP1 - aEnd) * 0.3);
+                        aCP2 = aEnd + ((aCP1 - aEnd) * 0.0005);
                     }
 
                     cairo_curve_to(cr,
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 09c63f5..9968222 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1925,19 +1925,18 @@ void impAddB2DPolygonToGDIPlusGraphicsPathReal(
                     // tdf#99165 MS Gdiplus cannot handle creating correct extra geometry for fat lines
                     // with LineCap or LineJoin when a bezier segment starts or ends trivial, e.g. has
                     // no 1st or 2nd control point, despite that these are mathematicaly correct definitions
-                    // (basegfx can handle that). To solve, create replacement vectors to thre resp. next
-                    // control point with 1/3rd of length (the default control vector for these cases).
-                    // Only one of this can happen here, else the is(Next|Prev)ControlPointUsed wopuld have
-                    // both been false.
+                    // (basegfx can handle that).
                     // Caution: This error (and it's correction) might be necessary for other graphical
-                    // sub-systems in a similar way
+                    // sub-systems in a similar way.
+                    // tdf#101026 The 1st attempt to create a mathematically correct replacement control
+                    // vector was wrong. Best alternative is one as close as possible which means short.
                     if(!b1stControlPointUsed)
                     {
-                        aCa = aCurr + ((aCb - aCurr) * 0.3);
+                        aCa = aCurr + ((aCb - aCurr) * 0.0005);
                     }
                     else if(!b2ndControlPointUsed)
                     {
-                        aCb = aNext + ((aCa - aNext) * 0.3);
+                        aCb = aNext + ((aCa - aNext) * 0.0005);
                     }
 
                     rGraphicsPath.AddBezier(


More information about the Libreoffice-commits mailing list