app, libgimpcolor: handle palette formats across babl_format_with_space()

Don't just pass the input format's encoding because that loses the
palette. Instead, pass the input format directly so
babl_format_with_space() can do its job of preserving the palette.
This commit is contained in:
Michael Natterer 2019-01-01 16:34:57 +01:00
parent 070e10eda7
commit 78f5d39e1a
3 changed files with 10 additions and 14 deletions

View File

@ -1425,7 +1425,7 @@ gimp_layer_convert_type (GimpDrawable *drawable,
dest_space = gimp_image_get_layer_space (dest_image);
}
space_format = babl_format_with_space (babl_format_get_encoding (new_format),
space_format = babl_format_with_space ((const gchar *) new_format,
dest_space);
GIMP_LAYER_GET_CLASS (layer)->convert_type (layer, dest_image, space_format,

View File

@ -1516,7 +1516,7 @@ gimp_color_profile_get_format (GimpColorProfile *profile,
if (! space)
return NULL;
return babl_format_with_space (babl_format_get_encoding (format), space);
return babl_format_with_space ((const gchar *) format, space);
}
/**

View File

@ -251,10 +251,8 @@ gimp_color_transform_new (GimpColorProfile *src_profile,
* spaces, gimp_color_profile_get_lcms_format() might return the
* same format and it must be without space
*/
src_format = babl_format_with_space (babl_format_get_encoding (src_format),
NULL);
dest_format = babl_format_with_space (babl_format_get_encoding (dest_format),
NULL);
src_format = babl_format_with_space ((const gchar *) src_format, NULL);
dest_format = babl_format_with_space ((const gchar *) dest_format, NULL);
priv->src_format = gimp_color_profile_get_lcms_format (src_format,
&lcms_src_format);
@ -347,10 +345,8 @@ gimp_color_transform_new_proofing (GimpColorProfile *src_profile,
/* see gimp_color_transform_new(), we can't have color spaces
* on the formats
*/
src_format = babl_format_with_space (babl_format_get_encoding (src_format),
NULL);
dest_format = babl_format_with_space (babl_format_get_encoding (dest_format),
NULL);
src_format = babl_format_with_space ((const gchar *) src_format, NULL);
dest_format = babl_format_with_space ((const gchar *) dest_format, NULL);
priv->src_format = gimp_color_profile_get_lcms_format (src_format,
&lcms_src_format);
@ -432,10 +428,10 @@ gimp_color_transform_process_pixels (GimpColorTransform *transform,
* input and output color spaces.
*/
src_format =
babl_format_with_space (babl_format_get_encoding (src_format),
babl_format_with_space ((const gchar *) src_format,
babl_format_get_space (priv->src_format));
dest_format =
babl_format_with_space (babl_format_get_encoding (dest_format),
babl_format_with_space ((const gchar *) dest_format,
babl_format_get_space (priv->dest_format));
if (src_format != priv->src_format)
@ -540,10 +536,10 @@ gimp_color_transform_process_buffer (GimpColorTransform *transform,
dest_format = gegl_buffer_get_format (dest_buffer);
src_format =
babl_format_with_space (babl_format_get_encoding (priv->src_format),
babl_format_with_space ((const gchar *) priv->src_format,
babl_format_get_space (src_format));
dest_format =
babl_format_with_space (babl_format_get_encoding (priv->dest_format),
babl_format_with_space ((const gchar *) priv->dest_format,
babl_format_get_space (dest_format));
if (src_buffer != dest_buffer)