Switch debug mode to fade old primitives and display damage in iced_tiny_skia
This commit is contained in:
parent
4ede482ab5
commit
e134a82f4c
1 changed files with 57 additions and 34 deletions
|
|
@ -74,7 +74,30 @@ impl Backend {
|
||||||
let damage = group_damage(damage, scale_factor, physical_size);
|
let damage = group_damage(damage, scale_factor, physical_size);
|
||||||
|
|
||||||
if !overlay.is_empty() {
|
if !overlay.is_empty() {
|
||||||
pixels.fill(into_color(background_color));
|
let path = tiny_skia::PathBuilder::from_rect(
|
||||||
|
tiny_skia::Rect::from_xywh(
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
physical_size.width as f32,
|
||||||
|
physical_size.height as f32,
|
||||||
|
)
|
||||||
|
.expect("Create damage rectangle"),
|
||||||
|
);
|
||||||
|
|
||||||
|
pixels.fill_path(
|
||||||
|
&path,
|
||||||
|
&tiny_skia::Paint {
|
||||||
|
shader: tiny_skia::Shader::SolidColor(into_color(Color {
|
||||||
|
a: 0.1,
|
||||||
|
..background_color
|
||||||
|
})),
|
||||||
|
anti_alias: false,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
tiny_skia::FillRule::default(),
|
||||||
|
tiny_skia::Transform::identity(),
|
||||||
|
None,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for region in damage {
|
for region in damage {
|
||||||
|
|
@ -135,42 +158,42 @@ impl Backend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !overlay.is_empty() {
|
//if !overlay.is_empty() {
|
||||||
let bounds = Rectangle {
|
// let bounds = Rectangle {
|
||||||
x: 0.0,
|
// x: 0.0,
|
||||||
y: 0.0,
|
// y: 0.0,
|
||||||
width: viewport.physical_width() as f32,
|
// width: viewport.physical_width() as f32,
|
||||||
height: viewport.physical_height() as f32,
|
// height: viewport.physical_height() as f32,
|
||||||
};
|
// };
|
||||||
|
|
||||||
adjust_clip_mask(clip_mask, pixels, bounds);
|
// adjust_clip_mask(clip_mask, pixels, bounds);
|
||||||
|
|
||||||
for (i, text) in overlay.iter().enumerate() {
|
// for (i, text) in overlay.iter().enumerate() {
|
||||||
const OVERLAY_TEXT_SIZE: f32 = 20.0;
|
// const OVERLAY_TEXT_SIZE: f32 = 20.0;
|
||||||
|
|
||||||
self.draw_primitive(
|
// self.draw_primitive(
|
||||||
&Primitive::Text {
|
// &Primitive::Text {
|
||||||
content: text.as_ref().to_owned(),
|
// content: text.as_ref().to_owned(),
|
||||||
size: OVERLAY_TEXT_SIZE,
|
// size: OVERLAY_TEXT_SIZE,
|
||||||
bounds: Rectangle {
|
// bounds: Rectangle {
|
||||||
x: 10.0,
|
// x: 10.0,
|
||||||
y: 10.0 + i as f32 * OVERLAY_TEXT_SIZE * 1.2,
|
// y: 10.0 + i as f32 * OVERLAY_TEXT_SIZE * 1.2,
|
||||||
width: bounds.width - 1.0,
|
// width: bounds.width - 1.0,
|
||||||
height: bounds.height - 1.0,
|
// height: bounds.height - 1.0,
|
||||||
},
|
// },
|
||||||
color: Color::BLACK,
|
// color: Color::BLACK,
|
||||||
font: Font::MONOSPACE,
|
// font: Font::MONOSPACE,
|
||||||
horizontal_alignment: alignment::Horizontal::Left,
|
// horizontal_alignment: alignment::Horizontal::Left,
|
||||||
vertical_alignment: alignment::Vertical::Top,
|
// vertical_alignment: alignment::Vertical::Top,
|
||||||
},
|
// },
|
||||||
pixels,
|
// pixels,
|
||||||
clip_mask,
|
// clip_mask,
|
||||||
bounds,
|
// bounds,
|
||||||
scale_factor,
|
// scale_factor,
|
||||||
Vector::ZERO,
|
// Vector::ZERO,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
self.text_pipeline.trim_cache();
|
self.text_pipeline.trim_cache();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue