gtk4: Always draw a black background behind the video frame

This makes sure that there is the same background behind the frame, no
matter if black borders have to be added or not. Without this a frame
that has transparency would change rendering depending on the layout.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1452>
This commit is contained in:
Sebastian Dröge 2024-02-07 19:09:36 +02:00
parent 803550111a
commit 9971f71e94

View file

@ -144,12 +144,10 @@ impl PaintableImpl for Paintable {
} }
} }
if trans_x != 0.0 || trans_y != 0.0 { snapshot.append_color(
snapshot.append_color( &gdk::RGBA::BLACK,
&gdk::RGBA::BLACK, &graphene::Rect::new(0f32, 0f32, width as f32, height as f32),
&graphene::Rect::new(0f32, 0f32, width as f32, height as f32), );
);
}
snapshot.translate(&graphene::Point::new(trans_x as f32, trans_y as f32)); snapshot.translate(&graphene::Point::new(trans_x as f32, trans_y as f32));
snapshot.scale(scale_x as f32, scale_y as f32); snapshot.scale(scale_x as f32, scale_y as f32);