mirror of https://github.com/GNOME/gimp.git
app: remove GimpDrawableFilter's own color profile conversion hack
it's wrong and harmful after space invasion.
This commit is contained in:
parent
78dd964000
commit
08b4b944dc
|
@ -84,8 +84,6 @@ struct _GimpDrawableFilter
|
|||
GeglNode *translate;
|
||||
GeglNode *crop_before;
|
||||
GeglNode *cast_before;
|
||||
GeglNode *transform_before;
|
||||
GeglNode *transform_after;
|
||||
GeglNode *cast_after;
|
||||
GeglNode *crop_after;
|
||||
GimpApplicator *applicator;
|
||||
|
@ -108,7 +106,6 @@ static void gimp_drawable_filter_sync_mode (GimpDrawableFilter *
|
|||
static void gimp_drawable_filter_sync_affect (GimpDrawableFilter *filter);
|
||||
static void gimp_drawable_filter_sync_format (GimpDrawableFilter *filter);
|
||||
static void gimp_drawable_filter_sync_mask (GimpDrawableFilter *filter);
|
||||
static void gimp_drawable_filter_sync_transform (GimpDrawableFilter *filter);
|
||||
static void gimp_drawable_filter_sync_gamma_hack (GimpDrawableFilter *filter);
|
||||
|
||||
static gboolean gimp_drawable_filter_is_filtering (GimpDrawableFilter *filter);
|
||||
|
@ -123,8 +120,6 @@ static void gimp_drawable_filter_affect_changed (GimpImage *
|
|||
GimpDrawableFilter *filter);
|
||||
static void gimp_drawable_filter_mask_changed (GimpImage *image,
|
||||
GimpDrawableFilter *filter);
|
||||
static void gimp_drawable_filter_profile_changed (GimpColorManaged *managed,
|
||||
GimpDrawableFilter *filter);
|
||||
static void gimp_drawable_filter_format_changed (GimpDrawable *drawable,
|
||||
GimpDrawableFilter *filter);
|
||||
static void gimp_drawable_filter_drawable_removed (GimpDrawable *drawable,
|
||||
|
@ -246,23 +241,14 @@ gimp_drawable_filter_new (GimpDrawable *drawable,
|
|||
"operation", "gegl:nop",
|
||||
NULL);
|
||||
|
||||
filter->transform_before = gegl_node_new_child (node,
|
||||
"operation", "gegl:nop",
|
||||
NULL);
|
||||
|
||||
gegl_node_link_many (input,
|
||||
filter->translate,
|
||||
filter->crop_before,
|
||||
filter->cast_before,
|
||||
filter->transform_before,
|
||||
filter->operation,
|
||||
NULL);
|
||||
}
|
||||
|
||||
filter->transform_after = gegl_node_new_child (node,
|
||||
"operation", "gegl:nop",
|
||||
NULL);
|
||||
|
||||
filter->cast_after = gegl_node_new_child (node,
|
||||
"operation", "gegl:nop",
|
||||
NULL);
|
||||
|
@ -272,7 +258,6 @@ gimp_drawable_filter_new (GimpDrawable *drawable,
|
|||
NULL);
|
||||
|
||||
gegl_node_link_many (filter->operation,
|
||||
filter->transform_after,
|
||||
filter->cast_after,
|
||||
filter->crop_after,
|
||||
NULL);
|
||||
|
@ -412,23 +397,6 @@ gimp_drawable_filter_set_mode (GimpDrawableFilter *filter,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_filter_set_color_managed (GimpDrawableFilter *filter,
|
||||
gboolean color_managed)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE_FILTER (filter));
|
||||
|
||||
if (color_managed != filter->color_managed)
|
||||
{
|
||||
filter->color_managed = color_managed;
|
||||
|
||||
gimp_drawable_filter_sync_transform (filter);
|
||||
|
||||
if (gimp_drawable_filter_is_filtering (filter))
|
||||
gimp_drawable_filter_update_drawable (filter, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_filter_set_gamma_hack (GimpDrawableFilter *filter,
|
||||
gboolean gamma_hack)
|
||||
|
@ -440,7 +408,6 @@ gimp_drawable_filter_set_gamma_hack (GimpDrawableFilter *filter,
|
|||
filter->gamma_hack = gamma_hack;
|
||||
|
||||
gimp_drawable_filter_sync_gamma_hack (filter);
|
||||
gimp_drawable_filter_sync_transform (filter);
|
||||
|
||||
if (gimp_drawable_filter_is_filtering (filter))
|
||||
gimp_drawable_filter_update_drawable (filter, NULL);
|
||||
|
@ -754,115 +721,6 @@ gimp_drawable_filter_sync_mask (GimpDrawableFilter *filter)
|
|||
&filter->filter_area.height);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_filter_sync_transform (GimpDrawableFilter *filter)
|
||||
{
|
||||
GimpColorManaged *managed = GIMP_COLOR_MANAGED (filter->drawable);
|
||||
|
||||
if (filter->color_managed)
|
||||
{
|
||||
const Babl *drawable_format = NULL;
|
||||
const Babl *input_format = NULL;
|
||||
const Babl *output_format = NULL;
|
||||
GimpColorProfile *drawable_profile = NULL;
|
||||
GimpColorProfile *input_profile = NULL;
|
||||
GimpColorProfile *output_profile = NULL;
|
||||
guint32 dummy;
|
||||
|
||||
drawable_format = gimp_drawable_get_format (filter->drawable);
|
||||
if (filter->has_input)
|
||||
input_format = gimp_gegl_node_get_format (filter->operation, "input");
|
||||
output_format = gimp_gegl_node_get_format (filter->operation, "output");
|
||||
|
||||
g_printerr ("drawable format: %s\n", babl_get_name (drawable_format));
|
||||
if (filter->has_input)
|
||||
g_printerr ("filter input format: %s\n", babl_get_name (input_format));
|
||||
g_printerr ("filter output format: %s\n", babl_get_name (output_format));
|
||||
|
||||
/* convert the drawable format to float, so we get a precise
|
||||
* color transform
|
||||
*/
|
||||
drawable_format =
|
||||
gimp_babl_format (gimp_babl_format_get_base_type (drawable_format),
|
||||
gimp_babl_precision (GIMP_COMPONENT_TYPE_FLOAT,
|
||||
gimp_babl_format_get_trc (drawable_format)),
|
||||
babl_format_has_alpha (drawable_format),
|
||||
babl_format_get_space (drawable_format));
|
||||
|
||||
/* convert the filter input/output formats to something we have
|
||||
* built-in color profiles for (see the get_color_profile()
|
||||
* calls below)
|
||||
*/
|
||||
if (filter->has_input)
|
||||
input_format = gimp_color_profile_get_lcms_format (input_format, &dummy);
|
||||
output_format = gimp_color_profile_get_lcms_format (output_format, &dummy);
|
||||
|
||||
g_printerr ("profile transform drawable format: %s\n",
|
||||
babl_get_name (drawable_format));
|
||||
if (filter->has_input)
|
||||
g_printerr ("profile transform input format: %s\n",
|
||||
babl_get_name (input_format));
|
||||
g_printerr ("profile transform output format: %s\n",
|
||||
babl_get_name (output_format));
|
||||
|
||||
drawable_profile = gimp_color_managed_get_color_profile (managed);
|
||||
if (filter->has_input)
|
||||
input_profile = gimp_babl_format_get_color_profile (input_format);
|
||||
output_profile = gimp_babl_format_get_color_profile (output_format);
|
||||
|
||||
if ((filter->has_input &&
|
||||
! gimp_color_transform_can_gegl_copy (drawable_profile,
|
||||
input_profile)) ||
|
||||
! gimp_color_transform_can_gegl_copy (output_profile,
|
||||
drawable_profile))
|
||||
{
|
||||
g_printerr ("using gimp:profile-transform\n");
|
||||
|
||||
if (filter->has_input)
|
||||
{
|
||||
gegl_node_set (filter->transform_before,
|
||||
"operation", "gimp:profile-transform",
|
||||
"src-profile", drawable_profile,
|
||||
"src-format", drawable_format,
|
||||
"dest-profile", input_profile,
|
||||
"dest-format", input_format,
|
||||
NULL);
|
||||
}
|
||||
|
||||
gegl_node_set (filter->transform_after,
|
||||
"operation", "gimp:profile-transform",
|
||||
"src-profile", output_profile,
|
||||
"src-format", output_format,
|
||||
"dest-profile", drawable_profile,
|
||||
"dest-format", drawable_format,
|
||||
NULL);
|
||||
|
||||
if (filter->has_input)
|
||||
g_object_unref (input_profile);
|
||||
g_object_unref (output_profile);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (filter->has_input)
|
||||
g_object_unref (input_profile);
|
||||
g_object_unref (output_profile);
|
||||
}
|
||||
|
||||
g_printerr ("using gegl copy\n");
|
||||
|
||||
if (filter->has_input)
|
||||
{
|
||||
gegl_node_set (filter->transform_before,
|
||||
"operation", "gegl:nop",
|
||||
NULL);
|
||||
}
|
||||
|
||||
gegl_node_set (filter->transform_after,
|
||||
"operation", "gegl:nop",
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_filter_sync_gamma_hack (GimpDrawableFilter *filter)
|
||||
{
|
||||
|
@ -948,7 +806,6 @@ gimp_drawable_filter_add_filter (GimpDrawableFilter *filter)
|
|||
gimp_drawable_filter_sync_mode (filter);
|
||||
gimp_drawable_filter_sync_affect (filter);
|
||||
gimp_drawable_filter_sync_format (filter);
|
||||
gimp_drawable_filter_sync_transform (filter);
|
||||
gimp_drawable_filter_sync_gamma_hack (filter);
|
||||
|
||||
gimp_drawable_add_filter (filter->drawable,
|
||||
|
@ -960,9 +817,6 @@ gimp_drawable_filter_add_filter (GimpDrawableFilter *filter)
|
|||
g_signal_connect (image, "mask-changed",
|
||||
G_CALLBACK (gimp_drawable_filter_mask_changed),
|
||||
filter);
|
||||
g_signal_connect (image, "profile-changed",
|
||||
G_CALLBACK (gimp_drawable_filter_profile_changed),
|
||||
filter);
|
||||
g_signal_connect (filter->drawable, "format-changed",
|
||||
G_CALLBACK (gimp_drawable_filter_format_changed),
|
||||
filter);
|
||||
|
@ -1003,9 +857,6 @@ gimp_drawable_filter_remove_filter (GimpDrawableFilter *filter)
|
|||
g_signal_handlers_disconnect_by_func (filter->drawable,
|
||||
gimp_drawable_filter_format_changed,
|
||||
filter);
|
||||
g_signal_handlers_disconnect_by_func (image,
|
||||
gimp_drawable_filter_profile_changed,
|
||||
filter);
|
||||
g_signal_handlers_disconnect_by_func (image,
|
||||
gimp_drawable_filter_mask_changed,
|
||||
filter);
|
||||
|
@ -1089,14 +940,6 @@ gimp_drawable_filter_mask_changed (GimpImage *image,
|
|||
gimp_drawable_filter_update_drawable (filter, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_filter_profile_changed (GimpColorManaged *managed,
|
||||
GimpDrawableFilter *filter)
|
||||
{
|
||||
gimp_drawable_filter_sync_transform (filter);
|
||||
gimp_drawable_filter_update_drawable (filter, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_filter_format_changed (GimpDrawable *drawable,
|
||||
GimpDrawableFilter *filter)
|
||||
|
|
|
@ -72,9 +72,6 @@ void gimp_drawable_filter_set_mode (GimpDrawableFilter *filter,
|
|||
GimpLayerColorSpace composite_space,
|
||||
GimpLayerCompositeMode composite_mode);
|
||||
|
||||
void gimp_drawable_filter_set_color_managed
|
||||
(GimpDrawableFilter *filter,
|
||||
gboolean managed);
|
||||
void gimp_drawable_filter_set_gamma_hack (GimpDrawableFilter *filter,
|
||||
gboolean gamma_hack);
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ enum
|
|||
PROP_PREVIEW_POSITION,
|
||||
PROP_CONTROLLER,
|
||||
PROP_REGION,
|
||||
PROP_COLOR_MANAGED,
|
||||
PROP_GAMMA_HACK
|
||||
};
|
||||
|
||||
|
@ -112,14 +111,6 @@ gimp_filter_options_class_init (GimpFilterOptionsClass *klass)
|
|||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_COLOR_MANAGED,
|
||||
g_param_spec_boolean ("color-managed",
|
||||
_("Color _managed"),
|
||||
NULL,
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GAMMA_HACK,
|
||||
g_param_spec_boolean ("gamma-hack",
|
||||
"Gamma hack (temp hack, please ignore)",
|
||||
|
@ -168,10 +159,6 @@ gimp_filter_options_set_property (GObject *object,
|
|||
options->region = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_MANAGED:
|
||||
options->color_managed = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_GAMMA_HACK:
|
||||
options->gamma_hack = g_value_get_boolean (value);
|
||||
break;
|
||||
|
@ -216,10 +203,6 @@ gimp_filter_options_get_property (GObject *object,
|
|||
g_value_set_enum (value, options->region);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_MANAGED:
|
||||
g_value_set_boolean (value, options->color_managed);
|
||||
break;
|
||||
|
||||
case PROP_GAMMA_HACK:
|
||||
g_value_set_boolean (value, options->gamma_hack);
|
||||
break;
|
||||
|
|
|
@ -42,7 +42,6 @@ struct _GimpFilterOptions
|
|||
gdouble preview_position;
|
||||
gboolean controller;
|
||||
GimpFilterRegion region;
|
||||
gboolean color_managed;
|
||||
gboolean gamma_hack;
|
||||
};
|
||||
|
||||
|
|
|
@ -309,7 +309,6 @@ gimp_filter_tool_initialize (GimpTool *tool,
|
|||
GtkWidget *expander;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *combo;
|
||||
GeglOperation *operation;
|
||||
const gchar *operation_name = NULL;
|
||||
|
||||
|
@ -402,15 +401,6 @@ gimp_filter_tool_initialize (GimpTool *tool,
|
|||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
/* The color managed combo */
|
||||
combo = gimp_prop_boolean_combo_box_new
|
||||
(G_OBJECT (tool_info->tool_options), "color-managed",
|
||||
_("Convert pixels to built-in sRGB to apply filter (slow)"),
|
||||
_("Assume pixels are built-in sRGB (ignore actual image color space)"));
|
||||
g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), combo, FALSE, FALSE, 0);
|
||||
gtk_widget_show (combo);
|
||||
|
||||
/* The gamma hack toggle */
|
||||
toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options),
|
||||
"gamma-hack", NULL);
|
||||
|
@ -810,12 +800,6 @@ gimp_filter_tool_options_notify (GimpTool *tool,
|
|||
gimp_drawable_filter_set_region (filter_tool->filter,
|
||||
filter_options->region);
|
||||
}
|
||||
else if (! strcmp (pspec->name, "color-managed") &&
|
||||
filter_tool->filter)
|
||||
{
|
||||
gimp_drawable_filter_set_color_managed (filter_tool->filter,
|
||||
filter_options->color_managed);
|
||||
}
|
||||
else if (! strcmp (pspec->name, "gamma-hack") &&
|
||||
filter_tool->filter)
|
||||
{
|
||||
|
@ -1106,12 +1090,10 @@ gimp_filter_tool_create_filter (GimpFilterTool *filter_tool)
|
|||
filter_tool->operation,
|
||||
gimp_tool_get_icon_name (tool));
|
||||
|
||||
gimp_drawable_filter_set_region (filter_tool->filter,
|
||||
options->region);
|
||||
gimp_drawable_filter_set_color_managed (filter_tool->filter,
|
||||
options->color_managed);
|
||||
gimp_drawable_filter_set_gamma_hack (filter_tool->filter,
|
||||
options->gamma_hack);
|
||||
gimp_drawable_filter_set_region (filter_tool->filter,
|
||||
options->region);
|
||||
gimp_drawable_filter_set_gamma_hack (filter_tool->filter,
|
||||
options->gamma_hack);
|
||||
|
||||
g_signal_connect (filter_tool->filter, "flush",
|
||||
G_CALLBACK (gimp_filter_tool_flush),
|
||||
|
|
Loading…
Reference in New Issue