[ooo-build-commit] patches/dev300

Thorsten Behrens thorsten at kemper.freedesktop.org
Mon Nov 16 08:36:08 PST 2009


 patches/dev300/apply                   |    2 
 patches/dev300/psprint-bezier-fix.diff |  106 +++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+)

New commits:
commit 54352af63e5afcb94efccfd2d5f3128575709d54
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Mon Nov 16 17:32:56 2009 +0100

    Fix bezier line PS output
    
    * patches/dev300/apply: added the patch
    * patches/dev300/psprint-bezier-fix.diff: PrinterGfx::DrawPolyLineBezier
      method was totally broken; apparently that has never been used before
      the drawing layer rewrite. Made it work.

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 18f6c4e..8ac928d 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3384,6 +3384,8 @@ sw-changes-format-fix.diff, Fong, n#545815
 sw-doc-image-export-size.diff, bnc#554549, i#59648, tml
 # add missing patch to upstreamed ppt gradient fix
 ppt-customshape-shading-fix.diff, i#102797, thorsten
+# proper PS output of bezier lines
+psprint-bezier-fix.diff, n#553219, thorsten
 
 [ NLPSolverBits ]
 # build NLPSolver extension when enabled (fate#304653)
diff --git a/patches/dev300/psprint-bezier-fix.diff b/patches/dev300/psprint-bezier-fix.diff
new file mode 100644
index 0000000..0619162
--- /dev/null
+++ b/patches/dev300/psprint-bezier-fix.diff
@@ -0,0 +1,106 @@
+Fix psprint bezier line output
+
+From: Thorsten Behrens <thb at openoffice.org>
+
+
+---
+
+ vcl/unx/source/printergfx/common_gfx.cxx |   61 ++++++++++--------------------
+ 1 files changed, 20 insertions(+), 41 deletions(-)
+
+
+diff --git vcl/unx/source/printergfx/common_gfx.cxx vcl/unx/source/printergfx/common_gfx.cxx
+index bd47777..be5bdd3 100644
+--- vcl/unx/source/printergfx/common_gfx.cxx
++++ vcl/unx/source/printergfx/common_gfx.cxx
+@@ -535,70 +535,49 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const BY
+     const sal_uInt32 nBezString = 1024;
+     sal_Char pString[nBezString];
+     
+-    if ( maLineColor.Is() && nPoints && pPath )
++    if ( nPoints > 1 && maLineColor.Is() && pPath )
+     {
+         PSSetColor (maLineColor);
+         PSSetColor ();
+         PSSetLineWidth ();
+ 
+-        if (pFlgAry[0] != POLY_NORMAL) //There must be a starting point to moveto
+-        {
+-            return;
+-        }
+-        else
+-        {
+-            snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y());
+-            WritePS(mpPageBody, pString);
+-        }
++        snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y());
++        WritePS(mpPageBody, pString);
+         
+         // Handle the drawing of mixed lines mixed with curves 
+         // - a normal point followed by a normal point is a line
+         // - a normal point followed by 2 control points and a normal point is a curve
+         for (unsigned int i=1; i<nPoints;)
+         {
+-            if (pFlgAry[i+1] != POLY_CONTROL) //If the next point is a POLY_NORMAL, we're drawing a line
++            if (pFlgAry[i] != POLY_CONTROL) //If the next point is a POLY_NORMAL, we're drawing a line
+             {
+-                if (i+1 >= nPoints) return; //Make sure we don't pass the end of the array
+                 snprintf(pString, nBezString, "%li %li lineto\n", pPath[i].X(), pPath[i].Y());
+                 i++;
+             }
+             else //Otherwise we're drawing a spline
+             {
+-                if (i+3 >= nPoints) return; //Make sure we don't pass the end of the array
+-                snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n",
+-                        pPath[i+1].X(), pPath[i+1].Y(),
+-                        pPath[i+2].X(), pPath[i+2].Y(),
+-                        pPath[i+3].X(), pPath[i+3].Y());
++                if (i+2 >= nPoints)               
++                    return; //Error: wrong sequence of contol/normal points somehow
++                if ((pFlgAry[i] == POLY_CONTROL) && (pFlgAry[i+1] == POLY_CONTROL) &&
++                    (pFlgAry[i+2] != POLY_CONTROL))
++                {
++                    snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n",
++                             pPath[i].X(), pPath[i].Y(), 
++                             pPath[i+1].X(), pPath[i+1].Y(), 
++                             pPath[i+2].X(), pPath[i+2].Y());
++                }
++                else
++                {
++                    fprintf(stderr, "Strange output\n");
++                }
+                 i+=3;
+             }
+             WritePS(mpPageBody, pString);
+         }
+-    }
+-
+-    // if eofill and stroke, save the current path
+-    if( maFillColor.Is() && maLineColor.Is())
+-        PSGSave();
+-
+-    // first draw area
+-    if( maFillColor.Is() )
+-    {
+-        PSSetColor (maFillColor);
+-        PSSetColor ();
+-        WritePS (mpPageBody, "eofill\n");
+-    }
+-
+-    // restore the current path
+-    if( maFillColor.Is() && maLineColor.Is())
+-        PSGRestore();
+ 
+-    // now draw outlines
+-    if( maLineColor.Is() )
+-    {
+-        PSSetColor (maLineColor);
+-        PSSetColor ();
+-        PSSetLineWidth ();
++        // now draw outlines
+         WritePS (mpPageBody, "stroke\n");
+-    }    
++    }
+ }
+ 
+ void


More information about the ooo-build-commit mailing list