From 088df4b517515526d6e74a7e14264ecf8f08408c Mon Sep 17 00:00:00 2001 From: Martin Fouilleul Date: Wed, 9 Oct 2024 12:19:37 +0200 Subject: [PATCH] [canvas] Fix coincident points elimination when selecting stroke end tangent. In case of coincident endpoints, the bogus increment would either read past the elements points, or select the first unused point for quadratics and lines. --- sketches/canvas/build.sh | 3 +-- src/graphics/wgpu_renderer.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sketches/canvas/build.sh b/sketches/canvas/build.sh index 3bd4027e..7f66781a 100755 --- a/sketches/canvas/build.sh +++ b/sketches/canvas/build.sh @@ -13,7 +13,6 @@ mkdir -p $BINDIR clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_canvas main.c cp $LIBDIR/liborca.dylib $BINDIR/ -cp $LIBDIR/mtl_renderer.metallib $BINDIR/ -cp $SRCDIR/ext/dawn/bin/libwebgpu.dylib $BINDIR/ +cp $LIBDIR/libwebgpu.dylib $BINDIR/ install_name_tool -add_rpath "@executable_path" $BINDIR/example_canvas diff --git a/src/graphics/wgpu_renderer.c b/src/graphics/wgpu_renderer.c index e72d90cd..d0c76995 100644 --- a/src/graphics/wgpu_renderer.c +++ b/src/graphics/wgpu_renderer.c @@ -2094,7 +2094,7 @@ void oc_wgpu_encode_stroke_element(oc_wgpu_canvas_encoding_context* context, } *endPoint = controlPoints[endPointIndex]; - for(int i = endPointIndex - 1; i >= 0; i++) + for(int i = endPointIndex - 1; i >= 0; i--) { if(controlPoints[i].x != endPoint->x || controlPoints[i].y != endPoint->y)