app: change the maskPR in gimp_drawable_replace_buffer() to GeglBuffer
This commit is contained in:
@ -152,7 +152,8 @@ static void gimp_channel_replace_buffer (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
PixelRegion *maskPR,
|
||||
GeglBuffer *mask,
|
||||
const GeglRectangle *mask_region,
|
||||
gint x,
|
||||
gint y);
|
||||
static void gimp_channel_set_buffer (GimpDrawable *drawable,
|
||||
@ -835,7 +836,8 @@ gimp_channel_replace_buffer (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
PixelRegion *maskPR,
|
||||
GeglBuffer *mask,
|
||||
const GeglRectangle *mask_region,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
@ -845,7 +847,7 @@ gimp_channel_replace_buffer (GimpDrawable *drawable,
|
||||
buffer_region,
|
||||
push_undo, undo_desc,
|
||||
opacity,
|
||||
maskPR,
|
||||
mask, mask_region,
|
||||
x, y);
|
||||
|
||||
GIMP_CHANNEL (drawable)->bounds_known = FALSE;
|
||||
|
@ -252,7 +252,8 @@ gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
PixelRegion *maskPR,
|
||||
GeglBuffer *mask_buffer,
|
||||
const GeglRectangle *mask_buffer_region,
|
||||
gint dest_x,
|
||||
gint dest_y)
|
||||
{
|
||||
@ -261,6 +262,7 @@ gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
|
||||
GimpChannel *mask = gimp_image_get_mask (image);
|
||||
GimpTempBuf *temp_buf;
|
||||
PixelRegion src2PR;
|
||||
PixelRegion maskPR;
|
||||
gint x, y, width, height;
|
||||
gint offset_x, offset_y;
|
||||
PixelRegion src1PR, destPR;
|
||||
@ -283,6 +285,26 @@ gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
temp_buf = gimp_gegl_buffer_get_temp_buf (mask_buffer);
|
||||
|
||||
if (temp_buf)
|
||||
{
|
||||
pixel_region_init_temp_buf (&maskPR, temp_buf,
|
||||
mask_buffer_region->x,
|
||||
mask_buffer_region->y,
|
||||
mask_buffer_region->width,
|
||||
mask_buffer_region->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
pixel_region_init (&maskPR, gimp_gegl_buffer_get_tiles (mask_buffer),
|
||||
mask_buffer_region->x,
|
||||
mask_buffer_region->y,
|
||||
mask_buffer_region->width,
|
||||
mask_buffer_region->height,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* don't apply the mask to itself and don't apply an empty mask */
|
||||
if (GIMP_DRAWABLE (mask) == drawable || gimp_channel_is_empty (mask))
|
||||
mask = NULL;
|
||||
@ -366,7 +388,7 @@ gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
|
||||
|
||||
pixel_region_init_temp_buf (&tempPR, temp_buf, 0, 0, width, height);
|
||||
|
||||
apply_mask_to_region (&tempPR, maskPR, OPAQUE_OPACITY);
|
||||
apply_mask_to_region (&tempPR, &maskPR, OPAQUE_OPACITY);
|
||||
|
||||
pixel_region_init_temp_buf (&tempPR, temp_buf, 0, 0, width, height);
|
||||
|
||||
@ -379,7 +401,7 @@ gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
|
||||
}
|
||||
else
|
||||
{
|
||||
combine_regions_replace (&src1PR, &src2PR, &destPR, maskPR, NULL,
|
||||
combine_regions_replace (&src1PR, &src2PR, &destPR, &maskPR, NULL,
|
||||
opacity * 255.999,
|
||||
active_components,
|
||||
operation);
|
||||
|
@ -40,7 +40,8 @@ void gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
PixelRegion *maskPR,
|
||||
GeglBuffer *mask,
|
||||
const GeglRectangle *mask_region,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
|
@ -1207,19 +1207,21 @@ gimp_drawable_replace_buffer (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
PixelRegion *maskPR,
|
||||
GeglBuffer *mask,
|
||||
const GeglRectangle *mask_region,
|
||||
gint x,
|
||||
gint 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 (maskPR != NULL);
|
||||
g_return_if_fail (GEGL_IS_BUFFER (mask));
|
||||
|
||||
GIMP_DRAWABLE_GET_CLASS (drawable)->replace_buffer (drawable, buffer,
|
||||
buffer_region,
|
||||
push_undo, undo_desc,
|
||||
opacity, maskPR,
|
||||
opacity,
|
||||
mask, mask_region,
|
||||
x, y);
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,8 @@ struct _GimpDrawableClass
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
PixelRegion *maskPR,
|
||||
GeglBuffer *mask,
|
||||
const GeglRectangle *mask_region,
|
||||
gint x,
|
||||
gint y);
|
||||
void (* project_region) (GimpDrawable *drawable,
|
||||
@ -144,28 +145,29 @@ void gimp_drawable_convert_type (GimpDrawable *drawable,
|
||||
GimpImageBaseType new_base_type,
|
||||
gboolean push_undo);
|
||||
|
||||
void gimp_drawable_apply_buffer (GimpDrawable *drawable,
|
||||
GeglBuffer *buffer,
|
||||
void gimp_drawable_apply_buffer (GimpDrawable *drawable,
|
||||
GeglBuffer *buffer,
|
||||
const GeglRectangle *buffer_rect,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
GimpLayerModeEffects mode,
|
||||
GeglBuffer *base_buffer,
|
||||
gint base_x,
|
||||
gint base_y,
|
||||
GeglBuffer *dest_buffer,
|
||||
gint dest_x,
|
||||
gint dest_y);
|
||||
void gimp_drawable_replace_buffer (GimpDrawable *drawable,
|
||||
GeglBuffer *buffer,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
GimpLayerModeEffects mode,
|
||||
GeglBuffer *base_buffer,
|
||||
gint base_x,
|
||||
gint base_y,
|
||||
GeglBuffer *dest_buffer,
|
||||
gint dest_x,
|
||||
gint dest_y);
|
||||
void gimp_drawable_replace_buffer (GimpDrawable *drawable,
|
||||
GeglBuffer *buffer,
|
||||
const GeglRectangle *buffer_region,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
gint y);
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
GeglBuffer *mask,
|
||||
const GeglRectangle *mask_region,
|
||||
gint x,
|
||||
gint y);
|
||||
void gimp_drawable_project_region (GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
|
@ -795,8 +795,8 @@ gimp_paint_core_replace (GimpPaintCore *core,
|
||||
gdouble image_opacity,
|
||||
GimpPaintApplicationMode mode)
|
||||
{
|
||||
PixelRegion paint_maskPR;
|
||||
gint width, height;
|
||||
GeglRectangle mask_rect;
|
||||
gint width, height;
|
||||
|
||||
if (! gimp_drawable_has_alpha (drawable))
|
||||
{
|
||||
@ -823,22 +823,15 @@ gimp_paint_core_replace (GimpPaintCore *core,
|
||||
paint_opacity);
|
||||
|
||||
/* initialize the maskPR from the canvas buffer */
|
||||
pixel_region_init (&paint_maskPR,
|
||||
gimp_gegl_buffer_get_tiles (core->canvas_buffer),
|
||||
core->paint_buffer_x,
|
||||
core->paint_buffer_y,
|
||||
width, height,
|
||||
FALSE);
|
||||
paint_mask = core->canvas_buffer;
|
||||
|
||||
mask_rect = *GEGL_RECTANGLE (core->paint_buffer_x,
|
||||
core->paint_buffer_y,
|
||||
width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The mask is just the paint_mask */
|
||||
pixel_region_init_temp_buf (&paint_maskPR,
|
||||
gimp_gegl_buffer_get_temp_buf (paint_mask),
|
||||
paint_mask_rect->x,
|
||||
paint_mask_rect->y,
|
||||
paint_mask_rect->width,
|
||||
paint_mask_rect->height);
|
||||
mask_rect = *paint_mask_rect;
|
||||
}
|
||||
|
||||
/* apply the paint area to the image */
|
||||
@ -846,7 +839,7 @@ gimp_paint_core_replace (GimpPaintCore *core,
|
||||
GEGL_RECTANGLE (0, 0, width, height),
|
||||
FALSE, NULL,
|
||||
image_opacity,
|
||||
&paint_maskPR,
|
||||
paint_mask, &mask_rect,
|
||||
core->paint_buffer_x,
|
||||
core->paint_buffer_y);
|
||||
|
||||
|
Reference in New Issue
Block a user