summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-04-10 01:18:19 +0200
committerLibravatar GitHub <noreply@github.com>2020-04-10 01:18:19 +0200
commit867dad62fa599755e95d4cf0d5d9404b9ff6e398 (patch)
treeceac1549fe6ff378d0259a62ffe50d3f8d6d25dc /wgpu
parentd51b501d2f5170f79c953c63e0532490882e9ca9 (diff)
parent10f5f95a80951adac0bd94d9dbb50a816a72b659 (diff)
downloadiced-867dad62fa599755e95d4cf0d5d9404b9ff6e398.tar.gz
iced-867dad62fa599755e95d4cf0d5d9404b9ff6e398.tar.bz2
iced-867dad62fa599755e95d4cf0d5d9404b9ff6e398.zip
Merge pull request #278 from hecrj/fix/canvas-empty-mesh
Stop generating empty `Mesh2D` in `canvas::Frame`
Diffstat (limited to 'wgpu')
-rw-r--r--wgpu/src/widget/canvas/frame.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/wgpu/src/widget/canvas/frame.rs b/wgpu/src/widget/canvas/frame.rs
index df1d7df5..940be402 100644
--- a/wgpu/src/widget/canvas/frame.rs
+++ b/wgpu/src/widget/canvas/frame.rs
@@ -262,13 +262,15 @@ impl Frame {
///
/// [`Frame`]: struct.Frame.html
pub fn into_primitive(mut self) -> Primitive {
- self.primitives.push(Primitive::Mesh2D {
- origin: Point::ORIGIN,
- buffers: triangle::Mesh2D {
- vertices: self.buffers.vertices,
- indices: self.buffers.indices,
- },
- });
+ if !self.buffers.indices.is_empty() {
+ self.primitives.push(Primitive::Mesh2D {
+ origin: Point::ORIGIN,
+ buffers: triangle::Mesh2D {
+ vertices: self.buffers.vertices,
+ indices: self.buffers.indices,
+ },
+ });
+ }
Primitive::Group {
primitives: self.primitives,