summaryrefslogtreecommitdiffstats
path: root/graphics/src/layer.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-14 00:02:42 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-16 09:24:16 +0100
commit33c3c0c0aa774bb7462e3c42aa04c591a66376a7 (patch)
tree08ea046e6ac8a9ad43a7ef1f56256a056a4a4d6c /graphics/src/layer.rs
parent5b0dfcd0b0a9f25a3004dbc2cad3dea8220a76a1 (diff)
downloadiced-33c3c0c0aa774bb7462e3c42aa04c591a66376a7.tar.gz
iced-33c3c0c0aa774bb7462e3c42aa04c591a66376a7.tar.bz2
iced-33c3c0c0aa774bb7462e3c42aa04c591a66376a7.zip
Group all solid triangles independently of color
Diffstat (limited to '')
-rw-r--r--graphics/src/layer.rs25
1 files changed, 21 insertions, 4 deletions
diff --git a/graphics/src/layer.rs b/graphics/src/layer.rs
index e95934b0..fd670f48 100644
--- a/graphics/src/layer.rs
+++ b/graphics/src/layer.rs
@@ -166,10 +166,27 @@ impl<'a> Layer<'a> {
border_color: border_color.into_linear(),
});
}
- Primitive::Mesh2D {
+ Primitive::SolidMesh { buffers, size } => {
+ let layer = &mut layers[current_layer];
+
+ let bounds = Rectangle::new(
+ Point::new(translation.x, translation.y),
+ *size,
+ );
+
+ // Only draw visible content
+ if let Some(clip_bounds) = layer.bounds.intersection(&bounds) {
+ layer.meshes.push(Mesh::Solid {
+ origin: Point::new(translation.x, translation.y),
+ buffers,
+ clip_bounds,
+ });
+ }
+ }
+ Primitive::GradientMesh {
buffers,
size,
- style,
+ gradient,
} => {
let layer = &mut layers[current_layer];
@@ -180,11 +197,11 @@ impl<'a> Layer<'a> {
// Only draw visible content
if let Some(clip_bounds) = layer.bounds.intersection(&bounds) {
- layer.meshes.push(Mesh {
+ layer.meshes.push(Mesh::Gradient {
origin: Point::new(translation.x, translation.y),
buffers,
clip_bounds,
- style,
+ gradient,
});
}
}