Commit a93eaa91 authored by Michael Natterer's avatar Michael Natterer 😴

app: set paint_mode and opacity separately on mode nodes

so we don't constantly change the operation only because the opacity
varies during painting.
parent 190fc5be
......@@ -494,9 +494,9 @@ gimp_layer_notify (GObject *object,
mode_node = gimp_drawable_get_mode_node (GIMP_DRAWABLE (layer));
gimp_gegl_mode_node_set (mode_node,
gimp_layer_get_visible_mode (layer),
layer->opacity, FALSE);
gimp_gegl_mode_node_set_mode (mode_node,
gimp_layer_get_visible_mode (layer),
FALSE);
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
......@@ -594,9 +594,11 @@ gimp_layer_get_node (GimpFilter *filter)
*/
mode_node = gimp_drawable_get_mode_node (drawable);
gimp_gegl_mode_node_set (mode_node,
gimp_layer_get_visible_mode (layer),
layer->opacity, FALSE);
gimp_gegl_mode_node_set_mode (mode_node,
gimp_layer_get_visible_mode (layer),
FALSE);
gimp_gegl_mode_node_set_opacity (mode_node,
layer->opacity);
/* the layer's offset node */
layer->layer_offset_node = gegl_node_new_child (node,
......@@ -1984,9 +1986,7 @@ gimp_layer_set_opacity (GimpLayer *layer,
mode_node = gimp_drawable_get_mode_node (GIMP_DRAWABLE (layer));
gimp_gegl_mode_node_set (mode_node,
gimp_layer_get_visible_mode (layer),
layer->opacity, FALSE);
gimp_gegl_mode_node_set_opacity (mode_node, layer->opacity);
}
gimp_drawable_update (GIMP_DRAWABLE (layer),
......@@ -2031,9 +2031,9 @@ gimp_layer_set_mode (GimpLayer *layer,
mode_node = gimp_drawable_get_mode_node (GIMP_DRAWABLE (layer));
gimp_gegl_mode_node_set (mode_node,
gimp_layer_get_visible_mode (layer),
layer->opacity, FALSE);
gimp_gegl_mode_node_set_mode (mode_node,
gimp_layer_get_visible_mode (layer),
FALSE);
}
gimp_drawable_update (GIMP_DRAWABLE (layer),
......
......@@ -139,10 +139,9 @@ gimp_gegl_add_buffer_source (GeglNode *parent,
}
void
gimp_gegl_mode_node_set (GeglNode *node,
GimpLayerModeEffects mode,
gdouble opacity,
gboolean linear)
gimp_gegl_mode_node_set_mode (GeglNode *node,
GimpLayerModeEffects mode,
gboolean linear)
{
const gchar *operation = "gimp:normal-mode";
......@@ -182,11 +181,20 @@ gimp_gegl_mode_node_set (GeglNode *node,
gegl_node_set (node,
"operation", operation,
"opacity", opacity,
"linear", linear,
NULL);
}
gimp_gegl_mode_node_set_opacity (GeglNode *node,
gdouble opacity)
{
g_return_if_fail (GEGL_IS_NODE (node));
gegl_node_set (node,
"opacity", opacity,
NULL);
}
void
gimp_gegl_node_set_matrix (GeglNode *node,
const GimpMatrix3 *matrix)
......
......@@ -32,10 +32,11 @@ GeglNode * gimp_gegl_add_buffer_source (GeglNode *parent,
gint offset_x,
gint offset_y);
void gimp_gegl_mode_node_set (GeglNode *node,
void gimp_gegl_mode_node_set_mode (GeglNode *node,
GimpLayerModeEffects mode,
gdouble opacity,
gboolean linear);
void gimp_gegl_mode_node_set_opacity (GeglNode *node,
gdouble opacity);
void gimp_gegl_node_set_matrix (GeglNode *node,
const GimpMatrix3 *matrix);
......
......@@ -131,10 +131,11 @@ gimp_applicator_new (GeglNode *parent)
"operation", "gimp:normal-mode",
NULL);
gimp_gegl_mode_node_set (applicator->mode_node,
applicator->paint_mode,
applicator->opacity,
FALSE);
gimp_gegl_mode_node_set_mode (applicator->mode_node,
applicator->paint_mode,
FALSE);
gimp_gegl_mode_node_set_opacity (applicator->mode_node,
applicator->opacity);
gegl_node_connect_to (applicator->input_node, "output",
applicator->mode_node, "input");
......@@ -376,14 +377,20 @@ gimp_applicator_set_mode (GimpApplicator *applicator,
gdouble opacity,
GimpLayerModeEffects paint_mode)
{
if (applicator->opacity != opacity ||
applicator->paint_mode != paint_mode)
if (applicator->opacity != opacity)
{
applicator->opacity = opacity;
gimp_gegl_mode_node_set_opacity (applicator->mode_node,
opacity);
}
if (applicator->paint_mode != paint_mode)
{
applicator->opacity = opacity;
applicator->paint_mode = paint_mode;
gimp_gegl_mode_node_set (applicator->mode_node,
paint_mode, opacity, FALSE);
gimp_gegl_mode_node_set_mode (applicator->mode_node,
paint_mode, FALSE);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment