Rerasterize SVGs when resized and refactor a bit

This commit is contained in:
Héctor Ramón Jiménez 2019-12-15 06:19:07 +01:00
parent 27717bc70c
commit 09707f29fc
8 changed files with 543 additions and 273 deletions

View file

@ -0,0 +1,22 @@
use crate::{Primitive, Renderer};
use iced_native::{svg, Layout, MouseCursor};
impl svg::Renderer for Renderer {
fn dimensions(&self, handle: &svg::Handle) -> (u32, u32) {
self.image_pipeline.viewport_dimensions(handle)
}
fn draw(
&mut self,
handle: svg::Handle,
layout: Layout<'_>,
) -> Self::Output {
(
Primitive::Svg {
handle,
bounds: layout.bounds(),
},
MouseCursor::OutOfBounds,
)
}
}