diff options
author | Milan Crha <mcrha@redhat.com> | 2008-01-12 00:05:07 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-01-12 00:05:07 +0800 |
commit | 16ed932ab391d318fbfd1ecf042573b91f6ecfb2 (patch) | |
tree | 61c64a55b3dee7116d54acc1c35eab902009498f /e-util | |
parent | 0859d42faed775ce440ff18ed86e150b3f904424 (diff) | |
download | gsoc2013-evolution-16ed932ab391d318fbfd1ecf042573b91f6ecfb2.tar gsoc2013-evolution-16ed932ab391d318fbfd1ecf042573b91f6ecfb2.tar.gz gsoc2013-evolution-16ed932ab391d318fbfd1ecf042573b91f6ecfb2.tar.bz2 gsoc2013-evolution-16ed932ab391d318fbfd1ecf042573b91f6ecfb2.tar.lz gsoc2013-evolution-16ed932ab391d318fbfd1ecf042573b91f6ecfb2.tar.xz gsoc2013-evolution-16ed932ab391d318fbfd1ecf042573b91f6ecfb2.tar.zst gsoc2013-evolution-16ed932ab391d318fbfd1ecf042573b91f6ecfb2.zip |
** Fix for bug #488213
2008-01-11 Milan Crha <mcrha@redhat.com>
** Fix for bug #488213
* e-util/e-icon-factory.h: (e_icon_factory_pixbuf_scale):
* e-util/e-icon-factory.c: (e_icon_factory_pixbuf_scale):
New global function for pixbuf scaling which speeds up scaling when
HAVE_LIBGNOMEUI_GNOME_THUMBNAIL_H.
* addressbook/gui/contact-editor/e-contact-editor.c: (extract_simple_field):
* mail/em-icon-stream.c: (emis_fit):
* mail/em-format-html-display.c: (efhd_attachment_button):
* e-util/e-icon-factory.c: (load_icon):
* widgets/misc/e-spinner.c: (scale_to_size):
* widgets/misc/e-image-chooser.c: (set_image_from_data):
* widgets/misc/e-attachment-bar.c: (e_attachment_bar_create_attachment_cache), (update):
Use global function e_icon_factory_pixbuf_scale for scaling pixbufs.
svn path=/trunk/; revision=34800
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/ChangeLog | 11 | ||||
-rw-r--r-- | e-util/e-icon-factory.c | 32 | ||||
-rw-r--r-- | e-util/e-icon-factory.h | 2 |
3 files changed, 44 insertions, 1 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 335bdf1d13..68b2df7839 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,14 @@ +2008-01-11 Milan Crha <mcrha@redhat.com> + + ** Fix for bug #488213 + + * e-icon-factory.h: (e_icon_factory_pixbuf_scale): + * e-icon-factory.c: (e_icon_factory_pixbuf_scale): + New global function for pixbuf scaling which speeds up scaling when + HAVE_LIBGNOMEUI_GNOME_THUMBNAIL_H. + * e-icon-factory.c: (load_icon): + Use global function e_icon_factory_pixbuf_scale for scaling pixbufs. + 2008-01-10 Milan Crha <mcrha@redhat.com> ** Fix for bug #211353 diff --git a/e-util/e-icon-factory.c b/e-util/e-icon-factory.c index 78b8122cdd..5a604786dd 100644 --- a/e-util/e-icon-factory.c +++ b/e-util/e-icon-factory.c @@ -32,6 +32,9 @@ #include <gtk/gtkicontheme.h> #include <gtk/gtkimage.h> +#ifdef HAVE_LIBGNOMEUI_GNOME_THUMBNAIL_H +#include <libgnomeui/gnome-thumbnail.h> +#endif #include "e-icon-factory.h" #include "e-util-private.h" @@ -161,7 +164,7 @@ load_icon (const char *icon_key, const char *icon_name, int size, int scale) if (unscaled != NULL) { if(gdk_pixbuf_get_width(unscaled) != size || gdk_pixbuf_get_height(unscaled) != size) { - pixbuf = gdk_pixbuf_scale_simple (unscaled, size, size, GDK_INTERP_BILINEAR); + pixbuf = e_icon_factory_pixbuf_scale (unscaled, size, size); g_object_unref (unscaled); } else pixbuf = unscaled; @@ -402,3 +405,30 @@ e_icon_factory_get_icon_list (const char *icon_name) return list; } + +/** + * e_icon_factory_pixbuf_scale + * Scales pixbuf to desired size. + * @param pixbuf Pixbuf to be scaled. + * @param width Desired width, if less or equal to 0, then changed to 1. + * @param height Desired height, if less or equal to 0, then changed to 1. + * @return Scaled pixbuf. + **/ +GdkPixbuf * +e_icon_factory_pixbuf_scale (GdkPixbuf *pixbuf, int width, int height) +{ + g_return_val_if_fail (pixbuf != NULL, NULL); + + if (width <= 0) + width = 1; + + if (height <= 0) + height = 1; + +#ifdef HAVE_LIBGNOMEUI_GNOME_THUMBNAIL_H + /* because this can only scale down, not up */ + if (gdk_pixbuf_get_width (pixbuf) > width && gdk_pixbuf_get_height (pixbuf) > height) + return gnome_thumbnail_scale_down_pixbuf (pixbuf, width, height); +#endif + return gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR); +} diff --git a/e-util/e-icon-factory.h b/e-util/e-icon-factory.h index 509cc6dccb..92ecac8ac6 100644 --- a/e-util/e-icon-factory.h +++ b/e-util/e-icon-factory.h @@ -55,4 +55,6 @@ GtkWidget *e_icon_factory_get_image (const char *icon_name, int icon_siz GList *e_icon_factory_get_icon_list (const char *icon_name); +GdkPixbuf *e_icon_factory_pixbuf_scale (GdkPixbuf *pixbuf, int width, int height); + #endif /* _E_ICON_FACTORY_H_ */ |