2006-09-04 Eric Seidel <eric@eseidel.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Sep 2006 09:31:22 +0000 (09:31 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Sep 2006 09:31:22 +0000 (09:31 +0000)
        Reviewed by andersca.

        Clean-up style and spacing.
        http://bugzilla.opendarwin.org/show_bug.cgi?id=10724
        No tests needed, no functional changes.

        * ksvg2/svg/svgpathparser.cpp:
        (WebCore::parseCoord):
        (WebCore::SVGPolyParser::parsePoints):
        (WebCore::SVGPathParser::parseSVG):
        (WebCore::SVGPathParser::calculateArc):
        (WebCore::SVGPathParser::svgLineToHorizontal):
        (WebCore::SVGPathParser::svgLineToVertical):
        (WebCore::SVGPathParser::svgCurveToCubicSmooth):
        (WebCore::SVGPathParser::svgCurveToQuadratic):
        (WebCore::SVGPathParser::svgCurveToQuadraticSmooth):
        (WebCore::SVGPathParser::svgArcTo):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16213 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/ksvg2/svg/svgpathparser.cpp

index 615108a49de2e493ab48999758c316559a4b3e63..61504e4ce536164f3413d2783e0ef227e407e836 100644 (file)
@@ -1,3 +1,23 @@
+2006-09-04  Eric Seidel  <eric@eseidel.com>
+
+        Reviewed by andersca.
+
+        Clean-up style and spacing.
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10724
+        No tests needed, no functional changes.
+
+        * ksvg2/svg/svgpathparser.cpp:
+        (WebCore::parseCoord):
+        (WebCore::SVGPolyParser::parsePoints):
+        (WebCore::SVGPathParser::parseSVG):
+        (WebCore::SVGPathParser::calculateArc):
+        (WebCore::SVGPathParser::svgLineToHorizontal):
+        (WebCore::SVGPathParser::svgLineToVertical):
+        (WebCore::SVGPathParser::svgCurveToCubicSmooth):
+        (WebCore::SVGPathParser::svgCurveToQuadratic):
+        (WebCore::SVGPathParser::svgCurveToQuadraticSmooth):
+        (WebCore::SVGPathParser::svgArcTo):
+
 2006-09-04  Rob Buis  <buis@kde.org>
 
         Reviewed by Eric.
index db688b18ee47ab9ce5ca6510c02a1be10f93d9e8..a7889cdbcf0fc0d6aff8f7900b6df9cffd4e5c8b 100644 (file)
@@ -26,7 +26,7 @@
 
 namespace WebCore {
 
-const char *parseCoord(const char *ptr, double &number)
+const char* parseCoord(const char* ptr, double &number)
 {
     int integer, exponent;
     double decimal, frac;
@@ -40,10 +40,9 @@ const char *parseCoord(const char *ptr, double &number)
     expsign = 1;
 
     // read the sign
-    if(*ptr == '+')
+    if (*ptr == '+')
         ptr++;
-    else if(*ptr == '-')
-    {
+    else if (*ptr == '-') {
         ptr++;
         sign = -1;
     }
@@ -51,29 +50,25 @@ const char *parseCoord(const char *ptr, double &number)
     while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9')
         integer = (integer * 10) + *(ptr++) - '0';
 
-    if(*ptr == '.') // read the decimals
-    {
+    if (*ptr == '.') { // read the decimals
         ptr++;
         while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9')
             decimal += (*(ptr++) - '0') * (frac *= 0.1);
     }
 
-    if(*ptr == 'e' || *ptr == 'E') // read the exponent part
-    {
+    if (*ptr == 'e' || *ptr == 'E') { // read the exponent part
         ptr++;
 
         // read the sign of the exponent
-        if(*ptr == '+')
+        if (*ptr == '+')
             ptr++;
-        else if(*ptr == '-')
-        {
+        else if (*ptr == '-') {
             ptr++;
             expsign = -1;
         }
 
         exponent = 0;
-        while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9')
-        {
+        while(*ptr != '\0' && *ptr >= '0' && *ptr <= '9') {
             exponent *= 10;
             exponent += *ptr - '0';
             ptr++;
@@ -84,13 +79,13 @@ const char *parseCoord(const char *ptr, double &number)
     number *= sign * pow(10.0, expsign * exponent);
 
     // skip the following space
-    if(*ptr == ' ')
+    if (*ptr == ' ')
         ptr++;
 
     return ptr;
 }
 
-void SVGPolyParser::parsePoints(const DeprecatedString &s) const
+void SVGPolyParser::parsePoints(const DeprecatedStrings) const
 {
     if (!s.isEmpty()) {
         DeprecatedString pointData = s;
@@ -123,16 +118,14 @@ void SVGPolyParser::parsePoints(const DeprecatedString &s) const
     }
 }
 
-void
-SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
+void SVGPathParser::parseSVG(const DeprecatedString& s, bool process)
 {
-    if(!s.isEmpty())
-    {
+    if (!s.isEmpty()) {
         DeprecatedString d = s;
         d = d.replace(',', ' ');
         d = d.simplifyWhiteSpace();
-        const char *ptr = d.latin1();
-        const char *end = d.latin1() + d.length() + 1;
+        const charptr = d.latin1();
+        const charend = d.latin1() + d.length() + 1;
 
         double contrlx, contrly, curx, cury, subpathx, subpathy, tox, toy, x1, y1, x2, y2, xc, yc;
         double px1, py1, px2, py2, px3, py3;
@@ -140,32 +133,28 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
         char command = *(ptr++), lastCommand = ' ';
 
         subpathx = subpathy = curx = cury = contrlx = contrly = 0.0;
-        while( ptr < end )
-        {
-            if( *ptr == ' ' )
+        while(ptr < end) {
+            if (*ptr == ' ')
                 ptr++;
 
             relative = false;
 
-            //std::cout << "Command : " << command << std::endl;
-            switch( command )
+            switch(command)
             {
                 case 'm':
                     relative = true;
                 case 'M':
                 {
-                    ptr = parseCoord( ptr, tox );
-                    ptr = parseCoord( ptr, toy );
+                    ptr = parseCoord(ptr, tox);
+                    ptr = parseCoord(ptr, toy);
 
-                    if( process )
-                    {
+                    if (process) {
                         subpathx = curx = relative ? curx + tox : tox;
                         subpathy = cury = relative ? cury + toy : toy;
 
-                        svgMoveTo( curx, cury, closed );
-                    }
-                    else
-                        svgMoveTo( tox, toy, closed, !relative );
+                        svgMoveTo(curx, cury, closed);
+                    } else
+                        svgMoveTo(tox, toy, closed, !relative);
                     closed = false;
                     break;
                 }
@@ -173,74 +162,68 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                     relative = true;
                 case 'L':
                 {
-                    ptr = parseCoord( ptr, tox );
-                    ptr = parseCoord( ptr, toy );
+                    ptr = parseCoord(ptr, tox);
+                    ptr = parseCoord(ptr, toy);
 
-                    if( process )
-                    {
+                    if (process) {
                         curx = relative ? curx + tox : tox;
                         cury = relative ? cury + toy : toy;
 
-                        svgLineTo( curx, cury );
+                        svgLineTo(curx, cury);
                     }
                     else
-                        svgLineTo( tox, toy, !relative );
+                        svgLineTo(tox, toy, !relative);
                     break;
                 }
                 case 'h':
                 {
-                    ptr = parseCoord( ptr, tox );
-                    if( process )
-                    {
+                    ptr = parseCoord(ptr, tox);
+                    if (process) {
                         curx = curx + tox;
-                        svgLineTo( curx, cury );
+                        svgLineTo(curx, cury);
                     }
                     else
-                        svgLineToHorizontal( tox, false );
+                        svgLineToHorizontal(tox, false);
                     break;
                 }
                 case 'H':
                 {
-                    ptr = parseCoord( ptr, tox );
-                    if( process )
-                    {
+                    ptr = parseCoord(ptr, tox);
+                    if (process) {
                         curx = tox;
-                        svgLineTo( curx, cury );
+                        svgLineTo(curx, cury);
                     }
                     else
-                        svgLineToHorizontal( tox );
+                        svgLineToHorizontal(tox);
                     break;
                 }
                 case 'v':
                 {
-                    ptr = parseCoord( ptr, toy );
-                    if( process )
-                    {
+                    ptr = parseCoord(ptr, toy);
+                    if (process) {
                         cury = cury + toy;
-                        svgLineTo( curx, cury );
+                        svgLineTo(curx, cury);
                     }
                     else
-                        svgLineToVertical( toy, false );
+                        svgLineToVertical(toy, false);
                     break;
                 }
                 case 'V':
                 {
-                    ptr = parseCoord( ptr, toy );
-                    if( process )
-                    {
+                    ptr = parseCoord(ptr, toy);
+                    if (process) {
                         cury = toy;
-                        svgLineTo( curx, cury );
+                        svgLineTo(curx, cury);
                     }
                     else
-                        svgLineToVertical( toy );
+                        svgLineToVertical(toy);
                     break;
                 }
                 case 'z':
                 case 'Z':
                 {
                     // reset curx, cury for next path
-                    if( process )
-                    {
+                    if (process) {
                         curx = subpathx;
                         cury = subpathy;
                     }
@@ -252,15 +235,14 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                     relative = true;
                 case 'C':
                 {
-                    ptr = parseCoord( ptr, x1 );
-                    ptr = parseCoord( ptr, y1 );
-                    ptr = parseCoord( ptr, x2 );
-                    ptr = parseCoord( ptr, y2 );
-                    ptr = parseCoord( ptr, tox );
-                    ptr = parseCoord( ptr, toy );
-
-                    if( process )
-                    {
+                    ptr = parseCoord(ptr, x1);
+                    ptr = parseCoord(ptr, y1);
+                    ptr = parseCoord(ptr, x2);
+                    ptr = parseCoord(ptr, y2);
+                    ptr = parseCoord(ptr, tox);
+                    ptr = parseCoord(ptr, toy);
+
+                    if (process) {
                         px1 = relative ? curx + x1 : x1;
                         py1 = relative ? cury + y1 : y1;
                         px2 = relative ? curx + x2 : x2;
@@ -268,7 +250,7 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                         px3 = relative ? curx + tox : tox;
                         py3 = relative ? cury + toy : toy;
 
-                        svgCurveToCubic( px1, py1, px2, py2, px3, py3 );
+                        svgCurveToCubic(px1, py1, px2, py2, px3, py3);
 
                         contrlx = relative ? curx + x2 : x2;
                         contrly = relative ? cury + y2 : y2;
@@ -276,7 +258,7 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                         cury = relative ? cury + toy : toy;
                     }
                     else
-                        svgCurveToCubic( x1, y1, x2, y2, tox, toy, !relative );
+                        svgCurveToCubic(x1, y1, x2, y2, tox, toy, !relative);
 
                     break;
                 }
@@ -284,18 +266,17 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                     relative = true;
                 case 'S':
                 {
-                    ptr = parseCoord( ptr, x2 );
-                    ptr = parseCoord( ptr, y2 );
-                    ptr = parseCoord( ptr, tox );
-                    ptr = parseCoord( ptr, toy );
-                    if(!(lastCommand == 'c' || lastCommand == 'C' ||
+                    ptr = parseCoord(ptr, x2);
+                    ptr = parseCoord(ptr, y2);
+                    ptr = parseCoord(ptr, tox);
+                    ptr = parseCoord(ptr, toy);
+                    if (!(lastCommand == 'c' || lastCommand == 'C' ||
                          lastCommand == 's' || lastCommand == 'S')) {
                         contrlx = curx;
                         contrly = cury;
                     }
 
-                    if( process )
-                    {
+                    if (process) {
                         px1 = 2 * curx - contrlx;
                         py1 = 2 * cury - contrly;
                         px2 = relative ? curx + x2 : x2;
@@ -303,7 +284,7 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                         px3 = relative ? curx + tox : tox;
                         py3 = relative ? cury + toy : toy;
 
-                        svgCurveToCubic( px1, py1, px2, py2, px3, py3 );
+                        svgCurveToCubic(px1, py1, px2, py2, px3, py3);
 
                         contrlx = relative ? curx + x2 : x2;
                         contrly = relative ? cury + y2 : y2;
@@ -311,20 +292,19 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                         cury = relative ? cury + toy : toy;
                     }
                     else
-                        svgCurveToCubicSmooth( x2, y2, tox, toy, !relative );
+                        svgCurveToCubicSmooth(x2, y2, tox, toy, !relative);
                     break;
                 }
                 case 'q':
                     relative = true;
                 case 'Q':
                 {
-                    ptr = parseCoord( ptr, x1 );
-                    ptr = parseCoord( ptr, y1 );
-                    ptr = parseCoord( ptr, tox );
-                    ptr = parseCoord( ptr, toy );
+                    ptr = parseCoord(ptr, x1);
+                    ptr = parseCoord(ptr, y1);
+                    ptr = parseCoord(ptr, tox);
+                    ptr = parseCoord(ptr, toy);
 
-                    if( process )
-                    {
+                    if (process) {
                         px1 = relative ? (curx + 2 * (x1 + curx)) * (1.0 / 3.0) : (curx + 2 * x1) * (1.0 / 3.0);
                         py1 = relative ? (cury + 2 * (y1 + cury)) * (1.0 / 3.0) : (cury + 2 * y1) * (1.0 / 3.0);
                         px2 = relative ? ((curx + tox) + 2 * (x1 + curx)) * (1.0 / 3.0) : (tox + 2 * x1) * (1.0 / 3.0);
@@ -332,7 +312,7 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                         px3 = relative ? curx + tox : tox;
                         py3 = relative ? cury + toy : toy;
 
-                        svgCurveToCubic( px1, py1, px2, py2, px3, py3 );
+                        svgCurveToCubic(px1, py1, px2, py2, px3, py3);
 
                         contrlx = relative ? curx + x1 : x1;
                         contrly = relative ? cury + y1 : y1;
@@ -340,7 +320,7 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                         cury = relative ? cury + toy : toy;
                     }
                     else
-                        svgCurveToQuadratic( x1, y1, tox, toy, !relative );
+                        svgCurveToQuadratic(x1, y1, tox, toy, !relative);
                     break;
                 }
                 case 't':
@@ -349,14 +329,13 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                 {
                     ptr = parseCoord(ptr, tox);
                     ptr = parseCoord(ptr, toy);
-                    if(!(lastCommand == 'q' || lastCommand == 'Q' ||
+                    if (!(lastCommand == 'q' || lastCommand == 'Q' ||
                          lastCommand == 't' || lastCommand == 'T')) {
                         contrlx = curx;
                         contrly = cury;
                     }
 
-                    if( process )
-                    {
+                    if (process) {
                         xc = 2 * curx - contrlx;
                         yc = 2 * cury - contrly;
 
@@ -367,7 +346,7 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                         px3 = relative ? curx + tox : tox;
                         py3 = relative ? cury + toy : toy;
 
-                        svgCurveToCubic( px1, py1, px2, py2, px3, py3 );
+                        svgCurveToCubic(px1, py1, px2, py2, px3, py3);
 
                         contrlx = xc;
                         contrly = yc;
@@ -375,7 +354,7 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                         cury = relative ? cury + toy : toy;
                     }
                     else
-                        svgCurveToQuadraticSmooth( tox, toy, !relative );
+                        svgCurveToQuadraticSmooth(tox, toy, !relative);
                     break;
                 }
                 case 'a':
@@ -384,24 +363,24 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
                 {
                     bool largeArc, sweep;
                     double angle, rx, ry;
-                    ptr = parseCoord( ptr, rx );
-                    ptr = parseCoord( ptr, ry );
-                    ptr = parseCoord( ptr, angle );
-                    ptr = parseCoord( ptr, tox );
+                    ptr = parseCoord(ptr, rx);
+                    ptr = parseCoord(ptr, ry);
+                    ptr = parseCoord(ptr, angle);
+                    ptr = parseCoord(ptr, tox);
                     largeArc = tox == 1;
-                    ptr = parseCoord( ptr, tox );
+                    ptr = parseCoord(ptr, tox);
                     sweep = tox == 1;
-                    ptr = parseCoord( ptr, tox );
-                    ptr = parseCoord( ptr, toy );
+                    ptr = parseCoord(ptr, tox);
+                    ptr = parseCoord(ptr, toy);
 
                     // Spec: radii are nonnegative numbers
                     rx = fabs(rx);
                     ry = fabs(ry);
 
-                    if( process )
-                        calculateArc( relative, curx, cury, angle, tox, toy, rx, ry, largeArc, sweep );
+                    if (process)
+                        calculateArc(relative, curx, cury, angle, tox, toy, rx, ry, largeArc, sweep);
                     else
-                        svgArcTo( tox, toy, rx, ry, angle, largeArc, sweep, !relative );
+                        svgArcTo(tox, toy, rx, ry, angle, largeArc, sweep, !relative);
                     break;
                 }
                 default:
@@ -410,22 +389,20 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
             }
             lastCommand = command;
 
-            if(*ptr == '+' || *ptr == '-' || (*ptr >= '0' && *ptr <= '9'))
-            {
+            if (*ptr == '+' || *ptr == '-' || (*ptr >= '0' && *ptr <= '9')) {
                 // there are still coords in this command
-                if(command == 'M')
+                if (command == 'M')
                     command = 'L';
-                else if(command == 'm')
+                else if (command == 'm')
                     command = 'l';
             }
             else
                 command = *(ptr++);
 
-            iflastCommand != 'C' && lastCommand != 'c' &&
+            if (lastCommand != 'C' && lastCommand != 'c' &&
                 lastCommand != 'S' && lastCommand != 's' &&
                 lastCommand != 'Q' && lastCommand != 'q' &&
-                lastCommand != 'T' && lastCommand != 't' ) 
-            {
+                lastCommand != 'T' && lastCommand != 't') {
                 contrlx = curx;
                 contrly = cury;
             }
@@ -437,8 +414,7 @@ SVGPathParser::parseSVG( const DeprecatedString &s, bool process )
 // For each bezier found a svgToCurve call is done.
 // Adapted from Niko's code in kdelibs/kdecore/svgicons.
 // Maybe this can serve in some shared lib? (Rob)
-void
-SVGPathParser::calculateArc(bool relative, double &curx, double &cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag)
+void SVGPathParser::calculateArc(bool relative, double &curx, double &cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag)
 {
     double sin_th, cos_th;
     double a00, a01, a10, a11;
@@ -452,14 +428,14 @@ SVGPathParser::calculateArc(bool relative, double &curx, double &cury, double an
 
     double dx;
 
-    if(!relative)
+    if (!relative)
         dx = (curx - x) / 2.0;
     else
         dx = -x / 2.0;
 
     double dy;
         
-    if(!relative)
+    if (!relative)
         dy = (cury - y) / 2.0;
     else
         dy = -y / 2.0;
@@ -473,8 +449,7 @@ SVGPathParser::calculateArc(bool relative, double &curx, double &cury, double an
 
     // Spec : check if radii are large enough
     double check = Px / Pr1 + Py / Pr2;
-    if(check > 1)
-    {
+    if (check > 1) {
         r1 = r1 * sqrt(check);
         r2 = r2 * sqrt(check);
     }
@@ -487,12 +462,12 @@ SVGPathParser::calculateArc(bool relative, double &curx, double &cury, double an
     x0 = a00 * curx + a01 * cury;
     y0 = a10 * curx + a11 * cury;
 
-    if(!relative)
+    if (!relative)
         x1 = a00 * x + a01 * y;
     else
         x1 = a00 * (curx + x) + a01 * (cury + y);
         
-    if(!relative)
+    if (!relative)
         y1 = a10 * x + a11 * y;
     else
         y1 = a10 * (curx + x) + a11 * (cury + y);
@@ -507,12 +482,12 @@ SVGPathParser::calculateArc(bool relative, double &curx, double &cury, double an
 
     sfactor_sq = 1.0 / d - 0.25;
 
-    if(sfactor_sq < 0)
+    if (sfactor_sq < 0)
         sfactor_sq = 0;
 
     sfactor = sqrt(sfactor_sq);
 
-    if(sweepFlag == largeArcFlag)
+    if (sweepFlag == largeArcFlag)
         sfactor = -sfactor;
 
     xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);
@@ -523,85 +498,76 @@ SVGPathParser::calculateArc(bool relative, double &curx, double &cury, double an
     th1 = atan2(y1 - yc, x1 - xc);
 
     th_arc = th1 - th0;
-    if(th_arc < 0 && sweepFlag)
+    if (th_arc < 0 && sweepFlag)
         th_arc += 2 * M_PI;
-    else if(th_arc > 0 && !sweepFlag)
+    else if (th_arc > 0 && !sweepFlag)
         th_arc -= 2 * M_PI;
 
     n_segs = (int) (int) ceil(fabs(th_arc / (M_PI * 0.5 + 0.001)));
 
-    for(i = 0; i < n_segs; i++)
-    {
-        {
-            double sin_th, cos_th;
-            double a00, a01, a10, a11;
-            double x1, y1, x2, y2, x3, y3;
-            double t;
-            double th_half;
-
-            double _th0 = th0 + i * th_arc / n_segs;
-            double _th1 = th0 + (i + 1) * th_arc / n_segs;
-
-            sin_th = sin(angle * (M_PI / 180.0));
-            cos_th = cos(angle * (M_PI / 180.0));
-
-            /* inverse transform compared with rsvg_path_arc */
-            a00 = cos_th * r1;
-            a01 = -sin_th * r2;
-            a10 = sin_th * r1;
-            a11 = cos_th * r2;
-
-            th_half = 0.5 * (_th1 - _th0);
-            t = (8.0 / 3.0) * sin(th_half * 0.5) * sin(th_half * 0.5) / sin(th_half);
-            x1 = xc + cos(_th0) - t * sin(_th0);
-            y1 = yc + sin(_th0) + t * cos(_th0);
-            x3 = xc + cos(_th1);
-            y3 = yc + sin(_th1);
-            x2 = x3 + t * sin(_th1);
-            y2 = y3 - t * cos(_th1);
-
-            svgCurveToCubic( a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3 );
-        }
+    for(i = 0; i < n_segs; i++) {
+        double sin_th, cos_th;
+        double a00, a01, a10, a11;
+        double x1, y1, x2, y2, x3, y3;
+        double t;
+        double th_half;
+
+        double _th0 = th0 + i * th_arc / n_segs;
+        double _th1 = th0 + (i + 1) * th_arc / n_segs;
+
+        sin_th = sin(angle * (M_PI / 180.0));
+        cos_th = cos(angle * (M_PI / 180.0));
+
+        /* inverse transform compared with rsvg_path_arc */
+        a00 = cos_th * r1;
+        a01 = -sin_th * r2;
+        a10 = sin_th * r1;
+        a11 = cos_th * r2;
+
+        th_half = 0.5 * (_th1 - _th0);
+        t = (8.0 / 3.0) * sin(th_half * 0.5) * sin(th_half * 0.5) / sin(th_half);
+        x1 = xc + cos(_th0) - t * sin(_th0);
+        y1 = yc + sin(_th0) + t * cos(_th0);
+        x3 = xc + cos(_th1);
+        y3 = yc + sin(_th1);
+        x2 = x3 + t * sin(_th1);
+        y2 = y3 - t * cos(_th1);
+
+        svgCurveToCubic(a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3);
     }
 
-    if(!relative)
+    if (!relative)
         curx = x;
     else
         curx += x;
 
-    if(!relative)
+    if (!relative)
         cury = y;
     else
         cury += y;    
 }
 
-void
-SVGPathParser::svgLineToHorizontal( double, bool )
+void SVGPathParser::svgLineToHorizontal(double, bool)
 {
 }
 
-void
-SVGPathParser::svgLineToVertical( double, bool )
+void SVGPathParser::svgLineToVertical(double, bool)
 {
 }
 
-void
-SVGPathParser::svgCurveToCubicSmooth( double, double, double, double, bool )
+void SVGPathParser::svgCurveToCubicSmooth(double, double, double, double, bool)
 {
 }
 
-void
-SVGPathParser::svgCurveToQuadratic( double, double, double, double, bool )
+void SVGPathParser::svgCurveToQuadratic(double, double, double, double, bool)
 {
 }
 
-void
-SVGPathParser::svgCurveToQuadraticSmooth( double, double, bool )
+void SVGPathParser::svgCurveToQuadraticSmooth(double, double, bool)
 {
 }
 
-void
-SVGPathParser::svgArcTo( double, double, double, double, double, bool, bool, bool )
+void SVGPathParser::svgArcTo(double, double, double, double, double, bool, bool, bool)
 {
 }