diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2020-03-19 15:49:37 +0200 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2020-03-26 21:28:13 +0000 |
commit | c193020a9460bd361973c9668e362b40a6c2dec4 (patch) | |
tree | d42f0fa593c19965e3c154477aedf0f61d352dae | |
parent | 60642a39bceaa53c260ed0fa5f4d3ff1993663e7 (diff) | |
download | metacity-c193020a9460bd361973c9668e362b40a6c2dec4.tar.gz |
iconcache: don't check if ideal size is 0 or less
meta_read_icons is always used with constant size that is larger
then zero.
-rw-r--r-- | src/core/iconcache.c | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/src/core/iconcache.c b/src/core/iconcache.c index f85cebcc..f5cddc87 100644 --- a/src/core/iconcache.c +++ b/src/core/iconcache.c @@ -45,38 +45,6 @@ get_fallback_icons (MetaScreen *screen, } static gboolean -find_largest_sizes (gulong *data, - gulong nitems, - int *width, - int *height) -{ - *width = 0; - *height = 0; - - while (nitems > 0) - { - int w, h; - - if (nitems < 3) - return FALSE; /* no space for w, h */ - - w = data[0]; - h = data[1]; - - if (nitems < ((gulong)(w * h) + 2)) - return FALSE; /* not enough data */ - - *width = MAX (w, *width); - *height = MAX (h, *height); - - data += (w * h) + 2; - nitems -= (w * h) + 2; - } - - return TRUE; -} - -static gboolean find_best_size (gulong *data, gulong nitems, int ideal_width, @@ -88,20 +56,11 @@ find_best_size (gulong *data, int best_w; int best_h; gulong *best_start; - int max_width, max_height; *width = 0; *height = 0; *start = NULL; - if (!find_largest_sizes (data, nitems, &max_width, &max_height)) - return FALSE; - - if (ideal_width < 0) - ideal_width = max_width; - if (ideal_height < 0) - ideal_height = max_height; - best_w = 0; best_h = 0; best_start = NULL; @@ -457,17 +416,13 @@ try_pixmap_and_mask (MetaDisplay *display, { *iconp = gdk_pixbuf_scale_simple (unscaled, - ideal_width > 0 ? ideal_width : - gdk_pixbuf_get_width (unscaled), - ideal_height > 0 ? ideal_height : - gdk_pixbuf_get_height (unscaled), + ideal_width, + ideal_height, GDK_INTERP_BILINEAR); *mini_iconp = gdk_pixbuf_scale_simple (unscaled, - ideal_mini_width > 0 ? ideal_mini_width : - gdk_pixbuf_get_width (unscaled), - ideal_mini_height > 0 ? ideal_mini_height : - gdk_pixbuf_get_height (unscaled), + ideal_mini_width, + ideal_mini_height, GDK_INTERP_BILINEAR); g_object_unref (G_OBJECT (unscaled)); |