diff options
author | 2024-02-02 14:31:17 +0100 | |
---|---|---|
committer | 2024-02-02 14:31:17 +0100 | |
commit | a06682ff420678f7068265191738ab70ebe30b4c (patch) | |
tree | f4291eaa9ca54e4b58143492b9b00e7d8f99dae3 /widget/src/image | |
parent | d8dffa411b8c1bbee538e3b51aae6f768e293789 (diff) | |
download | iced-a06682ff420678f7068265191738ab70ebe30b4c.tar.gz iced-a06682ff420678f7068265191738ab70ebe30b4c.tar.bz2 iced-a06682ff420678f7068265191738ab70ebe30b4c.zip |
Use `with_translation` wherever possible
Diffstat (limited to 'widget/src/image')
-rw-r--r-- | widget/src/image/viewer.rs | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/widget/src/image/viewer.rs b/widget/src/image/viewer.rs index 0006f978..9666ff9f 100644 --- a/widget/src/image/viewer.rs +++ b/widget/src/image/viewer.rs @@ -7,7 +7,7 @@ use crate::core::renderer; use crate::core::widget::tree::{self, Tree}; use crate::core::{ Clipboard, Element, Layout, Length, Pixels, Point, Rectangle, Shell, Size, - Transformation, Vector, Widget, + Vector, Widget, }; use std::hash::Hash; @@ -328,21 +328,18 @@ where }; renderer.with_layer(bounds, |renderer| { - renderer.with_transformation( - Transformation::translate(translation.x, translation.y), - |renderer| { - image::Renderer::draw( - renderer, - self.handle.clone(), - self.filter_method, - Rectangle { - x: bounds.x, - y: bounds.y, - ..Rectangle::with_size(image_size) - }, - ); - }, - ); + renderer.with_translation(translation, |renderer| { + image::Renderer::draw( + renderer, + self.handle.clone(), + self.filter_method, + Rectangle { + x: bounds.x, + y: bounds.y, + ..Rectangle::with_size(image_size) + }, + ); + }); }); } } |