From 8691d471d09071f3f2ea167273c48fbf686261b6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 21 Nov 2023 11:11:38 -0500 Subject: [PATCH] picture: Keep paintable size integral Without this, offloading is very hit-and-miss, since you need to hit the few size combinations where you get an exact integral size when preserving the aspect ratio. --- gtk/gtkpicture.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gtk/gtkpicture.c b/gtk/gtkpicture.c index 9f0665d7f5..1ef6950bd8 100644 --- a/gtk/gtkpicture.c +++ b/gtk/gtkpicture.c @@ -173,8 +173,11 @@ gtk_picture_snapshot (GtkWidget *widget, } } - x = (width - ceil (w)) / 2; - y = floor(height - ceil (h)) / 2; + w = ceil (w); + h = ceil (h); + + x = (width - w) / 2; + y = floor(height - h) / 2; gtk_snapshot_save (snapshot); gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));