1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

plug-ins: Fix Recompose for YCbCr decomposed images

The strings used in decompose.c's "decompose-type" do not match
the values of compose_type for YCbCr values. This means that when
using non-interactive Recompose, there's no match and the Recompose
fails. We'll need to wait until the next API break to fix the strings.
For now, we will do additional checks if the normal compose_type check
fails and also compare the four YCbCr types from Decompose.
This commit is contained in:
Alx Sa
2025-08-31 01:53:28 +00:00
parent 1365b8a08b
commit cf9d39c3d7

View File

@@ -762,17 +762,17 @@ compose_run (GimpProcedure *procedure,
}
}
if (strcmp (name, RECOMPOSE_PROC) != 0)
{
compose_idx = gimp_procedure_config_get_choice_id (config, "compose-type");
if (strcmp (name, RECOMPOSE_PROC) != 0)
{
compose_idx = gimp_procedure_config_get_choice_id (config, "compose-type");
if (compose_idx >= 0 && compose_idx < G_N_ELEMENTS (compose_dsc))
{
g_strlcpy (composevals.compose_type,
compose_dsc[compose_idx].compose_type,
sizeof (composevals.compose_type));
}
}
if (compose_idx >= 0 && compose_idx < G_N_ELEMENTS (compose_dsc))
{
g_strlcpy (composevals.compose_type,
compose_dsc[compose_idx].compose_type,
sizeof (composevals.compose_type));
}
}
gimp_progress_init (_("Composing"));
@@ -1036,6 +1036,22 @@ compose (const gchar *compose_type,
}
}
/* TODO: The strings used in decompose.c's "decompose-type" do not match
* the values of compose_type for YCbCr values. We'll need to wait until
* the next API break to fix. For now, we can do additional checks if the
* loop above fails when called for Recompose. */
if (compose_idx < 0)
{
if (g_ascii_strcasecmp (compose_type, "ycbcr470f") == 0)
compose_idx = 9;
else if (g_ascii_strcasecmp (compose_type, "ycbcr709f") == 0)
compose_idx = 10;
else if (g_ascii_strcasecmp (compose_type, "ycbcr470") == 0)
compose_idx = 7;
else if (g_ascii_strcasecmp (compose_type, "ycbcr709") == 0)
compose_idx = 8;
}
if (compose_idx < 0)
return NULL;