Move core::Image::clip_bounds to graphics::Image
This commit is contained in:
parent
3cc5bd5dbc
commit
7c11ccb046
16 changed files with 189 additions and 88 deletions
|
|
@ -337,7 +337,6 @@ pub fn draw<Renderer, Handle>(
|
|||
renderer.draw_image(
|
||||
image::Image {
|
||||
handle: handle.clone(),
|
||||
clip_bounds: bounds,
|
||||
border_radius,
|
||||
filter_method,
|
||||
rotation: rotation.radians(),
|
||||
|
|
@ -345,6 +344,7 @@ pub fn draw<Renderer, Handle>(
|
|||
snap: true,
|
||||
},
|
||||
drawing_bounds,
|
||||
bounds,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ where
|
|||
_style: &renderer::Style,
|
||||
layout: Layout<'_>,
|
||||
_cursor: mouse::Cursor,
|
||||
_viewport: &Rectangle,
|
||||
viewport: &Rectangle,
|
||||
) {
|
||||
let state = tree.state.downcast_ref::<State>();
|
||||
let bounds = layout.bounds();
|
||||
|
|
@ -348,7 +348,6 @@ where
|
|||
renderer.draw_image(
|
||||
Image {
|
||||
handle: self.handle.clone(),
|
||||
clip_bounds: Rectangle::INFINITE,
|
||||
border_radius: border::Radius::default(),
|
||||
filter_method: self.filter_method,
|
||||
rotation: Radians(0.0),
|
||||
|
|
@ -356,6 +355,7 @@ where
|
|||
snap: true,
|
||||
},
|
||||
drawing_bounds,
|
||||
*viewport,
|
||||
);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -240,25 +240,16 @@ where
|
|||
|
||||
let style = theme.style(&self.class, status);
|
||||
|
||||
let render = |renderer: &mut Renderer| {
|
||||
renderer.draw_svg(
|
||||
svg::Svg {
|
||||
handle: self.handle.clone(),
|
||||
color: style.color,
|
||||
rotation: self.rotation.radians(),
|
||||
opacity: self.opacity,
|
||||
},
|
||||
drawing_bounds,
|
||||
);
|
||||
};
|
||||
|
||||
if adjusted_fit.width > bounds.width
|
||||
|| adjusted_fit.height > bounds.height
|
||||
{
|
||||
renderer.with_layer(bounds, render);
|
||||
} else {
|
||||
render(renderer);
|
||||
}
|
||||
renderer.draw_svg(
|
||||
svg::Svg {
|
||||
handle: self.handle.clone(),
|
||||
color: style.color,
|
||||
rotation: self.rotation.radians(),
|
||||
opacity: self.opacity,
|
||||
},
|
||||
drawing_bounds,
|
||||
bounds,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue