app: use gegl_buffer_copy() in gimp_drawable_real_replace_buffer()
This commit is contained in:
@ -38,6 +38,7 @@
|
|||||||
#include "gimpdrawableundo.h"
|
#include "gimpdrawableundo.h"
|
||||||
#include "gimpimage.h"
|
#include "gimpimage.h"
|
||||||
#include "gimpimage-undo.h"
|
#include "gimpimage-undo.h"
|
||||||
|
#include "gimptempbuf.h"
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -343,35 +344,38 @@ gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
|
|||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
PixelRegion mask2PR, tempPR;
|
PixelRegion tempPR;
|
||||||
guchar *temp_data;
|
GimpTempBuf *temp_buf;
|
||||||
|
GeglBuffer *src_buffer;
|
||||||
|
GeglBuffer *dest_buffer;
|
||||||
|
|
||||||
pixel_region_init (&mask2PR,
|
src_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
|
||||||
gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
|
|
||||||
x + offset_x, y + offset_y, width, height,
|
|
||||||
FALSE);
|
|
||||||
|
|
||||||
temp_data = g_malloc (width * height);
|
temp_buf = gimp_temp_buf_new (width, height,
|
||||||
|
gegl_buffer_get_format (src_buffer));
|
||||||
|
|
||||||
pixel_region_init_data (&tempPR, temp_data, 1, width,
|
dest_buffer = gimp_temp_buf_create_buffer (temp_buf);
|
||||||
0, 0, width, height);
|
|
||||||
|
|
||||||
copy_region (&mask2PR, &tempPR);
|
gegl_buffer_copy (src_buffer,
|
||||||
|
GEGL_RECTANGLE (x + offset_x, y + offset_y,
|
||||||
|
width, height),
|
||||||
|
dest_buffer,
|
||||||
|
GEGL_RECTANGLE (0, 0, 0, 0));
|
||||||
|
|
||||||
pixel_region_init_data (&tempPR, temp_data, 1, width,
|
g_object_unref (dest_buffer);
|
||||||
0, 0, width, height);
|
|
||||||
|
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_data (&tempPR, temp_data, 1, width,
|
pixel_region_init_temp_buf (&tempPR, temp_buf, 0, 0, width, height);
|
||||||
0, 0, width, height);
|
|
||||||
|
|
||||||
combine_regions_replace (&src1PR, &src2PR, &destPR, &tempPR, NULL,
|
combine_regions_replace (&src1PR, &src2PR, &destPR, &tempPR, NULL,
|
||||||
opacity * 255.999,
|
opacity * 255.999,
|
||||||
active_components,
|
active_components,
|
||||||
operation);
|
operation);
|
||||||
|
|
||||||
g_free (temp_data);
|
gimp_temp_buf_unref (temp_buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user