Re: [Evolution-hackers] Patch for image scale down



First, sorry for the wrong mailing list :((

Cc: evo-patches..

Le mer 08/10/2003 à 01:56, Not Zed a écrit :
> On Wed, 2003-10-08 at 01:24, Frederic Crozat wrote: 
> > The attached patch make evolution uses 
> > gnome_thumbnail_scale_down_pixbuf instead of gdk_pixbuf_scale_simplified
> > if it is available (ie on GNOME platform >= 2.2), which fixes big
> > performance problem when it tries to scale down big images (see bug 
> > http://qa.mandrakesoft.com/show_bug.cgi?id=6065 ). It also seems mini
> > pixbuf is re-computed when switching from open to close for inline
> > attachement (I didn't fix this problem).
> Hmm, they should be cached, in 1.4 anyway, head doesn't from memory.

Well, my patch is for 1.4 and I can see it isn't cached at all when
pressing the arrow attachement button..

I did some checks and pbl->cid changes each time message is reloaded and
when you press arrow attachement button, therefore cache purpose is
defeated :(

> > This is a known problem in gdk_pixbuf_scale (which can be workarounded
> > by using gdk_pixbuf_loader_set_size, only with GTK+ 2.2).
> If you need gtk+ 2.2 for it, shouldn't it just use that directly?  And
> what happens if you use that on pre 2.2 versions, i.e. does it have a
> detrimental affect, or is it just effectively ignored.

Ok, I wasn't clear enough :

to fix the scaling performance on very big images to do thumbnails, you
can either :
-use gnome-thumbnail_scale_down_pixbuf which is in libgnomeui >= 2.2 (I
could also copy/paste the function code which is only using gdk-pixbuf
2.0 code), which can be up to 100x faster than gdk_pixbuf_scale_simple
in these cases. So we only need gtk+ 2.0 in this case.
-use gdk_pixbuf_loader_set_size call, which was introduced in gtk+ 2.2
and will require more changes in the code, since loader is used for
loading both full size and thumbnail image.

> > Can I commit this to CVS (both branches, I guess) ?
> 
> This codepath is completely different in head, tho i guess the same
> issue will arise.

Well, I must confess I didn't look at HEAD yet :)

> FWIW i tested the test message on the bug, and i didn't see what i
> would've considered any more delay than i'd expect for such a large
> image - 1/2 to 1 second was all to build the thumbnail.

Well, you must have a very fast system or with a lot of memory (I'm not
sure which factor is the most important) :
on my test system (PIII/450) , it takes :
-1min25s to render thumbnail with gdk_pixbuf_scale_simple 
-2s with gnome_thumbnail_scale_pixbuf 

I think we have a winner here :)

> As for the patch, what defines GNOME_THUMBNAIL_H?  Isn't it ...
> gnome-thumbnail.h?

Hmm, I should have tested my patch better :))

I've fixed this in the new attached patch..
-- 
Frederic Crozat <fcrozat mandrakesoft com>
Mandrakesoft
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1215.2.10
diff -u -r1.1215.2.10 ChangeLog
--- ChangeLog	26 Sep 2003 23:54:10 -0000	1.1215.2.10
+++ ChangeLog	8 Oct 2003 10:09:45 -0000
@@ -1,3 +1,7 @@
+2003-10-08  Frederic Crozat  <fcrozat mandrakesoft com>
+
+	* configure.in: Check for gnome-thumbnail.h existence.
+
 2003-09-27  Laurent Dhima  <laurenti alblinux net>
 
 	* configure.in: Added "sq" to ALL_LINGUAS.
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.591.2.8
diff -u -r1.591.2.8 configure.in
--- configure.in	26 Sep 2003 23:52:36 -0000	1.591.2.8
+++ configure.in	8 Oct 2003 10:09:46 -0000
@@ -1061,6 +1061,7 @@
 CPPFLAGS_save="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags-only-I libgnomeui-2.0`"
 AC_CHECK_HEADERS(libgnomeui/gnome-icon-lookup.h)
+AC_CHECK_HEADERS(libgnomeui/gnome-thumbnail.h)
 CPPFLAGS="$CPPFLAGS_save"
 
 dnl --- Flags for the various libraries we build
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2761.2.31
diff -u -r1.2761.2.31 ChangeLog
--- mail/ChangeLog	6 Oct 2003 18:44:23 -0000	1.2761.2.31
+++ mail/ChangeLog	8 Oct 2003 10:09:46 -0000
@@ -1,3 +1,9 @@
+2003-10-08  Frederic Crozat  <fcrozat mandrakesoft com>
+
+	* mail-display.c: (pixbuf_gen_idle):
+	Use gnome-thumbnail_scale_down_pixbuf if available,
+	for better performance.
+
 2003-10-03  Frederic Crozat  <fcrozat mandrakesoft com>
 
 	* mail-config-druid.c (identity_prepare), (config_wizard_new):
Index: mail/mail-display.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/Attic/mail-display.c,v
retrieving revision 1.282.4.8
diff -u -r1.282.4.8 mail-display.c
--- mail/mail-display.c	18 Sep 2003 08:44:11 -0000	1.282.4.8
+++ mail/mail-display.c	8 Oct 2003 10:09:46 -0000
@@ -52,6 +52,9 @@
 #include <gdk/gdkkeysyms.h>
 #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 <gal/util/e-util.h>
 #include <gal/widgets/e-popup-menu.h>
 
@@ -710,7 +713,11 @@
 		}
 	}
 	
+#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
 	if (error || !pbl->mstream)
 		g_object_unref (pixbuf);
 	


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]