rendernodepaintable: Preserve aspect ratio in snapshot()
authorMatthias Clasen <mclasen@redhat.com>
Tue, 4 Apr 2023 02:19:39 +0000 (22:19 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 4 Apr 2023 02:33:34 +0000 (22:33 -0400)
This is the better fix.

gtk/gtkrendernodepaintable.c

index 1379ba34049381301029d89359ecf992bd71a040..3e994ad8e99b368577c9759477c31aa7a96e3370 100644 (file)
@@ -52,8 +52,8 @@ gtk_render_node_paintable_paintable_snapshot (GdkPaintable *paintable,
   gtk_snapshot_save (snapshot);
 
   gtk_snapshot_scale (snapshot,
-                      width / (self->bounds.size.width),
-                      height / (self->bounds.size.height));
+                      width / ceilf (self->bounds.size.width),
+                      height / ceilf (self->bounds.size.height));
   gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (-self->bounds.origin.x, -self->bounds.origin.y));
 
   gtk_snapshot_push_clip (snapshot, &self->bounds);