[maemo-commits] [maemo-commits] r13097 - in projects/haf/tags/hildon-thumbnail/0.12: . debian thumbs

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Aug 10 12:48:06 EEST 2007
Author: kihamala
Date: 2007-08-10 12:48:04 +0300 (Fri, 10 Aug 2007)
New Revision: 13097

Modified:
   projects/haf/tags/hildon-thumbnail/0.12/ChangeLog
   projects/haf/tags/hildon-thumbnail/0.12/debian/changelog
   projects/haf/tags/hildon-thumbnail/0.12/thumbs/thumber-gdk-pixbuf.c
Log:
read four bytes at a time


Modified: projects/haf/tags/hildon-thumbnail/0.12/ChangeLog
===================================================================
--- projects/haf/tags/hildon-thumbnail/0.12/ChangeLog	2007-08-10 09:40:33 UTC (rev 13096)
+++ projects/haf/tags/hildon-thumbnail/0.12/ChangeLog	2007-08-10 09:48:04 UTC (rev 13097)
@@ -3,6 +3,7 @@
 	Patch from Daniil Ivanov:
 	* thumbs/thumber-gdk-pixbuf.c: Add global variable 'oom'.
 	(create_thumb): Check OOM condition from the 'oom' variable.
+	Read four bytes at a time, in case it is more ARM-friendly.
 	(thumbnailer_oom_func): New.
 	(main): Register thumbnailer_oom_func as the OOM callback.
 	Fixes: NB#63712

Modified: projects/haf/tags/hildon-thumbnail/0.12/debian/changelog
===================================================================
--- projects/haf/tags/hildon-thumbnail/0.12/debian/changelog	2007-08-10 09:40:33 UTC (rev 13096)
+++ projects/haf/tags/hildon-thumbnail/0.12/debian/changelog	2007-08-10 09:48:04 UTC (rev 13097)
@@ -1,6 +1,7 @@
 hildon-thumbnail (0.12~unreleased) unstable; urgency=low
 
   * Applied patch to use Libosso saw functions. Fixes: NB#63712
+  * Read four bytes at a time, instead of one byte, in thumber-gdk-pixbuf.
 
  -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Fri, 10 Aug 2007 09:54:03 +0300
 

Modified: projects/haf/tags/hildon-thumbnail/0.12/thumbs/thumber-gdk-pixbuf.c
===================================================================
--- projects/haf/tags/hildon-thumbnail/0.12/thumbs/thumber-gdk-pixbuf.c	2007-08-10 09:40:33 UTC (rev 13096)
+++ projects/haf/tags/hildon-thumbnail/0.12/thumbs/thumber-gdk-pixbuf.c	2007-08-10 09:48:04 UTC (rev 13097)
@@ -141,23 +141,23 @@
     if((flags & HILDON_THUMBNAIL_FLAG_CROP)) {
        GdkPixbuf *pixbuf, *result = NULL;
        GdkPixbufLoader *loader;
-       guchar buffer[2048];
+       guchar buffer[2048]; /* size must be dividable by 4 */
        FILE *f; 
-       size_t bytes_read = sizeof(buffer);
+       size_t items_read = sizeof(buffer) / 4;
        size_t desired_max_area;
 
        f = fopen(local_file, "r");
        if (!f) return NULL;
-     
+
        desired_max_area = (width * height * 4) - 1;
        loader = gdk_pixbuf_loader_new ();
        g_signal_connect(loader, "size-prepared", G_CALLBACK(size_prepared),
                         GINT_TO_POINTER(desired_max_area));
 
-       while (!oom && bytes_read >= sizeof(buffer))
+       while (!oom && items_read >= sizeof(buffer) / 4)
        {
-         bytes_read = fread(buffer, 1, sizeof(buffer), f);
-         if (!gdk_pixbuf_loader_write(loader, buffer, bytes_read, error))
+         items_read = fread(buffer, 4, sizeof(buffer) / 4, f);
+         if (!gdk_pixbuf_loader_write(loader, buffer, items_read, error))
          { /* We have to call close before unreffing */
            gdk_pixbuf_loader_close(loader, NULL);
            goto cleanup;
@@ -166,7 +166,7 @@
 
        if (!gdk_pixbuf_loader_close(loader, error))
          goto cleanup;
-       
+
        /* Loader owns reference to this pixbuf */
        pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
 


More information about the maemo-commits mailing list