summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer.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/renderer.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/renderer.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/wgpu/src/renderer.rs b/wgpu/src/renderer.rs
index 481b310c..e93532bc 100644
--- a/wgpu/src/renderer.rs
+++ b/wgpu/src/renderer.rs
@@ -29,7 +29,7 @@ pub struct Renderer {
struct Layer<'a> {
bounds: Rectangle<u32>,
quads: Vec<Quad>,
- meshes: Vec<(Point, &'a triangle::Mesh2D)>,
+ meshes: Vec<(Vector, &'a triangle::Mesh2D)>,
text: Vec<wgpu_glyph::Section<'a>>,
#[cfg(any(feature = "image", feature = "svg"))]
@@ -214,10 +214,10 @@ impl Renderer {
border_color: border_color.into_linear(),
});
}
- Primitive::Mesh2D { origin, buffers } => {
+ Primitive::Mesh2D { buffers } => {
let layer = layers.last_mut().unwrap();
- layer.meshes.push((*origin + translation, buffers));
+ layer.meshes.push((translation, buffers));
}
Primitive::Clip {
bounds,
@@ -249,15 +249,21 @@ impl Renderer {
layers.push(new_layer);
}
}
-
- Primitive::Cached { origin, cache } => {
+ Primitive::Translate {
+ translation: new_translation,
+ content,
+ } => {
self.draw_primitive(
- translation + Vector::new(origin.x, origin.y),
- &cache,
+ translation + *new_translation,
+ &content,
layers,
);
}
+ Primitive::Cached { cache } => {
+ self.draw_primitive(translation, &cache, layers);
+ }
+
#[cfg(feature = "image")]
Primitive::Image { handle, bounds } => {
let layer = layers.last_mut().unwrap();