[gtk+] icontheme: Make sure icon_info->scale doesn't end up 0
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] icontheme: Make sure icon_info->scale doesn't end up 0
- Date: Fri, 20 Sep 2013 12:46:41 +0000 (UTC)
commit f081552da1f358a395b177ee71d79b26efcee3d4
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Sep 17 22:37:06 2013 +0200
icontheme: Make sure icon_info->scale doesn't end up 0
GdkPixbuf will fail returning %NULL if we try to scale a pixbuf to (0, 0),
which will then trigger an assertion in gtk_icon_info_load_icon_finish();
we never want a scale of 0, so ensure it is at least 1.
https://bugzilla.gnome.org/show_bug.cgi?id=708384
gtk/gtkicontheme.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index e9c9838..3f1ac3b 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -3721,12 +3721,12 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info,
if (icon_info->forced_size)
icon_info->scale = -1;
else if (icon_info->dir_type == ICON_THEME_DIR_FIXED)
- icon_info->scale = round((gdouble) scaled_desired_size / (icon_info->dir_size * icon_info->dir_scale));
+ icon_info->scale = MAX(round((gdouble) scaled_desired_size / (icon_info->dir_size *
icon_info->dir_scale)), 1.0);
else if (icon_info->dir_type == ICON_THEME_DIR_THRESHOLD)
{
if (scaled_desired_size >= (icon_info->dir_size - icon_info->threshold) * icon_info->dir_scale &&
scaled_desired_size <= (icon_info->dir_size + icon_info->threshold) * icon_info->dir_scale)
- icon_info->scale = round((gdouble) scaled_desired_size / (icon_info->dir_size *
icon_info->dir_scale));
+ icon_info->scale = MAX(round((gdouble) scaled_desired_size / (icon_info->dir_size *
icon_info->dir_scale)), 1.0);
else if (icon_info->dir_size > 0)
icon_info->scale =(gdouble) scaled_desired_size / (icon_info->dir_size * icon_info->dir_scale);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]