summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-03 16:23:30 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-03 16:24:07 +0200
commit87a613edd186461f1a8d224394043527a372571c (patch)
tree21f76875a4c5cd044b839753d2e26e864caf6af2 /wgpu
parente84070acef84f883ca42d965c577e54ce60c3f2a (diff)
downloadiced-87a613edd186461f1a8d224394043527a372571c.tar.gz
iced-87a613edd186461f1a8d224394043527a372571c.tar.bz2
iced-87a613edd186461f1a8d224394043527a372571c.zip
Render text on top of images by default
Diffstat (limited to 'wgpu')
-rw-r--r--wgpu/src/layer.rs2
-rw-r--r--wgpu/src/lib.rs48
2 files changed, 25 insertions, 25 deletions
diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs
index 9551311d..df289e0e 100644
--- a/wgpu/src/layer.rs
+++ b/wgpu/src/layer.rs
@@ -20,8 +20,8 @@ pub struct Layer {
pub quads: quad::Batch,
pub triangles: triangle::Batch,
pub primitives: primitive::Batch,
- pub text: text::Batch,
pub images: image::Batch,
+ pub text: text::Batch,
pending_meshes: Vec<Mesh>,
pending_text: Vec<Text>,
}
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs
index ad88ce3e..954340ec 100644
--- a/wgpu/src/lib.rs
+++ b/wgpu/src/lib.rs
@@ -182,19 +182,6 @@ impl Renderer {
}
}
- if !layer.text.is_empty() {
- engine.text_pipeline.prepare(
- device,
- queue,
- &self.text_viewport,
- encoder,
- &mut self.text_storage,
- &layer.text,
- layer.bounds,
- Transformation::scale(scale_factor),
- );
- }
-
#[cfg(any(feature = "svg", feature = "image"))]
if !layer.images.is_empty() {
engine.image_pipeline.prepare(
@@ -207,6 +194,19 @@ impl Renderer {
scale_factor,
);
}
+
+ if !layer.text.is_empty() {
+ engine.text_pipeline.prepare(
+ device,
+ queue,
+ &self.text_viewport,
+ encoder,
+ &mut self.text_storage,
+ &layer.text,
+ layer.bounds,
+ Transformation::scale(scale_factor),
+ );
+ }
}
}
@@ -359,17 +359,6 @@ impl Renderer {
));
}
- if !layer.text.is_empty() {
- text_layer += engine.text_pipeline.render(
- &self.text_viewport,
- &self.text_storage,
- text_layer,
- &layer.text,
- scissor_rect,
- &mut render_pass,
- );
- }
-
#[cfg(any(feature = "svg", feature = "image"))]
if !layer.images.is_empty() {
engine.image_pipeline.render(
@@ -381,6 +370,17 @@ impl Renderer {
image_layer += 1;
}
+
+ if !layer.text.is_empty() {
+ text_layer += engine.text_pipeline.render(
+ &self.text_viewport,
+ &self.text_storage,
+ text_layer,
+ &layer.text,
+ scissor_rect,
+ &mut render_pass,
+ );
+ }
}
let _ = ManuallyDrop::into_inner(render_pass);