[gtk/wip/otte/listmodel: 121/132] iconhelper: Fix drawing of empty and paintable helpers



commit 89522e69234ea448a45ad4c5153576982c382cd0
Author: Benjamin Otte <otte redhat com>
Date:   Wed Sep 5 06:33:12 2018 +0200

    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.

 gtk/gtkiconhelper.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 1c696a0d47..6b8f63e9ff 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -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);
       }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]