diff options
author | 2019-11-02 20:20:35 +0100 | |
---|---|---|
committer | 2019-11-02 20:20:35 +0100 | |
commit | ef056d84890e745010675e70f734f882f89356c2 (patch) | |
tree | 000d021f26027f2c2fafcdb9d91c9f4b55f7893e /wgpu/src/renderer/image.rs | |
parent | 58e04af824a64d9f712a2d6691d4283888d271d3 (diff) | |
download | iced-ef056d84890e745010675e70f734f882f89356c2.tar.gz iced-ef056d84890e745010675e70f734f882f89356c2.tar.bz2 iced-ef056d84890e745010675e70f734f882f89356c2.zip |
Move `Target` to its own module
Diffstat (limited to 'wgpu/src/renderer/image.rs')
-rw-r--r-- | wgpu/src/renderer/image.rs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/wgpu/src/renderer/image.rs b/wgpu/src/renderer/image.rs deleted file mode 100644 index 0e312706..00000000 --- a/wgpu/src/renderer/image.rs +++ /dev/null @@ -1,34 +0,0 @@ -use crate::{Primitive, Renderer}; -use iced_native::{image, Image, Layout, Length, MouseCursor, Node, Style}; - -impl image::Renderer for Renderer { - fn node(&self, image: &Image) -> Node { - let (width, height) = self.image_pipeline.dimensions(&image.path); - - let aspect_ratio = width as f32 / height as f32; - - let mut style = Style::default().align_self(image.align_self); - - // TODO: Deal with additional cases - style = match (image.width, image.height) { - (Length::Units(width), _) => style.width(image.width).height( - Length::Units((width as f32 / aspect_ratio).round() as u16), - ), - (_, _) => style - .width(Length::Units(width as u16)) - .height(Length::Units(height as u16)), - }; - - Node::new(style) - } - - fn draw(&mut self, image: &Image, layout: Layout<'_>) -> Self::Output { - ( - Primitive::Image { - path: image.path.clone(), - bounds: layout.bounds(), - }, - MouseCursor::OutOfBounds, - ) - } -} |