summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar edwloef <edwin.frank.loeffler@gmail.com>2024-12-19 15:21:39 +0100
committerLibravatar edwloef <edwin.frank.loeffler@gmail.com>2024-12-19 15:23:06 +0100
commitc90d15397667bab261686cfdaae8c8e085a4574c (patch)
tree59d7e7522ccad1f613ed6daeba8a5365969f77de /wgpu
parenta687a837653a576cb0599f7bc8ecd9c6054213a9 (diff)
downloadiced-c90d15397667bab261686cfdaae8c8e085a4574c.tar.gz
iced-c90d15397667bab261686cfdaae8c8e085a4574c.tar.bz2
iced-c90d15397667bab261686cfdaae8c8e085a4574c.zip
always increment quad, mesh, text and image layer counts in wgpu layer rendering
Diffstat (limited to 'wgpu')
-rw-r--r--wgpu/src/lib.rs34
1 files changed, 29 insertions, 5 deletions
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs
index d79f0dc8..a138ed15 100644
--- a/wgpu/src/lib.rs
+++ b/wgpu/src/lib.rs
@@ -268,13 +268,37 @@ impl Renderer {
let scale = Transformation::scale(scale_factor);
for layer in self.layers.iter() {
- let Some(physical_bounds) =
- physical_bounds.intersection(&(layer.bounds * scale))
+ let Some(scissor_rect) = physical_bounds
+ .intersection(&(layer.bounds * scale))
+ .and_then(Rectangle::snap)
else {
- continue;
- };
+ if !layer.quads.is_empty() {
+ quad_layer += 1;
+ }
+
+ if !layer.triangles.is_empty() {
+ mesh_layer += layer
+ .triangles
+ .iter()
+ .filter(|item| {
+ matches!(item, triangle::Item::Group { .. })
+ })
+ .count();
+ }
+
+ if !layer.text.is_empty() {
+ text_layer += layer
+ .text
+ .iter()
+ .filter(|item| matches!(item, text::Item::Group { .. }))
+ .count();
+ }
+
+ #[cfg(any(feature = "svg", feature = "image"))]
+ if !layer.images.is_empty() {
+ image_layer += 1;
+ }
- let Some(scissor_rect) = physical_bounds.snap() else {
continue;
};