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

app: remove the !use_gegl case from gimp_drawable_apply_buffer()

and its last three parameters because they were only used for legacy
floating selection projection.
parent d294cfb8
......@@ -501,7 +501,6 @@ gimp_edit_fill_full (GimpImage *image,
GEGL_RECTANGLE (0, 0, width, height),
TRUE, undo_desc,
opacity, paint_mode,
NULL, x, y,
NULL, x, y);
g_object_unref (dest_buffer);
......@@ -542,7 +541,6 @@ gimp_edit_fade (GimpImage *image,
gimp_object_get_name (undo),
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
NULL, undo->x, undo->y,
NULL, undo->x, undo->y);
g_object_unref (buffer);
......
......@@ -144,10 +144,7 @@ static void gimp_channel_apply_buffer (GimpDrawable *drawable,
GimpLayerModeEffects mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y,
GeglBuffer *dest_buffer,
gint dest_x,
gint dest_y);
gint base_y);
static void gimp_channel_replace_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
......@@ -821,10 +818,7 @@ gimp_channel_apply_buffer (GimpDrawable *drawable,
GimpLayerModeEffects mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y,
GeglBuffer *dest_buffer,
gint dest_x,
gint dest_y)
gint base_y)
{
gimp_drawable_invalidate_boundary (drawable);
......@@ -833,9 +827,7 @@ gimp_channel_apply_buffer (GimpDrawable *drawable,
push_undo, undo_desc,
opacity, mode,
base_buffer,
base_x, base_y,
dest_buffer,
dest_x, dest_y);
base_x, base_y);
GIMP_CHANNEL (drawable)->bounds_known = FALSE;
}
......
......@@ -207,7 +207,6 @@ gimp_drawable_blend (GimpDrawable *drawable,
GEGL_RECTANGLE (0, 0, width, height),
TRUE, C_("undo-type", "Blend"),
opacity, paint_mode,
NULL, x, y,
NULL, x, y);
/* update the image */
......
......@@ -263,7 +263,6 @@ gimp_drawable_bucket_fill_internal (GimpDrawable *drawable,
GEGL_RECTANGLE (0, 0, x2 - x1, y2 - y1),
TRUE, C_("undo-type", "Bucket Fill"),
opacity, paint_mode,
NULL, x1, y1,
NULL, x1, y1);
g_object_unref (buffer);
......
......@@ -23,10 +23,6 @@
#include "core-types.h"
#include "base/pixel-region.h"
#include "paint-funcs/paint-funcs.h"
#include "gegl/gimp-babl-compat.h"
#include "gegl/gimp-gegl-loops.h"
#include "gegl/gimp-gegl-nodes.h"
......@@ -52,17 +48,16 @@ gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
GimpLayerModeEffects mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y,
GeglBuffer *dest_buffer,
gint dest_x,
gint dest_y)
gint base_y)
{
GimpItem *item = GIMP_ITEM (drawable);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GeglBuffer *mask_buffer = NULL;
gint x, y, width, height;
gint offset_x, offset_y;
GimpItem *item = GIMP_ITEM (drawable);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GeglBuffer *mask_buffer = NULL;
GeglNode *apply;
GimpComponentMask affect;
gint x, y, width, height;
gint offset_x, offset_y;
/* don't apply the mask to itself and don't apply an empty mask */
if (GIMP_DRAWABLE (mask) == drawable || gimp_channel_is_empty (mask))
......@@ -127,123 +122,28 @@ gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
if (mask)
mask_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
if (gimp_use_gegl (image->gimp) && ! dest_buffer)
{
GeglNode *apply;
GimpComponentMask affect;
dest_buffer = gimp_drawable_get_buffer (drawable);
affect = gimp_drawable_get_active_mask (drawable);
apply = gimp_gegl_create_apply_buffer_node (buffer,
base_x - buffer_region->x,
base_y - buffer_region->y,
0,
0,
0,
0,
mask_buffer,
-offset_x,
-offset_y,
opacity,
mode,
affect);
gimp_apply_operation (base_buffer, NULL, NULL,
apply,
dest_buffer,
GEGL_RECTANGLE (x, y, width, height));
g_object_unref (apply);
}
else
{
PixelRegion src1PR, src2PR, destPR;
CombinationMode operation;
gboolean active_components[MAX_CHANNELS];
if (gimp_gegl_buffer_get_temp_buf (buffer))
{
pixel_region_init_temp_buf (&src2PR,
gimp_gegl_buffer_get_temp_buf (buffer),
buffer_region->x, buffer_region->y,
buffer_region->width, buffer_region->height);
}
else
{
pixel_region_init (&src2PR, gimp_gegl_buffer_get_tiles (buffer),
buffer_region->x, buffer_region->y,
buffer_region->width, buffer_region->height,
FALSE);
}
/* configure the active channel array */
gimp_drawable_get_active_components (drawable, active_components);
/* determine what sort of operation is being attempted and
* if it's actually legal...
*/
operation = gimp_image_get_combination_mode (gimp_babl_format_get_image_type (gimp_drawable_get_format (drawable)),
src2PR.bytes);
if (operation == -1)
{
g_warning ("%s: illegal parameters.", G_STRFUNC);
return;
}
/* configure the pixel regions */
pixel_region_init (&src1PR, gimp_gegl_buffer_get_tiles (base_buffer),
x, y, width, height,
FALSE);
pixel_region_resize (&src2PR,
src2PR.x + (x - base_x), src2PR.y + (y - base_y),
width, height);
if (dest_buffer)
{
pixel_region_init (&destPR, gimp_gegl_buffer_get_tiles (dest_buffer),
dest_x, dest_y,
buffer_region->width, buffer_region->height,
TRUE);
}
else
{
dest_buffer = gimp_drawable_get_buffer (drawable);
pixel_region_init (&destPR, gimp_gegl_buffer_get_tiles (dest_buffer),
x, y, width, height,
TRUE);
}
if (mask_buffer)
{
PixelRegion maskPR;
pixel_region_init (&maskPR,
gimp_gegl_buffer_get_tiles (mask_buffer),
x + offset_x,
y + offset_y,
width, height,
FALSE);
combine_regions (&src1PR, &src2PR, &destPR, &maskPR, NULL,
opacity * 255.999,
mode,
active_components,
operation);
}
else
{
combine_regions (&src1PR, &src2PR, &destPR, NULL, NULL,
opacity * 255.999,
mode,
active_components,
operation);
}
}
affect = gimp_drawable_get_active_mask (drawable);
apply = gimp_gegl_create_apply_buffer_node (buffer,
base_x - buffer_region->x,
base_y - buffer_region->y,
0,
0,
0,
0,
mask_buffer,
-offset_x,
-offset_y,
opacity,
mode,
affect);
gimp_apply_operation (base_buffer, NULL, NULL,
apply,
gimp_drawable_get_buffer (drawable),
GEGL_RECTANGLE (x, y, width, height));
g_object_unref (apply);
}
/* Similar to gimp_drawable_apply_region but works in "replace" mode (i.e.
......
......@@ -30,10 +30,7 @@ void gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
GimpLayerModeEffects mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y,
GeglBuffer *dest_buffer,
gint dest_x,
gint dest_y);
gint base_y);
void gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
......
......@@ -103,7 +103,6 @@ gimp_drawable_merge_shadow_buffer (GimpDrawable *drawable,
GEGL_RECTANGLE (x, y, width, height),
push_undo, undo_desc,
GIMP_OPACITY_OPAQUE, GIMP_REPLACE_MODE,
NULL, x, y,
NULL, x, y);
g_object_unref (buffer);
......
......@@ -395,7 +395,6 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
push_undo, C_("undo-type", "Render Stroke"),
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
NULL, x, y,
NULL, x, y);
g_object_unref (base_buffer);
......
......@@ -1188,26 +1188,20 @@ gimp_drawable_apply_buffer (GimpDrawable *drawable,
GimpLayerModeEffects mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y,
GeglBuffer *dest_buffer,
gint dest_x,
gint dest_y)
gint base_y)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (GEGL_IS_BUFFER (buffer));
g_return_if_fail (buffer_region != NULL);
g_return_if_fail (base_buffer == NULL || GEGL_IS_BUFFER (base_buffer));
g_return_if_fail (dest_buffer == NULL || GEGL_IS_BUFFER (dest_buffer));
GIMP_DRAWABLE_GET_CLASS (drawable)->apply_buffer (drawable, buffer,
buffer_region,
push_undo, undo_desc,
opacity, mode,
base_buffer,
base_x, base_y,
dest_buffer,
dest_x, dest_y);
base_x, base_y);
}
void
......
......@@ -74,10 +74,7 @@ struct _GimpDrawableClass
GimpLayerModeEffects mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y,
GeglBuffer *dest_buffer,
gint dest_x,
gint dest_y);
gint base_y);
void (* replace_buffer) (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
......@@ -151,10 +148,7 @@ void gimp_drawable_apply_buffer (GimpDrawable *drawable,
GimpLayerModeEffects mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y,
GeglBuffer *dest_buffer,
gint dest_x,
gint dest_y);
gint base_y);
void gimp_drawable_replace_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
......
......@@ -680,7 +680,6 @@ gimp_image_map_data_written (GObject *operation,
extent->width, extent->height),
FALSE, NULL,
GIMP_OPACITY_OPAQUE, GIMP_REPLACE_MODE,
NULL, extent->x, extent->y,
NULL, extent->x, extent->y);
gimp_drawable_update (image_map->drawable,
......
......@@ -337,9 +337,6 @@ floating_sel_composite (GimpLayer *layer)
gimp_layer_get_mode (layer),
NULL,
combine_x - dr_off_x,
combine_y - dr_off_y,
NULL,
combine_x - dr_off_x,
combine_y - dr_off_y);
/* restore lock alpha */
......
......@@ -760,9 +760,6 @@ gimp_paint_core_paste (GimpPaintCore *core,
image_opacity, paint_mode,
base_buffer, /* specify an alternative src1 */
core->paint_buffer_x,
core->paint_buffer_y,
NULL,
core->paint_buffer_x,
core->paint_buffer_y);
/* Update the undo extents */
......
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