@@ -, +, @@ --- vcl/unx/source/printergfx/common_gfx.cxx | 61 ++++++++++-------------------- 1 files changed, 20 insertions(+), 41 deletions(-) --- 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) 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