Reintroduce damage tracking for iced_tiny_skia
This commit is contained in:
parent
14b9708f72
commit
1e802e776c
10 changed files with 347 additions and 92 deletions
|
|
@ -1,3 +1,5 @@
|
|||
use crate::core::Rectangle;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Primitive {
|
||||
/// A path filled with some paint.
|
||||
|
|
@ -19,3 +21,20 @@ pub enum Primitive {
|
|||
stroke: tiny_skia::Stroke,
|
||||
},
|
||||
}
|
||||
|
||||
impl Primitive {
|
||||
/// Returns the visible bounds of the [`Primitive`].
|
||||
pub fn visible_bounds(&self) -> Rectangle {
|
||||
let bounds = match self {
|
||||
Primitive::Fill { path, .. } => path.bounds(),
|
||||
Primitive::Stroke { path, .. } => path.bounds(),
|
||||
};
|
||||
|
||||
Rectangle {
|
||||
x: bounds.x(),
|
||||
y: bounds.y(),
|
||||
width: bounds.width(),
|
||||
height: bounds.height(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue