Make the code work as intended for unthemed icons; don't scale them up too

2004-10-04  Matthias Clasen  <mclasen@redhat.com>

	* 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.
This commit is contained in:
Matthias Clasen 2004-10-05 03:18:22 +00:00 committed by Matthias Clasen
parent c6c858dda2
commit 6e6824a06b
5 changed files with 28 additions and 3 deletions

View File

@ -1,5 +1,11 @@
2004-10-04 Matthias Clasen <mclasen@redhat.com> 2004-10-04 Matthias Clasen <mclasen@redhat.com>
* 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 * gtk/gtkcelllayout.c (gtk_cell_layout_clear): Improve
docs. (#154504, Dave Cook) docs. (#154504, Dave Cook)

View File

@ -1,5 +1,11 @@
2004-10-04 Matthias Clasen <mclasen@redhat.com> 2004-10-04 Matthias Clasen <mclasen@redhat.com>
* 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 * gtk/gtkcelllayout.c (gtk_cell_layout_clear): Improve
docs. (#154504, Dave Cook) docs. (#154504, Dave Cook)

View File

@ -1,5 +1,11 @@
2004-10-04 Matthias Clasen <mclasen@redhat.com> 2004-10-04 Matthias Clasen <mclasen@redhat.com>
* 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 * gtk/gtkcelllayout.c (gtk_cell_layout_clear): Improve
docs. (#154504, Dave Cook) docs. (#154504, Dave Cook)

View File

@ -1,5 +1,11 @@
2004-10-04 Matthias Clasen <mclasen@redhat.com> 2004-10-04 Matthias Clasen <mclasen@redhat.com>
* 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 * gtk/gtkcelllayout.c (gtk_cell_layout_clear): Improve
docs. (#154504, Dave Cook) docs. (#154504, Dave Cook)

View File

@ -2321,12 +2321,12 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info,
{ {
gint image_size = MAX (image_width, image_height); gint image_size = MAX (image_width, image_height);
if (image_size > 0) if (image_size > 0)
icon_info->scale = icon_info->desired_size / image_size; icon_info->scale = icon_info->desired_size / (gdouble)image_size;
else else
icon_info->scale = 1.0; icon_info->scale = 1.0;
if (icon_info->dir_type == ICON_THEME_DIR_UNTHEMED) 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 /* 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 * pixbuf may not be exactly this size; an icon theme may have icons
* that differ slightly from their nominal sizes, and in addition GTK+ * that differ slightly from their nominal sizes, and in addition GTK+
* will avoid scaling icons that it considers sufficiently close to the * 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 * 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 * or a new reference to an internal icon, so you must not modify