summaryrefslogtreecommitdiffstats
path: root/wgpu/src/primitive.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-28 03:18:31 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-28 03:52:10 +0200
commit59b1e90661ee9e479f404bae71029db824cc7b46 (patch)
treef98949ea315b4e58922be3f2ed333cadcbcbac01 /wgpu/src/primitive.rs
parent2381a9310c56f60698653f5fd13f5a0d80fa4f67 (diff)
downloadiced-59b1e90661ee9e479f404bae71029db824cc7b46.tar.gz
iced-59b1e90661ee9e479f404bae71029db824cc7b46.tar.bz2
iced-59b1e90661ee9e479f404bae71029db824cc7b46.zip
Introduce `Translate` primitive in `iced_wgpu`
Diffstat (limited to '')
-rw-r--r--wgpu/src/primitive.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/wgpu/src/primitive.rs b/wgpu/src/primitive.rs
index 46d9e624..e9c0bf46 100644
--- a/wgpu/src/primitive.rs
+++ b/wgpu/src/primitive.rs
@@ -1,5 +1,5 @@
use iced_native::{
- image, svg, Background, Color, Font, HorizontalAlignment, Point, Rectangle,
+ image, svg, Background, Color, Font, HorizontalAlignment, Rectangle,
Vector, VerticalAlignment,
};
@@ -70,13 +70,18 @@ pub enum Primitive {
/// The content of the clip
content: Box<Primitive>,
},
+ /// A primitive that applies a translation
+ Translate {
+ /// The top-left coordinate of the mesh
+ translation: Vector,
+
+ /// The primitive to translate
+ content: Box<Primitive>,
+ },
/// A low-level primitive to render a mesh of triangles.
///
/// It can be used to render many kinds of geometry freely.
Mesh2D {
- /// The top-left coordinate of the mesh
- origin: Point,
-
/// The vertex and index buffers of the mesh
buffers: triangle::Mesh2D,
},
@@ -85,9 +90,6 @@ pub enum Primitive {
/// This can be useful if you are implementing a widget where primitive
/// generation is expensive.
Cached {
- /// The origin of the coordinate system of the cached primitives
- origin: Point,
-
/// The cached primitive
cache: Arc<Primitive>,
},