mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
Issue #12573: Color Picker selects the wrong color on indexed images.
The code to retrieve the alpha-variant of the indexed palette was wrong, and therefore babl was creating a brand-new palette fornat. Not sure if the palette was empty, or was random or anything. It's even weird it even produced somewhat resembling colors.
This commit is contained in:
parent
dd4b687d36
commit
4b582bdba8
1 changed files with 9 additions and 0 deletions
|
@ -613,8 +613,17 @@ gimp_babl_format_get_with_alpha (const Babl *format)
|
||||||
if (babl_format_is_palette (format))
|
if (babl_format_is_palette (format))
|
||||||
{
|
{
|
||||||
gchar *alpha_palette = g_strdup (model);
|
gchar *alpha_palette = g_strdup (model);
|
||||||
|
gchar *last_hyphen;
|
||||||
|
|
||||||
|
/* Retrieving the alpha variant of the same palette.
|
||||||
|
* 1. The alpha variant starts with '\'.
|
||||||
|
* 2. Removing the last part of the name which represents the
|
||||||
|
* space because babl will add it itself.
|
||||||
|
*/
|
||||||
alpha_palette[0] = '\\';
|
alpha_palette[0] = '\\';
|
||||||
|
last_hyphen = g_strrstr (alpha_palette, "-");
|
||||||
|
if (last_hyphen != NULL)
|
||||||
|
*last_hyphen = '\0';
|
||||||
babl_new_palette_with_space (alpha_palette, babl_format_get_space (format),
|
babl_new_palette_with_space (alpha_palette, babl_format_get_space (format),
|
||||||
NULL, &new_format);
|
NULL, &new_format);
|
||||||
g_free (alpha_palette);
|
g_free (alpha_palette);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue