Skip to content

Commit

Permalink
Merge pull request #396 from linebender/kurbo_0_10_4
Browse files Browse the repository at this point in the history
Fix strokes by updating kurbo dep
  • Loading branch information
raphlinus authored Oct 26, 2023
2 parents 9a6ef95 + a0cb56b commit 37459da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ raw-window-handle = "0.5"
futures-intrusive = "0.5.0"
vello_encoding = { path = "crates/encoding" }
wgpu-profiler = { workspace = true, optional = true }
# Note: we pick up a kurbo dependency transitively through peniko.
# However, we need at least version 0.10.4 for proper stroking.
# Next time we bump peniko, this can be removed.
kurbo = "0.10.4"

[workspace.dependencies]
bytemuck = { version = "1.12.1", features = ["derive"] }
Expand Down
9 changes: 2 additions & 7 deletions examples/scenes/src/test_scenes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,7 @@ fn tricky_strokes(sb: &mut SceneBuilder, _: &mut SceneParams) {
[(475., 708.), (62., 620.), (770., 304.), (220., 659.)],
[(0., 0.), (128., 128.), (128., 0.), (0., 128.)], // Perfect cusp
[(0., 0.01), (128., 127.999), (128., 0.01), (0., 127.99)], // Near-cusp
];

// FIXME: The following curves all cause a crash due to a stack overflow following an
// infinite recursion in `kurbo::fit::fit_to_bezpath_rec` which gets called by
// `SceneBuilder::stroke` below. Disabling these tests until kurbo handles these
// gracefully. Move these into `tricky_cubics` above once they are fixed.
let _broken_cubics = [
// The following cases used to be `_broken_cubics` but now work.
[(0., -0.01), (128., 128.001), (128., -0.01), (0., 128.001)], // Near-cusp
[(0., 0.), (0., -10.), (0., -10.), (0., 10.)], // Flat line with 180
[(10., 0.), (0., 0.), (20., 0.), (10., 0.)], // Flat line with 2 180s
Expand All @@ -264,6 +258,7 @@ fn tricky_strokes(sb: &mut SceneBuilder, _: &mut SceneParams) {
[(0.5, 0.), (0., 0.), (20., 0.), (10., 0.)], // Flat line with 2 180s
[(10., 0.), (0., 0.), (10., 0.), (10., 0.)], // Flat line with a 180
];

let mut color_idx = 0;
for (i, cubic) in tricky_cubics.into_iter().enumerate() {
let x = (i % NUM_COLS) as f64 * CELL_SIZE;
Expand Down

0 comments on commit 37459da

Please sign in to comment.