gtk4: Use scale instead of rotate where possible

In order to make it easier for GTK4 to figure out that the resulting
operation is 2D and - crucially - can get offloaded to Wayland.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1662>
This commit is contained in:
Robert Mader 2024-07-10 10:48:15 +02:00
parent 2238db2005
commit c7ef8e8185

View file

@ -253,25 +253,24 @@ impl PaintableImpl for Paintable {
snapshot.rotate(90.0); snapshot.rotate(90.0);
} }
frame::Orientation::Rotate180 => { frame::Orientation::Rotate180 => {
snapshot.rotate(180.0); snapshot.scale(-1.0, -1.0);
} }
frame::Orientation::Rotate270 => { frame::Orientation::Rotate270 => {
snapshot.rotate(270.0); snapshot.rotate(270.0);
} }
frame::Orientation::FlipRotate0 => { frame::Orientation::FlipRotate0 => {
snapshot.rotate_3d(180.0, &gtk::graphene::Vec3::y_axis()); snapshot.scale(-1.0, 1.0);
} }
frame::Orientation::FlipRotate90 => { frame::Orientation::FlipRotate90 => {
snapshot.rotate(90.0); snapshot.rotate(90.0);
snapshot.rotate_3d(180.0, &gtk::graphene::Vec3::y_axis()); snapshot.scale(-1.0, 1.0);
} }
frame::Orientation::FlipRotate180 => { frame::Orientation::FlipRotate180 => {
snapshot.rotate(180.0); snapshot.scale(1.0, -1.0);
snapshot.rotate_3d(180.0, &gtk::graphene::Vec3::y_axis());
} }
frame::Orientation::FlipRotate270 => { frame::Orientation::FlipRotate270 => {
snapshot.rotate(270.0); snapshot.rotate(270.0);
snapshot.rotate_3d(180.0, &gtk::graphene::Vec3::y_axis()); snapshot.scale(-1.0, 1.0);
} }
frame::Orientation::Auto => unreachable!(), frame::Orientation::Auto => unreachable!(),
} }