diff options
author | Timm Bäder <mail@baedert.org> | 2019-08-09 15:55:38 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2019-08-09 15:55:38 +0200 |
commit | 21123a12640b141ca6df822d76beb5a4bcac34c2 (patch) | |
tree | 874e127f17eb7ed181e0be8717db12a44b15d5f8 /gtk/gtkiconhelper.c | |
parent | 87aeec2b63bdc1cd10305df9efc16e1ee3096e21 (diff) | |
download | gtk+-21123a12640b141ca6df822d76beb5a4bcac34c2.tar.gz |
iconhelper: Don't snapshot 0 sized icons
This is happening for me when snapshotting small thumbnails in the file
chooser. The GtkScaler will scale the 1px height/width by 2, resulting
in nothing being drawn at all.
Diffstat (limited to 'gtk/gtkiconhelper.c')
-rw-r--r-- | gtk/gtkiconhelper.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index a7cf18220f..5e96bb8e64 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -219,7 +219,7 @@ gtk_icon_helper_paintable_snapshot (GdkPaintable *paintable, case GTK_IMAGE_GICON: { double x, y, w, h; - + /* Never scale up icons. */ w = gdk_paintable_get_intrinsic_width (self->paintable); h = gdk_paintable_get_intrinsic_height (self->paintable); @@ -228,6 +228,9 @@ gtk_icon_helper_paintable_snapshot (GdkPaintable *paintable, x = (width - w) / 2; y = (height - h) / 2; + if (w == 0 || h == 0) + return; + if (x != 0 || y != 0) { gtk_snapshot_save (snapshot); |