[babl] Michael Henning <drawoc darkrefraction com>



commit b17855e67b18eb0e43b6f50ee8d8fc8222aadc61
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Tue Nov 13 23:06:21 2012 +0100

    Michael Henning <drawoc darkrefraction com>
    
    Clean up babl_process_chunks a bit.

 babl/babl-fish-path.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index 7c1a87b..f7ab32a 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -25,6 +25,8 @@
 #define BABL_HARD_MAX_PATH_LENGTH  8
 #define BABL_MAX_NAME_LEN          1024
 
+#define MIN(a, b) (((a) > (b)) ? (b) : (a))
+
 #define NUM_TEST_PIXELS            3072
 
 int   babl_in_fish_path = 0;
@@ -407,7 +409,7 @@ babl_process_chunks (const Babl *cbabl,
         source_bpp = babl_source->type.bits / 8;
         break;
       default:
-        fprintf (stderr, "=eeek{%i}\n", babl_source->instance.class_type - BABL_MAGIC);
+        babl_log ("=eeek{%i}\n", babl_source->instance.class_type - BABL_MAGIC);
     }
 
   switch (babl_dest->instance.class_type)
@@ -419,7 +421,7 @@ babl_process_chunks (const Babl *cbabl,
         dest_bpp = babl_dest->type.bits / 8;
         break;
       default:
-        fprintf (stderr, "-eeek{%i}\n", babl_dest->instance.class_type - BABL_MAGIC);
+        babl_log ("-eeek{%i}\n", babl_dest->instance.class_type - BABL_MAGIC);
     }
 
   babl_assert (source_bpp);
@@ -427,14 +429,12 @@ babl_process_chunks (const Babl *cbabl,
 
   for (i = 0; i < n; i += MAX_BUFFER_SIZE)
     {
-      long c;
-      if (i + MAX_BUFFER_SIZE <= n)
-        c = MAX_BUFFER_SIZE;
-      else
-        c = n - i;
-
-      babl_process (cbabl, source + (i * source_bpp),
-                           destination + (i * dest_bpp), c);
+      long c = MIN (n - i, MAX_BUFFER_SIZE);
+
+      babl->fish.processings++;
+      babl->fish.pixels +=
+             babl_fish_process (babl, source + (i * source_bpp),
+                                destination + (i * dest_bpp), c);
     }
   return n;
 }



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