From 6e6824a06b7c60361a48848529e19a300f9754be Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 5 Oct 2004 03:18:22 +0000 Subject: [PATCH] Make the code work as intended for unthemed icons; don't scale them up too 2004-10-04 Matthias Clasen * gtk/gtkicontheme.c (icon_info_ensure_scale_and_pixbuf): Make the code work as intended for unthemed icons; don't scale them up too much. Allow to scale them down, and do so exactly. (#154142, Ross Burton) (gtk_icon_info_load_icon): Amend docs. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkicontheme.c | 7 ++++--- 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc8d2ca721..bb465d1aea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2004-10-04 Matthias Clasen + * gtk/gtkicontheme.c (icon_info_ensure_scale_and_pixbuf): + Make the code work as intended for unthemed icons; don't scale + them up too much. Allow to scale them down, and do so + exactly. (#154142, Ross Burton) + (gtk_icon_info_load_icon): Amend docs. + * gtk/gtkcelllayout.c (gtk_cell_layout_clear): Improve docs. (#154504, Dave Cook) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cc8d2ca721..bb465d1aea 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,11 @@ 2004-10-04 Matthias Clasen + * gtk/gtkicontheme.c (icon_info_ensure_scale_and_pixbuf): + Make the code work as intended for unthemed icons; don't scale + them up too much. Allow to scale them down, and do so + exactly. (#154142, Ross Burton) + (gtk_icon_info_load_icon): Amend docs. + * gtk/gtkcelllayout.c (gtk_cell_layout_clear): Improve docs. (#154504, Dave Cook) diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index cc8d2ca721..bb465d1aea 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,11 @@ 2004-10-04 Matthias Clasen + * gtk/gtkicontheme.c (icon_info_ensure_scale_and_pixbuf): + Make the code work as intended for unthemed icons; don't scale + them up too much. Allow to scale them down, and do so + exactly. (#154142, Ross Burton) + (gtk_icon_info_load_icon): Amend docs. + * gtk/gtkcelllayout.c (gtk_cell_layout_clear): Improve docs. (#154504, Dave Cook) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index cc8d2ca721..bb465d1aea 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,11 @@ 2004-10-04 Matthias Clasen + * gtk/gtkicontheme.c (icon_info_ensure_scale_and_pixbuf): + Make the code work as intended for unthemed icons; don't scale + them up too much. Allow to scale them down, and do so + exactly. (#154142, Ross Burton) + (gtk_icon_info_load_icon): Amend docs. + * gtk/gtkcelllayout.c (gtk_cell_layout_clear): Improve docs. (#154504, Dave Cook) diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index d46b1202a6..f4be0e403e 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -2321,12 +2321,12 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info, { gint image_size = MAX (image_width, image_height); if (image_size > 0) - icon_info->scale = icon_info->desired_size / image_size; + icon_info->scale = icon_info->desired_size / (gdouble)image_size; else icon_info->scale = 1.0; if (icon_info->dir_type == ICON_THEME_DIR_UNTHEMED) - icon_info->scale = MAX (icon_info->scale, 1.0); + icon_info->scale = MIN (icon_info->scale, 1.5); } /* We don't short-circuit out here for scale_only, since, now @@ -2362,7 +2362,8 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info, * pixbuf may not be exactly this size; an icon theme may have icons * that differ slightly from their nominal sizes, and in addition GTK+ * will avoid scaling icons that it considers sufficiently close to the - * requested size. (This maintains sharpness.) + * requested size or for which the source image would have to be scaled + * up too far. (This maintains sharpness.) * * Return value: the rendered icon; this may be a newly created icon * or a new reference to an internal icon, so you must not modify