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>
Fri, 21 Apr 2023 07:03:26 +0000 (09:03 +0200)
This is the better fix.

gtk/gtkrendernodepaintable.c

index 87bb1ca19a5a4fb15c7ce0ee93e6798333293205..f7987bdd6316ecce18e89a59975d2a1303b600ff 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);