diff options
Diffstat (limited to 'tiny_skia/src/backend.rs')
-rw-r--r-- | tiny_skia/src/backend.rs | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/tiny_skia/src/backend.rs b/tiny_skia/src/backend.rs index c8999561..0d06ef70 100644 --- a/tiny_skia/src/backend.rs +++ b/tiny_skia/src/backend.rs @@ -2,7 +2,8 @@ use crate::core::text; use crate::core::Gradient; use crate::core::{Background, Color, Font, Point, Rectangle, Size, Vector}; use crate::graphics::backend; -use crate::graphics::{Primitive, Viewport}; +use crate::graphics::{Damage, Viewport}; +use crate::primitive::{self, Primitive}; use crate::Settings; use std::borrow::Cow; @@ -419,6 +420,13 @@ impl Backend { self.raster_pipeline .draw(handle, *bounds, pixels, transform, clip_mask); } + #[cfg(not(feature = "image"))] + Primitive::Image { .. } => { + log::warn!( + "Unsupported primitive in `iced_tiny_skia`: {:?}", + primitive + ); + } #[cfg(feature = "svg")] Primitive::Svg { handle, @@ -442,12 +450,19 @@ impl Backend { clip_mask, ); } - Primitive::Fill { + #[cfg(not(feature = "svg"))] + Primitive::Svg { .. } => { + log::warn!( + "Unsupported primitive in `iced_tiny_skia`: {:?}", + primitive + ); + } + Primitive::Custom(primitive::Custom::Fill { path, paint, rule, transform, - } => { + }) => { let bounds = path.bounds(); let physical_bounds = (Rectangle { @@ -475,12 +490,12 @@ impl Backend { clip_mask, ); } - Primitive::Stroke { + Primitive::Custom(primitive::Custom::Stroke { path, paint, stroke, transform, - } => { + }) => { let bounds = path.bounds(); let physical_bounds = (Rectangle { @@ -588,13 +603,6 @@ impl Backend { primitive ); } - _ => { - // Not supported! - log::warn!( - "Unsupported primitive in `iced_tiny_skia`: {:?}", - primitive - ); - } } } } @@ -766,6 +774,10 @@ fn adjust_clip_mask(clip_mask: &mut tiny_skia::Mask, bounds: Rectangle) { ); } +impl iced_graphics::Backend for Backend { + type Primitive = primitive::Custom; +} + impl backend::Text for Backend { const ICON_FONT: Font = Font::with_name("Iced-Icons"); const CHECKMARK_ICON: char = '\u{f00c}'; |