Media: a negative (padding) video crop keeps the letterboxed frame

The format repair clamps a crop to 0..1, but an unrepaired negative value still
took the stretch path in paint_frame (CodeRabbit on #1008).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-23 17:11:34 -04:00
co-authored by Claude Opus 5.5
parent 48066c4674
commit 9861de3c29
+1 -1
View File
@@ -415,7 +415,7 @@ fn crop_uv(crop: [f64; 4]) -> Rect {
/// the video is cropped, the cropped part stretched over the whole box as PowerPoint shows it.
pub fn paint_frame(painter: &egui::Painter, host: &MediaHost, id: ShapeId, rect: Rect, crop: [f64; 4]) -> bool {
let Some(tex) = host.texture(id) else { return false };
if crop.iter().any(|v| *v != 0.0) {
if crop.iter().any(|v| *v > 0.0) {
painter.rect_filled(rect, CornerRadius::ZERO, Color32::BLACK);
painter.image(tex.id(), rect, crop_uv(crop), Color32::WHITE);
return true;