Bug 478528 - Layer and Image previews are not color managed

Fix gimp_color_profile_get_format() to return the right format for
"cairo-RGB24": simply check for the more special cairo formats first,
then check for the general RGB models. Found by Massimo.
This commit is contained in:
Michael Natterer 2015-09-06 14:12:58 +02:00
parent a545a4b314
commit f9da5cc6cc
1 changed files with 13 additions and 13 deletions

View File

@ -930,8 +930,8 @@ gimp_color_profile_new_adobe_rgb (void)
* used instead of the passed @format, which usually is the same as
* @format, unless lcms doesn't support @format.
*
* Note that this function currently only supports RGB, RGBA, R'G'B' and
* R'G'B'A formats.
* Note that this function currently only supports RGB, RGBA, R'G'B',
* R'G'B'A and the cairo-RGB24 and cairo-ARGB32 formats.
*
* Return value: the #Babl format to be used instead of @format, or %NULL
* is the passed @format is not supported at all.
@ -955,17 +955,7 @@ gimp_color_profile_get_format (const Babl *format,
type = babl_format_get_type (format, 0);
model = babl_format_get_model (format);
if (model == babl_model ("RGB") ||
model == babl_model ("RGBA"))
{
linear = TRUE;
}
else if (model == babl_model ("R'G'B'") ||
model == babl_model ("R'G'B'A"))
{
linear = FALSE;
}
else if (format == babl_format ("cairo-RGB24"))
if (format == babl_format ("cairo-RGB24"))
{
*lcms_format = TYPE_RGB_8;
@ -977,6 +967,16 @@ gimp_color_profile_get_format (const Babl *format,
return babl_format ("R'G'B'A u8");
}
else if (model == babl_model ("RGB") ||
model == babl_model ("RGBA"))
{
linear = TRUE;
}
else if (model == babl_model ("R'G'B'") ||
model == babl_model ("R'G'B'A"))
{
linear = FALSE;
}
else
{
g_printerr ("format: %s\n"