Browse Source

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`.
shared-context
Ryan Alexander 10 years ago
parent
commit
312052816e
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      src/nanovg.c

+ 5
- 5
src/nanovg.c View File

@@ -970,6 +970,11 @@ static void nvg__appendCommands(NVGcontext* ctx, float* vals, int nvals)
ctx->ccommands = ccommands; 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 // transform commands
i = 0; i = 0;
while (i < nvals) { 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)); memcpy(&ctx->commands[ctx->ncommands], vals, nvals*sizeof(float));


ctx->ncommands += nvals; ctx->ncommands += nvals;

if ((int)vals[0] != NVG_CLOSE && (int)vals[0] != NVG_WINDING) {
ctx->commandx = vals[nvals-2];
ctx->commandy = vals[nvals-1];
}
} }






Loading…
Cancel
Save