summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-09 04:26:02 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-09 04:26:02 +0200
commit10f5f95a80951adac0bd94d9dbb50a816a72b659 (patch)
treeceac1549fe6ff378d0259a62ffe50d3f8d6d25dc /wgpu
parentd51b501d2f5170f79c953c63e0532490882e9ca9 (diff)
downloadiced-10f5f95a80951adac0bd94d9dbb50a816a72b659.tar.gz
iced-10f5f95a80951adac0bd94d9dbb50a816a72b659.tar.bz2
iced-10f5f95a80951adac0bd94d9dbb50a816a72b659.zip
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,