[babl] babl: don't write anything if dest model lacks a source component



commit ab431f17dc9714f996ec3c23dbaec3a2a21433e8
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Sat Jul 14 17:07:38 2012 +0200

    babl: don't write anything if dest model lacks a source component
    
    otherwise converting cairo-RGB24 to R'G'B' overwrites the red
    component with the PAD.

 babl/babl-fish-reference.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c
index b00d67d..56eeb16 100644
--- a/babl/babl-fish-reference.c
+++ b/babl/babl-fish-reference.c
@@ -133,14 +133,14 @@ convert_to_double (BablFormat      *source_fmt,
             {
               dst_img->data[0] =
                 source_double_buf + (dst_img->type[0]->bits / 8) * j;
+
+              babl_process (assert_conversion_find (src_img->type[0],
+                                                    dst_img->type[0]),
+                            src_img, dst_img, n);
               break;
             }
         }
 
-      babl_process (
-        assert_conversion_find (src_img->type[0], dst_img->type[0]),
-        src_img, dst_img,
-        n);
       src_img->data[0] += src_img->type[0]->bits / 8;
     }
   babl_free (src_img);
@@ -187,14 +187,14 @@ convert_from_double (BablFormat *destination_fmt,
             {
               src_img->data[0] =
                 destination_double_buf + (src_img->type[0]->bits / 8) * j;
+
+              babl_process (assert_conversion_find (src_img->type[0],
+                                                    dst_img->type[0]),
+                            src_img, dst_img, n);
               break;
             }
         }
 
-      babl_process (
-        assert_conversion_find (src_img->type[0], dst_img->type[0]),
-        src_img, dst_img,
-        n);
       dst_img->data[0] += dst_img->type[0]->bits / 8;
     }
   babl_free (src_img);



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