summaryrefslogtreecommitdiffstats
path: root/wgpu/src/widget/canvas/layer.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-07 23:45:54 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-07 23:45:54 +0100
commitb74e7e7353d69ffb54cf0c0f0574ea7abf0f3a68 (patch)
treed05e074ad1a57309ae1ed09f49fee1cbb78a6ea6 /wgpu/src/widget/canvas/layer.rs
parent37f0d97159d81dbd4801e287a06f4e243e483269 (diff)
downloadiced-b74e7e7353d69ffb54cf0c0f0574ea7abf0f3a68.tar.gz
iced-b74e7e7353d69ffb54cf0c0f0574ea7abf0f3a68.tar.bz2
iced-b74e7e7353d69ffb54cf0c0f0574ea7abf0f3a68.zip
Implement `Primitive::Cached`
Diffstat (limited to 'wgpu/src/widget/canvas/layer.rs')
-rw-r--r--wgpu/src/widget/canvas/layer.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/wgpu/src/widget/canvas/layer.rs b/wgpu/src/widget/canvas/layer.rs
index 95e2d0ee..a46b7fb1 100644
--- a/wgpu/src/widget/canvas/layer.rs
+++ b/wgpu/src/widget/canvas/layer.rs
@@ -4,21 +4,22 @@ mod cache;
pub use cache::Cache;
use crate::Primitive;
+use iced_native::Size;
-use iced_native::{Point, Size};
+use std::sync::Arc;
/// A layer that can be presented at a [`Canvas`].
///
/// [`Canvas`]: ../struct.Canvas.html
pub trait Layer: std::fmt::Debug {
- /// Draws the [`Layer`] in the given bounds and produces [`Mesh2D`] as a
- /// result.
+ /// Draws the [`Layer`] in the given bounds and produces a [`Primitive`] as
+ /// a result.
///
- /// The [`Layer`] may choose to store the produced [`Mesh2D`] locally and
+ /// The [`Layer`] may choose to store the produced [`Primitive`] locally and
/// only recompute it when the bounds change, its contents change, or is
/// otherwise explicitly cleared by other means.
///
/// [`Layer`]: trait.Layer.html
- /// [`Mesh2D`]: ../../../triangle/struct.Mesh2D.html
- fn draw(&self, origin: Point, bounds: Size) -> Primitive;
+ /// [`Primitive`]: ../../../enum.Primitive.html
+ fn draw(&self, bounds: Size) -> Arc<Primitive>;
}