Add another fix
diff --git a/sparse_strips/vello_common/src/coarse.rs b/sparse_strips/vello_common/src/coarse.rs index a43a6e9..c738045 100644 --- a/sparse_strips/vello_common/src/coarse.rs +++ b/sparse_strips/vello_common/src/coarse.rs
@@ -652,7 +652,11 @@ // Apply the clip strip command and update state self.get_mut(wtile_x, cur_wtile_y).clip_strip(cmd); cur_wtile_x = wtile_x; - pop_pending = true; + + // Only request a pop if the x coordinate is actually inside the bounds. + if cur_wtile_x < clip_bbox.x1() { + pop_pending = true; + } } // Handle fill regions between strips based on fill rule @@ -661,6 +665,10 @@ Fill::EvenOdd => next_strip.winding % 2 != 0, }; if is_inside && strip_y == next_strip.strip_y() { + if cur_wtile_x >= clip_bbox.x1() { + continue; + } + let x2 = next_strip.x; let clipped_x2 = x2.min((cur_wtile_x + 1) * WideTile::WIDTH); let width = clipped_x2.saturating_sub(x1);
diff --git a/sparse_strips/vello_sparse_tests/tests/clip.rs b/sparse_strips/vello_sparse_tests/tests/clip.rs index 276b93c..0601dea 100644 --- a/sparse_strips/vello_sparse_tests/tests/clip.rs +++ b/sparse_strips/vello_sparse_tests/tests/clip.rs
@@ -251,3 +251,10 @@ ctx.fill_rect(&Rect::new(0.0, 0.0, 100.0, 100.0)); ctx.pop_layer(); } + +// See <https://github.com/linebender/vello/pull/975#issuecomment-2858372366> +#[vello_test(no_ref)] +fn clip_completely_in_out_of_bounds_wide_tile(ctx: &mut impl Renderer) { + ctx.push_clip_layer(&Rect::new(300.0, 8.0, 350.0, 48.0).to_path(0.1)); + ctx.pop_layer(); +}