aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog7
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c2
-rw-r--r--e-util/ChangeLog11
-rw-r--r--e-util/e-icon-factory.c32
-rw-r--r--e-util/e-icon-factory.h2
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/em-format-html-display.c2
-rw-r--r--mail/em-icon-stream.c10
-rw-r--r--widgets/misc/ChangeLog10
-rw-r--r--widgets/misc/e-attachment-bar.c5
-rw-r--r--widgets/misc/e-image-chooser.c5
-rw-r--r--widgets/misc/e-spinner.c5
12 files changed, 80 insertions, 19 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 7179531ad1..4bd801ef74 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-11 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #488213
+
+ * gui/contact-editor/e-contact-editor.c: (extract_simple_field):
+ Use global function e_icon_factory_pixbuf_scale for scaling pixbufs.
+
2008-01-10 Milan Crha <mcrha@redhat.com>
** Fix for bug #448441
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 3972889d6c..6b033015a7 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -2293,7 +2293,7 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
height = 96;
}
- new = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
+ new = e_icon_factory_pixbuf_scale (pixbuf, width, height);
if (new) {
GdkPixbufFormat *format = gdk_pixbuf_loader_get_format (loader);
gchar *format_name = gdk_pixbuf_format_get_name (format);
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_ */
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 5f853b17c4..bffcc46327 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2008-01-11 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #488213
+
+ * em-icon-stream.c: (emis_fit):
+ * em-format-html-display.c: (efhd_attachment_button):
+ Use global function e_icon_factory_pixbuf_scale for scaling pixbufs.
+
2008-01-10 Milan Crha <mcrha@redhat.com>
** Fix for bug #507067
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 6da3096774..6e0b0e759d 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -1937,7 +1937,7 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
GdkPixbuf *pixbuf, *mini;
if ((pixbuf = e_icon_for_mime_type (simple_type, 24))) {
- if ((mini = gdk_pixbuf_scale_simple (pixbuf, 24, 24, GDK_INTERP_BILINEAR))) {
+ if ((mini = e_icon_factory_pixbuf_scale (pixbuf, 24, 24))) {
gtk_image_set_from_pixbuf ((GtkImage *) w, mini);
g_object_unref (mini);
}
diff --git a/mail/em-icon-stream.c b/mail/em-icon-stream.c
index ebd2cf6cc1..9f698e2c54 100644
--- a/mail/em-icon-stream.c
+++ b/mail/em-icon-stream.c
@@ -30,11 +30,9 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
-#ifdef HAVE_LIBGNOMEUI_GNOME_THUMBNAIL_H
-#include <libgnomeui/gnome-thumbnail.h>
-#endif
#include <gtk/gtkimage.h>
#include "em-icon-stream.h"
+#include "e-util/e-icon-factory.h"
#include "libedataserver/e-msgport.h"
@@ -187,11 +185,7 @@ emis_fit(GdkPixbuf *pixbuf, int maxwidth, int maxheight, int *scale)
if (height <= 0)
height = 1;
-#ifdef HAVE_LIBGNOMEUI_GNOME_THUMBNAIL_H
- mini = gnome_thumbnail_scale_down_pixbuf(pixbuf, width, height);
-#else
- mini = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR);
-#endif
+ mini = e_icon_factory_pixbuf_scale (pixbuf, width, height);
}
return mini;
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 5aa92bc051..2261a7ba4f 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,13 @@
+2008-01-11 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #488213
+
+ * e-spinner.c: (scale_to_size):
+ * e-image-chooser.c: (set_image_from_data):
+ * e-attachment-bar.c: (e_attachment_bar_create_attachment_cache),
+ (update):
+ Use global function e_icon_factory_pixbuf_scale for scaling pixbufs.
+
2008-01-10 Srinivasa Ragavan <sragavan@novell.com>
** Add better support to show info/errors
diff --git a/widgets/misc/e-attachment-bar.c b/widgets/misc/e-attachment-bar.c
index 192fba56e0..33bff284f7 100644
--- a/widgets/misc/e-attachment-bar.c
+++ b/widgets/misc/e-attachment-bar.c
@@ -241,7 +241,7 @@ e_attachment_bar_create_attachment_cache (EAttachment *attachment)
}
}
- attachment->pixbuf_cache = gdk_pixbuf_scale_simple (pixbuf, width,height,GDK_INTERP_BILINEAR);
+ attachment->pixbuf_cache = e_icon_factory_pixbuf_scale (pixbuf, width, height);
pixbuf = attachment->pixbuf_cache;
g_object_ref(pixbuf);
} else {
@@ -334,8 +334,7 @@ update (EAttachmentBar *bar)
}
}
- attachment->pixbuf_cache = gdk_pixbuf_scale_simple (pixbuf, width, height,
- GDK_INTERP_BILINEAR);
+ attachment->pixbuf_cache = e_icon_factory_pixbuf_scale (pixbuf, width, height);
pixbuf = attachment->pixbuf_cache;
g_object_ref (pixbuf);
} else {
diff --git a/widgets/misc/e-image-chooser.c b/widgets/misc/e-image-chooser.c
index c15cb54817..5dae27527f 100644
--- a/widgets/misc/e-image-chooser.c
+++ b/widgets/misc/e-image-chooser.c
@@ -34,6 +34,7 @@
#include "e-image-chooser.h"
#include "e-util/e-util-marshal.h"
+#include "e-util/e-icon-factory.h"
struct _EImageChooserPrivate {
@@ -292,9 +293,7 @@ set_image_from_data (EImageChooser *chooser,
printf ("new scaled dimensions = (%d,%d)\n", new_width, new_height);
- scaled = gdk_pixbuf_scale_simple (pixbuf,
- new_width, new_height,
- GDK_INTERP_BILINEAR);
+ scaled = e_icon_factory_pixbuf_scale (pixbuf, new_width, new_height);
composite = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, gdk_pixbuf_get_bits_per_sample (pixbuf),
chooser->priv->image_width, chooser->priv->image_height);
diff --git a/widgets/misc/e-spinner.c b/widgets/misc/e-spinner.c
index 79ababe803..c5a247044d 100644
--- a/widgets/misc/e-spinner.c
+++ b/widgets/misc/e-spinner.c
@@ -41,6 +41,8 @@
#include <gtk/gtkiconfactory.h>
#include <gtk/gtksettings.h>
+#include "e-util/e-icon-factory.h"
+
/* Spinner cache implementation */
#define E_TYPE_SPINNER_CACHE (e_spinner_cache_get_type())
@@ -222,8 +224,7 @@ scale_to_size (GdkPixbuf *pixbuf,
if (pw != dw || ph != dh)
{
- result = gdk_pixbuf_scale_simple (pixbuf, dw, dh,
- GDK_INTERP_BILINEAR);
+ result = e_icon_factory_pixbuf_scale (pixbuf, dw, dh);
g_object_unref (pixbuf);
return result;
}