[gimp] app: make a HiDPI-aware magenta fallback square in gimp_widget_load_icon()



commit eef735a49c1328bf9a2ea5c435169f5dbdc5d7be
Author: Michael Natterer <mitch gimp org>
Date:   Mon Dec 31 18:44:35 2018 +0100

    app: make a HiDPI-aware magenta fallback square in gimp_widget_load_icon()

 app/widgets/gimpwidgets-utils.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index c40e866681..97ab148570 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -361,9 +361,9 @@ gimp_widget_load_icon (GtkWidget   *widget,
   /* This will find the symbolic icon and fallback to non-symbolic
    * depending on icon theme.
    */
-  icon_info  = gtk_icon_theme_lookup_icon_for_scale (icon_theme, name,
-                                                     size, scale_factor,
-                                                     GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+  icon_info = gtk_icon_theme_lookup_icon_for_scale (icon_theme, name,
+                                                    size, scale_factor,
+                                                    GTK_ICON_LOOKUP_GENERIC_FALLBACK);
   g_free (name);
 
   if (icon_info)
@@ -403,7 +403,10 @@ gimp_widget_load_icon (GtkWidget   *widget,
                         "in your icon theme.\n", GIMP_ICON_WILBER_EEK);
         }
       else
-        g_printerr ("WARNING: icon theme has no icon '%s'.\n", GIMP_ICON_WILBER_EEK);
+        {
+          g_printerr ("WARNING: icon theme has no icon '%s'.\n",
+                      GIMP_ICON_WILBER_EEK);
+        }
     }
 
   /* Last fallback: just a magenta square. */
@@ -411,13 +414,13 @@ gimp_widget_load_icon (GtkWidget   *widget,
     {
       /* As last resort, just draw an ugly magenta square. */
       guchar *data;
-      gint    rowstride = 3 * size;
+      gint    rowstride = 3 * size * scale_factor;
       gint    i, j;
 
       data = g_new (guchar, rowstride * size);
       for (i = 0; i < size; i++)
         {
-          for (j = 0; j < size; j++)
+          for (j = 0; j < size * scale_factor; j++)
             {
               data[i * rowstride + j * 3] = 255;
               data[i * rowstride + j * 3 + 1] = 0;
@@ -425,7 +428,9 @@ gimp_widget_load_icon (GtkWidget   *widget,
             }
         }
       pixbuf = gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, FALSE,
-                                         8, size, size, rowstride,
+                                         8,
+                                         size * scale_factor,
+                                         size * scale_factor, rowstride,
                                          (GdkPixbufDestroyNotify) g_free,
                                          NULL);
     }


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