diff options
author | 2020-02-18 08:48:54 +0100 | |
---|---|---|
committer | 2020-02-18 08:48:54 +0100 | |
commit | 9c067562fa765cfc49d09cd9b12fbba96d5619fa (patch) | |
tree | 7e0a37c5f2a867ec62260b934af91a7473f7b7bb /wgpu/src/widget/canvas/layer.rs | |
parent | 570f769744aabce2d9d9618feadb47e4b92f50ca (diff) | |
download | iced-9c067562fa765cfc49d09cd9b12fbba96d5619fa.tar.gz iced-9c067562fa765cfc49d09cd9b12fbba96d5619fa.tar.bz2 iced-9c067562fa765cfc49d09cd9b12fbba96d5619fa.zip |
Write documentation for new `canvas` module
Diffstat (limited to 'wgpu/src/widget/canvas/layer.rs')
-rw-r--r-- | wgpu/src/widget/canvas/layer.rs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/wgpu/src/widget/canvas/layer.rs b/wgpu/src/widget/canvas/layer.rs index 8c069f18..82d647bb 100644 --- a/wgpu/src/widget/canvas/layer.rs +++ b/wgpu/src/widget/canvas/layer.rs @@ -1,16 +1,25 @@ -mod cached; +//! Produce, store, and reuse geometry. +mod cache; -pub use cached::Cached; +pub use cache::Cache; -use crate::{canvas::Frame, triangle}; +use crate::triangle; use iced_native::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. + /// + /// The [`Layer`] may choose to store the produced [`Mesh2D`] 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, bounds: Size) -> Arc<triangle::Mesh2D>; } - -pub trait Drawable { - fn draw(&self, frame: &mut Frame); -} |