always increment quad, mesh, text and image layer counts in wgpu layer rendering

This commit is contained in:
edwloef 2024-12-19 15:21:39 +01:00
parent a687a83765
commit c90d153976
No known key found for this signature in database

View file

@ -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;
};