render: In `ShapeTessellator`, set `mask_index_count` to `None` in `flush_draw` before aborting

This commit is contained in:
Lord-McSweeney 2023-11-05 09:50:35 -08:00 committed by Nathan Adams
parent fe2ff4f242
commit 249454885b
1 changed files with 3 additions and 1 deletions

View File

@ -126,7 +126,7 @@ impl ShapeTessellator {
} else if !self.is_stroke && next_is_stroke { } else if !self.is_stroke && next_is_stroke {
// Bake solid color fills followed by strokes into a single draw call, and adjust // Bake solid color fills followed by strokes into a single draw call, and adjust
// the index count to omit the strokes when rendering this shape as a mask. // the index count to omit the strokes when rendering this shape as a mask.
debug_assert!(self.mask_index_count.is_none()); assert!(self.mask_index_count.is_none());
self.mask_index_count = Some(self.lyon_mesh.indices.len() as u32); self.mask_index_count = Some(self.lyon_mesh.indices.len() as u32);
} }
self.is_stroke = next_is_stroke; self.is_stroke = next_is_stroke;
@ -201,6 +201,8 @@ impl ShapeTessellator {
fn flush_draw(&mut self, draw: DrawType) { fn flush_draw(&mut self, draw: DrawType) {
if self.lyon_mesh.vertices.is_empty() || self.lyon_mesh.indices.len() < 3 { if self.lyon_mesh.vertices.is_empty() || self.lyon_mesh.indices.len() < 3 {
// Ignore degenerate fills // Ignore degenerate fills
self.lyon_mesh = VertexBuffers::new();
self.mask_index_count = None;
return; return;
} }
let draw_mesh = std::mem::replace(&mut self.lyon_mesh, VertexBuffers::new()); let draw_mesh = std::mem::replace(&mut self.lyon_mesh, VertexBuffers::new());