babl: LUT, only exclude associated alpha when copied
authorØyvind Kolås <pippin@gimp.org>
Wed, 15 Feb 2023 16:21:56 +0000 (17:21 +0100)
committerØyvind Kolås <pippin@gimp.org>
Wed, 15 Feb 2023 16:21:56 +0000 (17:21 +0100)
babl/babl-fish-path.c

index c1e59a873f82723b332b6a8d530f3ab17ef6acee..bda0c7baa88184b659c2a6535c1a7d6a77c6ac7e 100644 (file)
@@ -962,26 +962,30 @@ _babl_fish_prepare_bpp (Babl *babl)
                                                   babl_format_get_n_components (babl_source) - 1);
   const Babl *dest_type   = babl_format_get_type (babl_dest,
                                                   babl_format_get_n_components (babl_dest) - 1);
+
+  int dest_not_associated = ((babl->conversion.destination->format.model->flags &
+          BABL_MODEL_FLAG_ASSOCIATED)==0);
+
   if (
       (babl->conversion.source->format.type[0]->bits < 32)       
 
-      && ((babl->conversion.destination->format.model->flags &
-          BABL_MODEL_FLAG_ASSOCIATED)==0)
-
       && (  (   source_bpp == 2
              && dest_bpp   == 16)
 
           ||(   source_bpp == 4
              && dest_bpp   == 16
-             && dest_type  == babl_type_from_id (BABL_FLOAT))
+             && dest_type  == babl_type_from_id (BABL_FLOAT)
+             && dest_not_associated)
 
           ||(   source_bpp == 4
              && dest_bpp   == 4
-             && dest_type  ==source_type)
+             && dest_type  == source_type
+             && dest_not_associated)
 
           ||(   source_bpp == 4
              && dest_bpp   == 8
-             && dest_type  == babl_type_from_id (BABL_U16))
+             && dest_type  == babl_type_from_id (BABL_U16)
+             && dest_not_associated)
 
           ||(   source_bpp == 3
              && dest_bpp   == 4)