From 312052816ec0dba3fd2c3321f1fe675ebbabb8fa Mon Sep 17 00:00:00 2001 From: Ryan Alexander Date: Thu, 17 Jul 2014 02:09:12 -0700 Subject: [PATCH] Set commandx/y before the transform This prevents commands like `nvgQuadTo` and `nvgArcTo` from double-transforming the previous point when they pass it back to `nvg__appendCommands`. --- src/nanovg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nanovg.c b/src/nanovg.c index 1e4afb5..d10f956 100644 --- a/src/nanovg.c +++ b/src/nanovg.c @@ -970,6 +970,11 @@ static void nvg__appendCommands(NVGcontext* ctx, float* vals, int nvals) ctx->ccommands = ccommands; } + if ((int)vals[0] != NVG_CLOSE && (int)vals[0] != NVG_WINDING) { + ctx->commandx = vals[nvals-2]; + ctx->commandy = vals[nvals-1]; + } + // transform commands i = 0; while (i < nvals) { @@ -1003,11 +1008,6 @@ static void nvg__appendCommands(NVGcontext* ctx, float* vals, int nvals) memcpy(&ctx->commands[ctx->ncommands], vals, nvals*sizeof(float)); ctx->ncommands += nvals; - - if ((int)vals[0] != NVG_CLOSE && (int)vals[0] != NVG_WINDING) { - ctx->commandx = vals[nvals-2]; - ctx->commandy = vals[nvals-1]; - } }