Port iced_tiny_skia to new layering architecture

This commit is contained in:
Héctor Ramón Jiménez 2024-04-09 22:25:16 +02:00
parent 2c6fd9ac14
commit 6ad5bb3597
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
28 changed files with 1948 additions and 1935 deletions

View file

@ -1,10 +1,5 @@
use crate::core::Rectangle;
use crate::graphics::{Damage, Mesh};
pub type Primitive = crate::graphics::Primitive<Custom>;
#[derive(Debug, Clone, PartialEq)]
pub enum Custom {
pub enum Primitive {
/// A path filled with some paint.
Fill {
/// The path to fill.
@ -24,29 +19,3 @@ pub enum Custom {
stroke: tiny_skia::Stroke,
},
}
impl Damage for Custom {
fn bounds(&self) -> Rectangle {
match self {
Self::Fill { path, .. } | Self::Stroke { path, .. } => {
let bounds = path.bounds();
Rectangle {
x: bounds.x(),
y: bounds.y(),
width: bounds.width(),
height: bounds.height(),
}
.expand(1.0)
}
}
}
}
impl TryFrom<Mesh> for Custom {
type Error = &'static str;
fn try_from(_mesh: Mesh) -> Result<Self, Self::Error> {
Err("unsupported")
}
}