From 7a9b4005c0de63d39753fdc0d81fea3f6a170255 Mon Sep 17 00:00:00 2001 From: X-Ryl669 Date: Thu, 1 Jun 2017 11:35:03 +0200 Subject: [PATCH] Fix for wrong computation in ArcTo function --- src/nanosvg.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/nanosvg.h b/src/nanosvg.h index 8a4b6fa..5c3e86d 100644 --- a/src/nanosvg.h +++ b/src/nanosvg.h @@ -2079,13 +2079,10 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args, // if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI; // if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0; - if (fa) { - // Choose large arc - if (da > 0.0f) - da = da - 2*NSVG_PI; - else - da = 2*NSVG_PI + da; - } + if (fs == 0 && da > 0) + da -= 2 * NSVG_PI; + else if (fs == 1 && da < 0) + da += 2 * NSVG_PI; // Approximate the arc using cubic spline segments. t[0] = cosrx; t[1] = sinrx;