app: add gimp_drawable_get_linear() which currently always returns FALSE

Add "linear" parameter to GimpApplicator. Pass the drawable's "linear"
to the applicator, and to all calls to gimp_gegl_mode_node_set_mode(),
instead of hardcoding FALSE everywhere.
This commit is contained in:
Michael Natterer 2013-04-27 08:41:06 +02:00
parent eafcc4801c
commit 9c93df2d4b
9 changed files with 39 additions and 12 deletions

View File

@ -117,7 +117,7 @@ gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
}
}
applicator = gimp_applicator_new (NULL);
applicator = gimp_applicator_new (NULL, gimp_drawable_get_linear (drawable));
if (mask)
{

View File

@ -924,6 +924,7 @@ gimp_drawable_sync_fs_filter (GimpDrawable *drawable,
{
GeglNode *node;
GeglNode *fs_source;
gboolean linear;
private->fs_filter = gimp_filter_new ("Floating Selection");
gimp_viewable_set_stock_id (GIMP_VIEWABLE (private->fs_filter),
@ -932,6 +933,7 @@ gimp_drawable_sync_fs_filter (GimpDrawable *drawable,
node = gimp_filter_get_node (private->fs_filter);
fs_source = gimp_drawable_get_source_node (GIMP_DRAWABLE (fs));
linear = gimp_drawable_get_linear (GIMP_DRAWABLE (fs));
/* rip the fs' source node out of its graph */
if (fs->layer_offset_node)
@ -943,7 +945,7 @@ gimp_drawable_sync_fs_filter (GimpDrawable *drawable,
gegl_node_add_child (node, fs_source);
private->fs_applicator = gimp_applicator_new (node);
private->fs_applicator = gimp_applicator_new (node, linear);
private->fs_crop_node =
gegl_node_new_child (node,
@ -1591,6 +1593,14 @@ gimp_drawable_get_format_without_alpha (const GimpDrawable *drawable)
FALSE);
}
gboolean
gimp_drawable_get_linear (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return FALSE;
}
gboolean
gimp_drawable_has_alpha (const GimpDrawable *drawable)
{

View File

@ -205,6 +205,7 @@ const Babl * gimp_drawable_get_format_with_alpha
(const GimpDrawable *drawable);
const Babl * gimp_drawable_get_format_without_alpha
(const GimpDrawable *drawable);
gboolean gimp_drawable_get_linear (const GimpDrawable *drawable);
gboolean gimp_drawable_has_alpha (const GimpDrawable *drawable);
GimpImageBaseType gimp_drawable_get_base_type (const GimpDrawable *drawable);
GimpPrecision gimp_drawable_get_precision (const GimpDrawable *drawable);

View File

@ -600,7 +600,9 @@ gimp_image_merge_layers (GimpImage *image,
merge_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (merge_layer));
layer_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
applicator = gimp_applicator_new (NULL);
applicator =
gimp_applicator_new (NULL,
gimp_drawable_get_linear (GIMP_DRAWABLE (layer)));
if (gimp_layer_get_mask (layer) &&
gimp_layer_get_apply_mask (layer))

View File

@ -291,7 +291,9 @@ gimp_image_map_apply (GimpImageMap *image_map)
gegl_node_add_child (filter_node, image_map->operation);
image_map->applicator = gimp_applicator_new (filter_node);
image_map->applicator =
gimp_applicator_new (filter_node,
gimp_drawable_get_linear (image_map->drawable));
gimp_filter_set_applicator (image_map->filter,
image_map->applicator);

View File

@ -491,12 +491,14 @@ gimp_layer_notify (GObject *object,
{
GimpLayer *layer = GIMP_LAYER (object);
GeglNode *mode_node;
gboolean linear;
mode_node = gimp_drawable_get_mode_node (GIMP_DRAWABLE (layer));
linear = gimp_drawable_get_linear (GIMP_DRAWABLE (layer));
gimp_gegl_mode_node_set_mode (mode_node,
gimp_layer_get_visible_mode (layer),
FALSE);
linear);
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
@ -570,6 +572,7 @@ gimp_layer_get_node (GimpFilter *filter)
GeglNode *node;
GeglNode *source;
GeglNode *mode_node;
gboolean linear;
gboolean source_node_hijacked = FALSE;
node = GIMP_FILTER_CLASS (parent_class)->get_node (filter);
@ -593,10 +596,11 @@ gimp_layer_get_node (GimpFilter *filter)
* the layer and its mask
*/
mode_node = gimp_drawable_get_mode_node (drawable);
linear = gimp_drawable_get_linear (drawable);
gimp_gegl_mode_node_set_mode (mode_node,
gimp_layer_get_visible_mode (layer),
FALSE);
linear);
gimp_gegl_mode_node_set_opacity (mode_node,
layer->opacity);
@ -2028,12 +2032,14 @@ gimp_layer_set_mode (GimpLayer *layer,
if (gimp_filter_peek_node (GIMP_FILTER (layer)))
{
GeglNode *mode_node;
gboolean linear;
mode_node = gimp_drawable_get_mode_node (GIMP_DRAWABLE (layer));
linear = gimp_drawable_get_linear (GIMP_DRAWABLE (layer));
gimp_gegl_mode_node_set_mode (mode_node,
gimp_layer_get_visible_mode (layer),
FALSE);
linear);
}
gimp_drawable_update (GIMP_DRAWABLE (layer),

View File

@ -105,7 +105,8 @@ gimp_applicator_get_property (GObject *object,
}
GimpApplicator *
gimp_applicator_new (GeglNode *parent)
gimp_applicator_new (GeglNode *parent,
gboolean linear)
{
GimpApplicator *applicator;
@ -113,6 +114,8 @@ gimp_applicator_new (GeglNode *parent)
applicator = g_object_new (GIMP_TYPE_APPLICATOR, NULL);
applicator->linear = linear;
if (parent)
applicator->node = g_object_ref (parent);
else
@ -133,7 +136,7 @@ gimp_applicator_new (GeglNode *parent)
gimp_gegl_mode_node_set_mode (applicator->mode_node,
applicator->paint_mode,
FALSE);
applicator->linear);
gimp_gegl_mode_node_set_opacity (applicator->mode_node,
applicator->opacity);
@ -390,7 +393,7 @@ gimp_applicator_set_mode (GimpApplicator *applicator,
applicator->paint_mode = paint_mode;
gimp_gegl_mode_node_set_mode (applicator->mode_node,
paint_mode, FALSE);
paint_mode, applicator->linear);
}
}

View File

@ -50,6 +50,7 @@ struct _GimpApplicator
gdouble opacity;
GimpLayerModeEffects paint_mode;
gboolean linear;
GeglNode *mode_node;
GimpComponentMask affect;
@ -77,7 +78,8 @@ struct _GimpApplicatorClass
GType gimp_applicator_get_type (void) G_GNUC_CONST;
GimpApplicator * gimp_applicator_new (GeglNode *parent);
GimpApplicator * gimp_applicator_new (GeglNode *parent,
gboolean linear);
void gimp_applicator_set_src_buffer (GimpApplicator *applicator,
GeglBuffer *dest_buffer);

View File

@ -405,7 +405,8 @@ gimp_paint_core_start (GimpPaintCore *core,
if (GIMP_DRAWABLE (mask) == drawable || gimp_channel_is_empty (mask))
mask = NULL;
core->applicator = gimp_applicator_new (NULL);
core->applicator = gimp_applicator_new (NULL,
gimp_drawable_get_linear (drawable));
if (mask)
{