babl: fix LUT from grayscale to RGBA images.
authorJehan <jehan@girinstud.io>
Mon, 13 Feb 2023 22:34:48 +0000 (23:34 +0100)
committerJehan <jehan@girinstud.io>
Mon, 13 Feb 2023 22:34:48 +0000 (23:34 +0100)
Images from "Y'A" to "R'G'B'A" for instance would end up completely
transparent because we were not reporting the alpha channel from the
source to destination buffer.

babl/babl-fish-path.c

index 808381cad5fee1b4b986f3e7d4c69caf62ba86bd..a4b002af080447623322848fdabbba1be526f3ed 100644 (file)
@@ -200,8 +200,10 @@ static inline int _do_lut (uint32_t *lut,
           uint32_t *dst = (uint32_t*)destination;
           while (n--)
           {
-             *dst = lut[*src++];
-             dst++;
+            uint16_t col = *src++;
+            *dst = lut[col & 0xff];
+            *dst |= (((uint32_t) (col & 0xff00)) << 16);
+            dst++;
           }
         }
         else if (source_bpp == 2 && dest_bpp == 2)