[babl] Mostly remove BablImage from babl-fish-reference.c



commit c6851a4859270fd9c0d16d1a955e63e2e61f35d1
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Mon Oct 14 22:22:59 2013 -0700

    Mostly remove BablImage from babl-fish-reference.c
    
    There is no valid way to trigger these paths, and the BABL_IS_BABL
    call on image data produces false positives (see bug 698913).

 babl/babl-fish-reference.c |   56 ++++++++++++-------------------------------
 babl/babl-internal.h       |    8 +++---
 2 files changed, 20 insertions(+), 44 deletions(-)
---
diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c
index abb1b48..05172da 100644
--- a/babl/babl-fish-reference.c
+++ b/babl/babl-fish-reference.c
@@ -93,8 +93,7 @@ babl_fish_reference (const Babl *source,
 
 static void
 convert_to_double (BablFormat      *source_fmt,
-                   const BablImage *source,
-                   char            *source_buf,
+                   const char      *source_buf,
                    char            *source_double_buf,
                    int              n)
 {
@@ -114,7 +113,7 @@ convert_to_double (BablFormat      *source_fmt,
   dst_img->stride[0] = 0;
 
 
-  src_img->data[0]   = source_buf;
+  src_img->data[0]   = (char *)source_buf;
   src_img->type[0]   = (BablType *) babl_type_from_id (BABL_DOUBLE);
   src_img->pitch[0]  = source_fmt->bytes_per_pixel;
   src_img->stride[0] = 0;
@@ -151,7 +150,6 @@ convert_to_double (BablFormat      *source_fmt,
 static void
 convert_from_double (BablFormat *destination_fmt,
                      char       *destination_double_buf,
-                     BablImage  *destination,
                      char       *destination_buf,
                      int         n)
 {
@@ -204,7 +202,6 @@ convert_from_double (BablFormat *destination_fmt,
 
 static void
 ncomponent_convert_to_double (BablFormat       *source_fmt,
-                              const BablImage  *source,
                               char             *source_buf,
                               char             *source_double_buf,
                               int               n)
@@ -239,7 +236,6 @@ ncomponent_convert_to_double (BablFormat       *source_fmt,
 static void
 ncomponent_convert_from_double (BablFormat *destination_fmt,
                                 char       *destination_double_buf,
-                                BablImage  *destination,
                                 char       *destination_buf,
                                 int         n)
 {
@@ -276,19 +272,13 @@ ncomponent_convert_from_double (BablFormat *destination_fmt,
 
 
 static int
-process_same_model (const Babl      *babl,
-                    const BablImage *source,
-                    BablImage       *destination,
-                    long             n)
+process_same_model (const Babl  *babl,
+                    const char *source,
+                    char       *destination,
+                    long        n)
 {
   void *double_buf;
 
-  if (BABL_IS_BABL (source) ||
-      BABL_IS_BABL (destination))
-    {
-      babl_log ("args=(%p, %p, %p, %li): trying to handle BablImage (unconfirmed code)",
-                babl_fish, source, destination, n);
-    }
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 
   double_buf = babl_malloc (sizeof (double) * n *
@@ -307,8 +297,7 @@ process_same_model (const Babl      *babl,
        */
       ncomponent_convert_to_double (
         (BablFormat *) BABL (babl->fish.source),
-        BABL_IS_BABL (source) ? source : NULL,
-        BABL_IS_BABL (source) ? NULL : (char *) source,
+        (char *) source,
         double_buf,
         n
       );
@@ -316,8 +305,7 @@ process_same_model (const Babl      *babl,
       ncomponent_convert_from_double (
         (BablFormat *) BABL (babl->fish.destination),
         double_buf,
-        BABL_IS_BABL (destination) ? destination : NULL,
-        BABL_IS_BABL (destination) ? NULL : (char *) destination,
+        (char *) destination,
         n
       );
     }
@@ -325,8 +313,7 @@ process_same_model (const Babl      *babl,
     {
       convert_to_double (
         (BablFormat *) BABL (babl->fish.source),
-        BABL_IS_BABL (source) ? source : NULL,
-        BABL_IS_BABL (source) ? NULL : (char *) source,
+        (char *) source,
         double_buf,
         n
       );
@@ -334,8 +321,7 @@ process_same_model (const Babl      *babl,
       convert_from_double (
         (BablFormat *) BABL (babl->fish.destination),
         double_buf,
-        BABL_IS_BABL (destination) ? destination : NULL,
-        BABL_IS_BABL (destination) ? NULL : (char *) destination,
+        (char *) destination,
         n
       );
     }
@@ -344,10 +330,10 @@ process_same_model (const Babl      *babl,
 }
 
 long
-babl_fish_reference_process (const Babl      *babl,
-                             const BablImage *source,
-                             BablImage       *destination,
-                             long             n)
+babl_fish_reference_process (const Babl *babl,
+                             const char *source,
+                             char       *destination,
+                             long        n)
 {
   void *source_double_buf;
   void *rgba_double_buf;
@@ -360,14 +346,6 @@ babl_fish_reference_process (const Babl      *babl,
   if (BABL (babl->fish.source)->format.model ==
       BABL (babl->fish.destination)->format.model)
     return process_same_model (babl, source, destination, n);
-#if 0
-  if (BABL_IS_BABL (source) ||
-      BABL_IS_BABL (destination))
-    {
-      babl_log ("args=(%p, %p, %p, %li): trying to handle BablImage (unconfirmed code)",
-                babl_fish, source, destination, n);
-    }
-#endif
 
   source_double_buf = babl_malloc (sizeof (double) * n *
                                    BABL (babl->fish.source)->format.model->components);
@@ -384,8 +362,7 @@ babl_fish_reference_process (const Babl      *babl,
 
   convert_to_double (
     (BablFormat *) BABL (babl->fish.source),
-    NULL,
-    (char *) source,
+    source,
     source_double_buf,
     n
   );
@@ -438,8 +415,7 @@ babl_fish_reference_process (const Babl      *babl,
   convert_from_double (
     (BablFormat *) BABL (babl->fish.destination),
     destination_double_buf,
-    NULL,
-    (char *) destination,
+    destination,
     n
   );
 
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index 6f821cd..020bd98 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -82,10 +82,10 @@ void     babl_set_extender              (Babl           *new_extender);
 Babl   * babl_extension_quiet_log       (void);
 void     babl_extension_deinit          (void);
 
-long     babl_fish_reference_process    (const Babl     *babl,
-                                         const BablImage*source,
-                                         BablImage      *destination,
-                                         long            n);
+long     babl_fish_reference_process    (const Babl *babl,
+                                         const char *source,
+                                         char       *destination,
+                                         long        n);
 
 Babl   * babl_fish_reference            (const Babl     *source,
                                          const Babl     *destination);


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