From df583d73b98a309d3b8df0888a774837238b78ca Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Tue, 25 Mar 2025 23:23:27 -0600 Subject: [PATCH] Fix `corner_radii` clamping for `Img` when actual size is smaller than the container (#27473) Noticed this when working on #27472 Release Notes: - N/A --- crates/gpui/src/elements/img.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/gpui/src/elements/img.rs b/crates/gpui/src/elements/img.rs index a7329cb23b..276d9ac938 100644 --- a/crates/gpui/src/elements/img.rs +++ b/crates/gpui/src/elements/img.rs @@ -421,15 +421,15 @@ impl Element for Img { window, cx, |style, window, cx| { - let corner_radii = style - .corner_radii - .to_pixels(window.rem_size()) - .clamp_radii_for_quad_size(bounds.size); if let Some(Ok(data)) = source.use_data(window, cx) { let new_bounds = self .style .object_fit .get_bounds(bounds, data.size(layout_state.frame_index)); + let corner_radii = style + .corner_radii + .to_pixels(window.rem_size()) + .clamp_radii_for_quad_size(new_bounds.size); window .paint_image( new_bounds,