Render text on top of images by default
This commit is contained in:
parent
e84070acef
commit
87a613edd1
3 changed files with 35 additions and 35 deletions
|
|
@ -178,6 +178,16 @@ impl Renderer {
|
||||||
engine::adjust_clip_mask(clip_mask, clip_bounds);
|
engine::adjust_clip_mask(clip_mask, clip_bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for image in &layer.images {
|
||||||
|
self.engine.draw_image(
|
||||||
|
image,
|
||||||
|
Transformation::scale(scale_factor),
|
||||||
|
pixels,
|
||||||
|
clip_mask,
|
||||||
|
clip_bounds,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
for group in &layer.text {
|
for group in &layer.text {
|
||||||
for text in group.as_slice() {
|
for text in group.as_slice() {
|
||||||
self.engine.draw_text(
|
self.engine.draw_text(
|
||||||
|
|
@ -190,16 +200,6 @@ impl Renderer {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for image in &layer.images {
|
|
||||||
self.engine.draw_image(
|
|
||||||
image,
|
|
||||||
Transformation::scale(scale_factor),
|
|
||||||
pixels,
|
|
||||||
clip_mask,
|
|
||||||
clip_bounds,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !overlay.is_empty() {
|
if !overlay.is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ pub struct Layer {
|
||||||
pub quads: quad::Batch,
|
pub quads: quad::Batch,
|
||||||
pub triangles: triangle::Batch,
|
pub triangles: triangle::Batch,
|
||||||
pub primitives: primitive::Batch,
|
pub primitives: primitive::Batch,
|
||||||
pub text: text::Batch,
|
|
||||||
pub images: image::Batch,
|
pub images: image::Batch,
|
||||||
|
pub text: text::Batch,
|
||||||
pending_meshes: Vec<Mesh>,
|
pending_meshes: Vec<Mesh>,
|
||||||
pending_text: Vec<Text>,
|
pending_text: Vec<Text>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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"))]
|
#[cfg(any(feature = "svg", feature = "image"))]
|
||||||
if !layer.images.is_empty() {
|
if !layer.images.is_empty() {
|
||||||
engine.image_pipeline.prepare(
|
engine.image_pipeline.prepare(
|
||||||
|
|
@ -207,6 +194,19 @@ impl Renderer {
|
||||||
scale_factor,
|
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"))]
|
#[cfg(any(feature = "svg", feature = "image"))]
|
||||||
if !layer.images.is_empty() {
|
if !layer.images.is_empty() {
|
||||||
engine.image_pipeline.render(
|
engine.image_pipeline.render(
|
||||||
|
|
@ -381,6 +370,17 @@ impl Renderer {
|
||||||
|
|
||||||
image_layer += 1;
|
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);
|
let _ = ManuallyDrop::into_inner(render_pass);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue