Skip to content

Commit

Permalink
[canvas] Fix coincident points elimination when selecting stroke end …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
martinfouilleul committed Oct 9, 2024
1 parent 4793a3b commit 088df4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions sketches/canvas/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/graphics/wgpu_renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 088df4b

Please sign in to comment.