Avoid generating empty Frame geometry in iced_wgpu
This commit is contained in:
parent
6d3e1d835e
commit
7eb16452f3
1 changed files with 25 additions and 18 deletions
|
|
@ -422,24 +422,31 @@ impl BufferStack {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn into_meshes(self, clip_bounds: Rectangle) -> impl Iterator<Item = Mesh> {
|
fn into_meshes(self, clip_bounds: Rectangle) -> impl Iterator<Item = Mesh> {
|
||||||
self.stack.into_iter().map(move |buffer| match buffer {
|
self.stack
|
||||||
Buffer::Solid(buffer) => Mesh::Solid {
|
.into_iter()
|
||||||
buffers: mesh::Indexed {
|
.filter_map(move |buffer| match buffer {
|
||||||
vertices: buffer.vertices,
|
Buffer::Solid(buffer) if !buffer.indices.is_empty() => {
|
||||||
indices: buffer.indices,
|
Some(Mesh::Solid {
|
||||||
},
|
buffers: mesh::Indexed {
|
||||||
clip_bounds,
|
vertices: buffer.vertices,
|
||||||
transformation: Transformation::IDENTITY,
|
indices: buffer.indices,
|
||||||
},
|
},
|
||||||
Buffer::Gradient(buffer) => Mesh::Gradient {
|
clip_bounds,
|
||||||
buffers: mesh::Indexed {
|
transformation: Transformation::IDENTITY,
|
||||||
vertices: buffer.vertices,
|
})
|
||||||
indices: buffer.indices,
|
}
|
||||||
},
|
Buffer::Gradient(buffer) if !buffer.indices.is_empty() => {
|
||||||
clip_bounds,
|
Some(Mesh::Gradient {
|
||||||
transformation: Transformation::IDENTITY,
|
buffers: mesh::Indexed {
|
||||||
},
|
vertices: buffer.vertices,
|
||||||
})
|
indices: buffer.indices,
|
||||||
|
},
|
||||||
|
clip_bounds,
|
||||||
|
transformation: Transformation::IDENTITY,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue