From 17aa37f0c4ef42ddce6aad7b705f93c5f159f39e Mon Sep 17 00:00:00 2001 From: X-Ryl669 Date: Tue, 13 Jun 2017 15:44:10 +0200 Subject: [PATCH] Fix for gradient transformation when scaling is used --- src/nanosvg.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/nanosvg.h b/src/nanosvg.h index 5c3e86d..e5e8039 100644 --- a/src/nanosvg.h +++ b/src/nanosvg.h @@ -2694,12 +2694,12 @@ static float nsvg__viewAlign(float content, float container, int type) static void nsvg__scaleGradient(NSVGgradient* grad, float tx, float ty, float sx, float sy) { - grad->xform[0] *= sx; - grad->xform[1] *= sx; - grad->xform[2] *= sy; - grad->xform[3] *= sy; - grad->xform[4] += tx*sx; - grad->xform[5] += ty*sx; + float t[6]; + nsvg__xformSetTranslation(t, tx, ty); + nsvg__xformMultiply (grad->xform, t); + + nsvg__xformSetScale(t, sx, sy); + nsvg__xformMultiply (grad->xform, t); } static void nsvg__scaleToViewbox(NSVGparser* p, const char* units)