babl: special case palette formats in babl_format_with_space
authorØyvind Kolås <pippin@gimp.org>
Thu, 6 Dec 2018 16:06:28 +0000 (17:06 +0100)
committerØyvind Kolås <pippin@gimp.org>
Thu, 6 Dec 2018 16:06:28 +0000 (17:06 +0100)
For now, re-return the original passed in format, this will as
a starter not crash - while the color management is non-functional;
the special casing will be made more elaborate with space support
in babl-palette.

babl/babl-format.c

index 7b81cae22dfe477f88d95b2e7cf8a53d60a8e4ba..e5324176df3611a18d05700a534670953387438e 100644 (file)
@@ -727,6 +727,13 @@ babl_format_with_space (const char *encoding, const Babl *space)
 
   if (BABL_IS_BABL (example_format))
   {
+    if (babl_format_is_palette (example_format))
+    {
+      /* XXX we should allocate a new palette name, and 
+             duplicate the path data, converted for new space
+       */
+      return example_format;
+    }
     encoding = babl_get_name (example_format);
     if (babl_format_get_space (example_format) != babl_space ("sRGB"))
     {