diff --git a/src/nanosvgrast.h b/src/nanosvgrast.h index 9531bb4c..557037bd 100644 --- a/src/nanosvgrast.h +++ b/src/nanosvgrast.h @@ -357,8 +357,8 @@ static void nsvg__flattenCubicBez(NSVGrasterizer* r, dx = x4 - x1; dy = y4 - y1; - d2 = nsvg__absf(((x2 - x4) * dy - (y2 - y4) * dx)); - d3 = nsvg__absf(((x3 - x4) * dy - (y3 - y4) * dx)); + d2 = nsvg__absf((x2 - x4) * dy - (y2 - y4) * dx); + d3 = nsvg__absf((x3 - x4) * dy - (y3 - y4) * dx); if ((d2 + d3)*(d2 + d3) < r->tessTol * (dx*dx + dy*dy)) { nsvg__addPathPoint(r, x4, y4, type); @@ -366,7 +366,7 @@ static void nsvg__flattenCubicBez(NSVGrasterizer* r, } ++level; if (level > max_level) return; - + x234 = (x23+x34)*0.5f; y234 = (y23+y34)*0.5f; x1234 = (x123+x234)*0.5f; @@ -1291,8 +1291,9 @@ static void nsvg__initPaint(NSVGcachedPaint* cache, NSVGpaint* paint, float opac for (i = 0; i < 256; i++) cache->colors[i] = 0; } else if (grad->nstops == 1) { + unsigned int color = nsvg__applyOpacity(grad->stops[0].color, opacity); for (i = 0; i < 256; i++) - cache->colors[i] = nsvg__applyOpacity(grad->stops[i].color, opacity); + cache->colors[i] = color; } else { unsigned int ca, cb = 0; float ua, ub, du, u;