iconhelper: Fix drawing of empty and paintable helpers

Empty helpers did try to draw a NULL paintable (not good) and in the
non-null case code used the wrong width/height.
This commit is contained in:
Benjamin Otte 2018-09-05 06:33:12 +02:00
parent 506a4ddad5
commit 89522e6923

View File

@ -242,9 +242,13 @@ gtk_icon_helper_paintable_snapshot (GdkPaintable *paintable,
default:
{
double image_ratio = (double) width / height;
double ratio = gdk_paintable_get_intrinsic_aspect_ratio (self->paintable);
double ratio;
double x, y, w, h;
if (self->paintable == NULL)
break;
ratio = gdk_paintable_get_intrinsic_aspect_ratio (self->paintable);
if (ratio == 0)
{
w = width;
@ -268,7 +272,7 @@ gtk_icon_helper_paintable_snapshot (GdkPaintable *paintable,
gtk_css_style_snapshot_icon_paintable (style,
snapshot,
self->paintable,
width, height,
w, h,
self->texture_is_symbolic);
gtk_snapshot_offset (snapshot, -x, -y);
}