Commit 0bcae125 authored by Michael Natterer's avatar Michael Natterer 😴

app: merge gimp_drawable_get_read_buffer() and get_write_buffer()

into get_buffer(). The loss of zero copy will be compensated soon.
parent f5bfdde3
......@@ -60,7 +60,7 @@ gimp_channel_combine_rect (GimpChannel *mask,
rect.width = w;
rect.height = h;
gegl_buffer_set_color (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (mask)),
gegl_buffer_set_color (gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
&rect, color);
g_object_unref (color);
......@@ -244,7 +244,7 @@ gimp_channel_combine_ellipse_rect (GimpChannel *mask,
rect.width = width;
rect.height = height;
buffer = gimp_drawable_get_write_buffer (GIMP_DRAWABLE (mask));
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
iter = gegl_buffer_iterator_new (buffer, &rect, babl_format ("Y u8"),
GEGL_BUFFER_READWRITE);
......@@ -464,8 +464,8 @@ gimp_channel_combine_mask (GimpChannel *mask,
&x, &y, &w, &h))
return;
mask_buffer = gimp_drawable_get_write_buffer (GIMP_DRAWABLE (mask));
add_on_buffer = gimp_drawable_get_read_buffer (GIMP_DRAWABLE (add_on));
mask_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
add_on_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (add_on));
rect.x = x;
rect.y = y;
......
......@@ -238,7 +238,7 @@ gimp_channel_select_scan_convert (GimpChannel *channel,
gimp_item_get_height (item));
gimp_scan_convert_render (scan_convert,
gimp_drawable_get_write_buffer (GIMP_DRAWABLE (add_on)),
gimp_drawable_get_buffer (GIMP_DRAWABLE (add_on)),
offset_x, offset_y, antialias);
if (feather)
......
......@@ -546,7 +546,7 @@ gimp_channel_translate (GimpItem *item,
*/
tmp_mask = gimp_channel_new_mask (gimp_item_get_image (item),
width, height);
tmp_buffer = gimp_drawable_get_write_buffer (GIMP_DRAWABLE (tmp_mask));
tmp_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (tmp_mask));
src_rect.x = x1 - off_x;
src_rect.y = y1 - off_y;
......@@ -556,14 +556,14 @@ gimp_channel_translate (GimpItem *item,
dest_rect.x = 0;
dest_rect.y = 0;
gegl_buffer_copy (gimp_drawable_get_read_buffer (GIMP_DRAWABLE (channel)),
gegl_buffer_copy (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
&src_rect,
tmp_buffer,
&dest_rect);
}
/* clear the mask */
gegl_buffer_clear (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (channel)),
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL);
if (width != 0 && height != 0)
......@@ -574,7 +574,7 @@ gimp_channel_translate (GimpItem *item,
gegl_buffer_copy (tmp_buffer,
NULL,
gimp_drawable_get_write_buffer (GIMP_DRAWABLE (channel)),
gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
&dest_rect);
/* free the temporary mask */
......@@ -992,7 +992,7 @@ gimp_channel_get_opacity_at (GimpPickable *pickable,
}
}
gegl_buffer_sample (gimp_drawable_get_read_buffer (GIMP_DRAWABLE (channel)),
gegl_buffer_sample (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
x, y, NULL, &value, babl_format ("Y u8"),
GEGL_SAMPLER_NEAREST);
......@@ -1023,7 +1023,7 @@ gimp_channel_real_boundary (GimpChannel *channel,
GeglBuffer *buffer;
GeglRectangle rect = { x3, y3, x4 - x3, y4 - y3 };
buffer = gimp_drawable_get_read_buffer (GIMP_DRAWABLE (channel));
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
channel->segs_out = gimp_boundary_find (buffer, &rect,
GIMP_BOUNDARY_IGNORE_BOUNDS,
......@@ -1097,7 +1097,7 @@ gimp_channel_real_bounds (GimpChannel *channel,
tx2 = 0;
ty2 = 0;
buffer = gimp_drawable_get_read_buffer (GIMP_DRAWABLE (channel));
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
iter = gegl_buffer_iterator_new (buffer, NULL, babl_format ("Y u8"),
GEGL_BUFFER_READ);
......@@ -1195,7 +1195,7 @@ gimp_channel_real_is_empty (GimpChannel *channel)
if (channel->bounds_known)
return channel->empty;
buffer = gimp_drawable_get_read_buffer (GIMP_DRAWABLE (channel));
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
iter = gegl_buffer_iterator_new (buffer, NULL, babl_format ("Y u8"),
GEGL_BUFFER_READ);
......@@ -1263,7 +1263,7 @@ gimp_channel_real_feather (GimpChannel *channel,
gimp_drawable_apply_operation_to_buffer (drawable, NULL, NULL,
node, TRUE,
gimp_drawable_get_write_buffer (drawable));
gimp_drawable_get_buffer (drawable));
g_object_unref (node);
......@@ -1294,7 +1294,7 @@ gimp_channel_real_sharpen (GimpChannel *channel,
gimp_drawable_apply_operation_to_buffer (drawable, NULL, NULL,
node, TRUE,
gimp_drawable_get_write_buffer (drawable));
gimp_drawable_get_buffer (drawable));
g_object_unref (node);
......@@ -1329,12 +1329,12 @@ gimp_channel_real_clear (GimpChannel *channel,
channel->x2 - channel->x1,
channel->y2 - channel->y1 };
gegl_buffer_clear (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (channel)),
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
&rect);
}
else
{
gegl_buffer_clear (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (channel)),
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL);
}
......@@ -1365,7 +1365,7 @@ gimp_channel_real_all (GimpChannel *channel,
/* clear the channel */
color = gegl_color_new ("#fff");
gegl_buffer_set_color (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (channel)),
gegl_buffer_set_color (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL, color);
g_object_unref (color);
......@@ -1406,7 +1406,7 @@ gimp_channel_real_invert (GimpChannel *channel,
gimp_drawable_apply_operation_to_buffer (drawable, NULL, NULL,
node, TRUE,
gimp_drawable_get_write_buffer (drawable));
gimp_drawable_get_buffer (drawable));
g_object_unref (node);
......@@ -1668,7 +1668,7 @@ gimp_channel_new_from_alpha (GimpImage *image,
babl_format ("A u8"),
TRUE);
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), NULL,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
g_object_unref (dest_buffer);
......
......@@ -607,7 +607,7 @@ gradient_precalc_shapeburst (GimpImage *image,
src_rect.height = height;
/* copy the mask to the temp mask */
gegl_buffer_copy (gimp_drawable_get_read_buffer (GIMP_DRAWABLE (mask)),
gegl_buffer_copy (gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
&src_rect,
temp_buffer, &dest_rect);
}
......@@ -629,7 +629,7 @@ gradient_precalc_shapeburst (GimpImage *image,
src_rect.height = PR->h;
/* extract the aplha into the temp mask */
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), &src_rect,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
temp_buffer, &dest_rect);
}
else
......
......@@ -192,7 +192,7 @@ gimp_drawable_bucket_fill_internal (GimpDrawable *drawable,
-off_x, -off_y);
}
mask_buffer = gimp_drawable_get_read_buffer (GIMP_DRAWABLE (mask));
mask_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
gimp_channel_bounds (mask, &x1, &y1, &x2, &y2);
......
......@@ -57,7 +57,7 @@ gimp_drawable_convert_rgb (GimpDrawable *drawable,
dest_buffer = gimp_tile_manager_create_buffer (tiles, NULL, TRUE);
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), NULL,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
g_object_unref (dest_buffer);
......@@ -89,7 +89,7 @@ gimp_drawable_convert_grayscale (GimpDrawable *drawable,
dest_buffer = gimp_tile_manager_create_buffer (tiles, NULL, TRUE);
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), NULL,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
g_object_unref (dest_buffer);
......@@ -132,7 +132,7 @@ gimp_drawable_convert_indexed (GimpDrawable *drawable,
dest_buffer = gimp_tile_manager_create_buffer (tiles, format, TRUE);
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), NULL,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
g_object_unref (dest_buffer);
......
......@@ -88,7 +88,7 @@ gimp_drawable_offset (GimpDrawable *drawable,
new_tiles = tile_manager_new (width, height, gimp_drawable_bytes (drawable));
src_buffer = gimp_drawable_get_read_buffer (drawable);
src_buffer = gimp_drawable_get_buffer (drawable);
dest_buffer = gimp_tile_manager_create_buffer (new_tiles,
gimp_drawable_get_format (drawable),
TRUE);
......
......@@ -66,7 +66,7 @@ gimp_drawable_apply_operation (GimpDrawable *drawable,
gimp_drawable_get_format (drawable),
TRUE);
gimp_apply_operation (gimp_drawable_get_read_buffer (drawable),
gimp_apply_operation (gimp_drawable_get_buffer (drawable),
progress, undo_desc,
operation, linear,
dest_buffer, &rect);
......@@ -128,7 +128,7 @@ gimp_drawable_apply_operation_to_buffer (GimpDrawable *drawable,
g_return_if_fail (GEGL_IS_NODE (operation));
g_return_if_fail (GEGL_IS_BUFFER (dest_buffer));
gimp_apply_operation (gimp_drawable_get_read_buffer (drawable),
gimp_apply_operation (gimp_drawable_get_buffer (drawable),
progress, undo_desc,
operation, linear,
dest_buffer, NULL);
......
......@@ -25,8 +25,7 @@ struct _GimpDrawablePrivate
TileManager *tiles; /* tiles for drawable data */
TileManager *shadow; /* shadow buffer tiles */
GeglBuffer *read_buffer;
GeglBuffer *write_buffer;
GeglBuffer *buffer;
GeglNode *source_node;
GeglNode *tile_source_node;
......
......@@ -274,7 +274,7 @@ gimp_drawable_pickable_iface_init (GimpPickableInterface *iface)
iface->get_format_with_alpha = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_format_with_alpha;
iface->get_image_type = (GimpImageType (*) (GimpPickable *pickable)) gimp_drawable_type;
iface->get_bytes = (gint (*) (GimpPickable *pickable)) gimp_drawable_bytes;
iface->get_buffer = (GeglBuffer * (*) (GimpPickable *pickable)) gimp_drawable_get_read_buffer;
iface->get_buffer = (GeglBuffer * (*) (GimpPickable *pickable)) gimp_drawable_get_buffer;
iface->get_tiles = (TileManager * (*) (GimpPickable *pickable)) gimp_drawable_get_tiles;
iface->get_pixel_at = gimp_drawable_get_pixel_at;
}
......@@ -303,16 +303,10 @@ gimp_drawable_finalize (GObject *object)
gimp_drawable_free_shadow_tiles (drawable);
if (drawable->private->read_buffer)
if (drawable->private->buffer)
{
g_object_unref (drawable->private->read_buffer);
drawable->private->read_buffer = NULL;
}
if (drawable->private->write_buffer)
{
g_object_unref (drawable->private->write_buffer);
drawable->private->write_buffer = NULL;
g_object_unref (drawable->private->buffer);
drawable->private->buffer = NULL;
}
if (drawable->private->source_node)
......@@ -447,8 +441,8 @@ gimp_drawable_duplicate (GimpItem *item,
gimp_item_get_height (new_item),
gimp_drawable_bytes (new_drawable));
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), NULL,
gimp_drawable_get_write_buffer (new_drawable), NULL);
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
gimp_drawable_get_buffer (new_drawable), NULL);
}
return new_item;
......@@ -620,7 +614,7 @@ gimp_drawable_resize (GimpItem *item,
dest_rect.x = copy_x - new_offset_x;
dest_rect.y = copy_y - new_offset_y;
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), &src_rect,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
dest_buffer, &dest_rect);
}
......@@ -746,7 +740,7 @@ gimp_drawable_get_pixel_at (GimpPickable *pickable,
y < 0 || y >= gimp_item_get_height (GIMP_ITEM (drawable)))
return FALSE;
gegl_buffer_sample (gimp_drawable_get_read_buffer (drawable),
gegl_buffer_sample (gimp_drawable_get_buffer (drawable),
x, y, NULL, pixel,
gimp_drawable_get_format (drawable),
GEGL_SAMPLER_NEAREST);
......@@ -858,16 +852,10 @@ gimp_drawable_real_set_tiles (GimpDrawable *drawable,
drawable->private->tiles = tiles;
drawable->private->type = type;
if (drawable->private->read_buffer)
if (drawable->private->buffer)
{
g_object_unref (drawable->private->read_buffer);
drawable->private->read_buffer = NULL;
}
if (drawable->private->write_buffer)
{
g_object_unref (drawable->private->write_buffer);
drawable->private->write_buffer = NULL;
g_object_unref (drawable->private->buffer);
drawable->private->buffer = NULL;
}
gimp_item_set_offset (item, offset_x, offset_y);
......@@ -880,7 +868,7 @@ gimp_drawable_real_set_tiles (GimpDrawable *drawable,
if (drawable->private->tile_source_node)
gegl_node_set (drawable->private->tile_source_node,
"buffer", gimp_drawable_get_read_buffer (drawable),
"buffer", gimp_drawable_get_buffer (drawable),
NULL);
}
......@@ -950,7 +938,7 @@ gimp_drawable_real_push_undo (GimpDrawable *drawable,
src_rect.width = width;
src_rect.height = height;
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), &src_rect,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
dest_buffer, &dest_rect);
g_object_unref (dest_buffer);
......@@ -1273,11 +1261,11 @@ gimp_drawable_update (GimpDrawable *drawable,
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (drawable->private->write_buffer)
gegl_buffer_flush (drawable->private->write_buffer);
if (drawable->private->read_buffer)
gimp_gegl_buffer_refetch_tiles (drawable->private->read_buffer);
if (drawable->private->buffer)
{
gegl_buffer_flush (drawable->private->buffer);
gimp_gegl_buffer_refetch_tiles (drawable->private->buffer);
}
g_signal_emit (drawable, gimp_drawable_signals[UPDATE], 0,
x, y, width, height);
......@@ -1526,34 +1514,22 @@ gimp_drawable_create_buffer (GimpDrawable *drawable,
}
GeglBuffer *
gimp_drawable_get_read_buffer (GimpDrawable *drawable)
gimp_drawable_get_buffer (GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
if (drawable->private->write_buffer)
gegl_buffer_flush (drawable->private->write_buffer);
if (! drawable->private->read_buffer)
drawable->private->read_buffer = gimp_drawable_create_buffer (drawable,
FALSE);
else
gimp_gegl_buffer_refetch_tiles (drawable->private->read_buffer);
return drawable->private->read_buffer;
}
GeglBuffer *
gimp_drawable_get_write_buffer (GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
if (! drawable->private->write_buffer)
drawable->private->write_buffer = gimp_drawable_create_buffer (drawable,
TRUE);
if (! drawable->private->buffer)
{
drawable->private->buffer = gimp_drawable_create_buffer (drawable,
FALSE);
}
else
gimp_gegl_buffer_refetch_tiles (drawable->private->write_buffer);
{
gegl_buffer_flush (drawable->private->buffer);
gimp_gegl_buffer_refetch_tiles (drawable->private->buffer);
}
return drawable->private->write_buffer;
return drawable->private->buffer;
}
void
......@@ -1561,21 +1537,15 @@ gimp_drawable_recreate_buffers (GimpDrawable *drawable)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (drawable->private->read_buffer)
{
g_object_unref (drawable->private->read_buffer);
drawable->private->read_buffer = NULL;
}
if (drawable->private->write_buffer)
if (drawable->private->buffer)
{
g_object_unref (drawable->private->write_buffer);
drawable->private->write_buffer = NULL;
g_object_unref (drawable->private->buffer);
drawable->private->buffer = NULL;
}
if (drawable->private->tile_source_node)
gegl_node_set (drawable->private->tile_source_node,
"buffer", gimp_drawable_get_read_buffer (drawable),
"buffer", gimp_drawable_get_buffer (drawable),
NULL);
}
......@@ -1584,8 +1554,8 @@ gimp_drawable_get_tiles (GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
if (drawable->private->write_buffer)
gegl_buffer_flush (drawable->private->write_buffer);
if (drawable->private->buffer)
gegl_buffer_flush (drawable->private->buffer);
return GIMP_DRAWABLE_GET_CLASS (drawable)->get_tiles (drawable);
}
......@@ -1670,7 +1640,7 @@ gimp_drawable_get_source_node (GimpDrawable *drawable)
drawable->private->tile_source_node =
gegl_node_new_child (drawable->private->source_node,
"operation", "gegl:buffer-source",
"buffer", gimp_drawable_get_read_buffer (drawable),
"buffer", gimp_drawable_get_buffer (drawable),
NULL);
gimp_drawable_sync_source_node (drawable, FALSE);
......@@ -1767,7 +1737,7 @@ gimp_drawable_fill (GimpDrawable *drawable,
gimp_rgb_set_alpha (&c, 1.0);
col = gimp_gegl_color_new (&c);
gegl_buffer_set_color (gimp_drawable_get_write_buffer (drawable),
gegl_buffer_set_color (gimp_drawable_get_buffer (drawable),
NULL, col);
g_object_unref (col);
}
......@@ -1775,7 +1745,7 @@ gimp_drawable_fill (GimpDrawable *drawable,
{
GeglBuffer *src_buffer = gimp_pattern_create_buffer (pattern);
gegl_buffer_set_pattern (gimp_drawable_get_write_buffer (drawable),
gegl_buffer_set_pattern (gimp_drawable_get_buffer (drawable),
NULL, src_buffer, 0, 0);
g_object_unref (src_buffer);
}
......
......@@ -178,8 +178,7 @@ void gimp_drawable_init_src_region (GimpDrawable *drawable,
gint height,
TileManager **temp_tiles);
GeglBuffer * gimp_drawable_get_read_buffer (GimpDrawable *drawable);
GeglBuffer * gimp_drawable_get_write_buffer (GimpDrawable *drawable);
GeglBuffer * gimp_drawable_get_buffer (GimpDrawable *drawable);
/* FIXME gegl migration hack */
void gimp_drawable_recreate_buffers (GimpDrawable *drawable);
......
......@@ -383,8 +383,8 @@ gimp_image_duplicate_mask (GimpImage *image,
mask = GIMP_DRAWABLE (gimp_image_get_mask (image));
new_mask = GIMP_DRAWABLE (gimp_image_get_mask (new_image));
gegl_buffer_copy (gimp_drawable_get_read_buffer (mask), NULL,
gimp_drawable_get_write_buffer (new_mask), NULL);
gegl_buffer_copy (gimp_drawable_get_buffer (mask), NULL,
gimp_drawable_get_buffer (new_mask), NULL);
GIMP_CHANNEL (new_mask)->bounds_known = FALSE;
GIMP_CHANNEL (new_mask)->boundary_known = FALSE;
......
......@@ -546,7 +546,7 @@ gimp_image_merge_layers (GimpImage *image,
rect.height = y2 - y1;
color = gimp_gegl_color_new (&bg);
gegl_buffer_set_color (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (merge_layer)),
gegl_buffer_set_color (gimp_drawable_get_buffer (GIMP_DRAWABLE (merge_layer)),
&rect, color);
g_object_unref (color);
......@@ -574,7 +574,7 @@ gimp_image_merge_layers (GimpImage *image,
gimp_item_set_offset (GIMP_ITEM (merge_layer), x1, y1);
/* clear the layer */
gegl_buffer_clear (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (merge_layer)),
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (merge_layer)),
NULL);
/* Find the index in the layer list of the bottom layer--we need this
......
......@@ -722,7 +722,7 @@ gimp_image_map_update_undo_tiles (GimpImageMap *image_map,
}
/* Copy from the image to the new tiles */
src = gimp_drawable_get_read_buffer (image_map->drawable);
src = gimp_drawable_get_buffer (image_map->drawable);
dest = gimp_tile_manager_create_buffer (image_map->undo_tiles,
gimp_drawable_get_format (image_map->drawable),
TRUE);
......@@ -888,7 +888,7 @@ gimp_image_map_data_written (GObject *operation,
src = gimp_tile_manager_create_buffer (image_map->undo_tiles,
gimp_drawable_get_format (image_map->drawable),
FALSE);
dest = gimp_drawable_get_write_buffer (image_map->drawable);
dest = gimp_drawable_get_buffer (image_map->drawable);
src_rect.x = extent->x - image_map->undo_offset_x;
src_rect.y = extent->y - image_map->undo_offset_y;
......
......@@ -212,7 +212,7 @@ floating_sel_boundary (GimpLayer *layer,
gint i;
/* find the segments */
buffer = gimp_drawable_get_read_buffer (GIMP_DRAWABLE (layer));
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
layer->fs.segs = gimp_boundary_find (buffer, NULL,
GIMP_BOUNDARY_WITHIN_BOUNDS,
......
......@@ -988,7 +988,7 @@ gimp_layer_get_opacity_at (GimpPickable *pickable,
/* Otherwise, determine if the alpha value at
* the given point is non-zero
*/
gegl_buffer_sample (gimp_drawable_get_read_buffer (GIMP_DRAWABLE (layer)),
gegl_buffer_sample (gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)),
x, y, NULL, &value, babl_format ("A u8"),
GEGL_SAMPLER_NEAREST);
......@@ -1139,7 +1139,7 @@ gimp_layer_new_from_buffer (GeglBuffer *buffer,
type, name,
opacity, mode);
dest = gimp_drawable_get_write_buffer (GIMP_DRAWABLE (layer));
dest = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
gegl_buffer_copy (buffer, NULL, dest, NULL);
return layer;
......@@ -1397,7 +1397,7 @@ gimp_layer_create_mask (const GimpLayer *layer,
babl_format ("A u8"),
TRUE);
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), NULL,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
g_object_unref (dest_buffer);
......@@ -1418,10 +1418,10 @@ gimp_layer_create_mask (const GimpLayer *layer,
"value", 1.0,
NULL);
gimp_apply_operation (gimp_drawable_get_read_buffer (drawable),
gimp_apply_operation (gimp_drawable_get_buffer (drawable),
NULL, NULL,
set_alpha, TRUE,
gimp_drawable_get_write_buffer (drawable),
gimp_drawable_get_buffer (drawable),
NULL);
g_object_unref (set_alpha);
......@@ -1465,8 +1465,8 @@ gimp_layer_create_mask (const GimpLayer *layer,
GeglRectangle src_rect;
GeglRectangle dest_rect;
src = gimp_drawable_get_read_buffer (GIMP_DRAWABLE (channel));
dest = gimp_drawable_get_write_buffer (GIMP_DRAWABLE (mask));
src = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
dest = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
src_rect.x = copy_x;
src_rect.y = copy_y;
......@@ -1503,7 +1503,7 @@ gimp_layer_create_mask (const GimpLayer *layer,
dest_buffer = gimp_tile_manager_create_buffer (copy_tiles, NULL,
TRUE);
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), NULL,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
g_object_unref (dest_buffer);
......@@ -1513,11 +1513,11 @@ gimp_layer_create_mask (const GimpLayer *layer,
}
else
{
src_buffer = gimp_drawable_get_read_buffer (drawable);
src_buffer = gimp_drawable_get_buffer (drawable);
g_object_ref (src_buffer);
}
dest_buffer = gimp_drawable_get_write_buffer (GIMP_DRAWABLE (mask));
dest_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
if (gimp_drawable_has_alpha (drawable))
{
......@@ -1619,8 +1619,8 @@ gimp_layer_apply_mask (GimpLayer *layer,
NULL, FALSE);
/* Combine the current layer's alpha channel and the mask */
mask_buffer = gimp_drawable_get_read_buffer (GIMP_DRAWABLE (mask));
dest_buffer = gimp_drawable_get_write_buffer (GIMP_DRAWABLE (layer));
mask_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
dest_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
apply_opacity = gimp_gegl_create_apply_opacity_node (mask_buffer, 1.0,
0, 0);
......@@ -1830,7 +1830,7 @@ gimp_layer_add_alpha (GimpLayer *layer)
gimp_drawable_get_format_with_alpha (GIMP_DRAWABLE (layer)),
TRUE);
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), NULL,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
g_object_unref (dest_buffer);
......
......@@ -88,7 +88,7 @@ gimp_mask_undo_constructed (GObject *object)
mask_undo->x = x1;
mask_undo->y = y1;
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), &src_rect,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
mask_undo->buffer, &dest_rect);
}
}
......@@ -130,10 +130,10 @@ gimp_mask_undo_pop (GimpUndo *undo,
new_buffer = gegl_buffer_new (&buffer_rect,
babl_format ("Y float"));
gegl_buffer_copy (gimp_drawable_get_read_buffer (drawable), &src_rect,
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), &src_rect,
new_buffer, &dest_rect);
gegl_buffer_clear (gimp_drawable_get_write_buffer (drawable), &src_rect);
gegl_buffer_clear (gimp_drawable_get_buffer (drawable), &src_rect);
}
else
{
......@@ -148,7 +148,7 @@ gimp_mask_undo_pop (GimpUndo *undo,
height = gegl_buffer_get_height (mask_undo->buffer);
gegl_buffer_copy (mask_undo->buffer, NULL,
gimp_drawable_get_write_buffer (drawable), &dest_rect);
gimp_drawable_get_buffer (drawable), &dest_rect);
g_object_unref (mask_undo->buffer);
}
......
......@@ -299,7 +299,7 @@ gimp_palette_import_extract (GimpImage *image,
{
GimpDrawable *mask = GIMP_DRAWABLE (gimp_image_get_mask (image));
buffer = gimp_drawable_get_read_buffer (mask);
buffer = gimp_drawable_get_buffer (mask);
rect.x = x + pickable_off_x;
rect.y = y + pickable_off_y;
......
......@@ -581,9 +581,9 @@ gimp_selection_load (GimpSelection *selection,
C_("undo-type", "Channel to Selection"));
/* copy the channel to the mask */
gegl_buffer_copy (gimp_drawable_get_read_buffer (GIMP_DRAWABLE (channel)),
gegl_buffer_copy (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL,
gimp_drawable_get_write_buffer (GIMP_DRAWABLE (selection)),
gimp_drawable_get_buffer (GIMP_DRAWABLE (selection)),
NULL);
GIMP_CHANNEL (selection)->bounds_known = FALSE;
......@@ -741,7 +741,7 @@ gimp_selection_extract (GimpSelection *selection,
GeglBuffer *mask_buffer;
GeglNode *apply_opacity;
mask_buffer = gimp_drawable_get_read_buffer (GIMP_DRAWABLE (selection));
mask_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (selection));
apply_opacity = gimp_gegl_create_apply_opacity_node (mask_buffer, 1.0,
x1 + off_x,
......
......@@ -684,7 +684,7 @@ gimp_text_layer_render_layout (GimpTextLayer *layer,
data = cairo_image_surface_get_data (surface);
rowstride = cairo_image_surface_get_stride (surface);
buffer = gimp_drawable_get_write_buffer (drawable);
buffer = gimp_drawable_get_buffer (drawable);
format = gimp_drawable_get_format (drawable);
fish = babl_fish (babl_format ("RGBA u8"), format);
bytes = babl_format_get_bytes_per_pixel (format);
......
......@@ -633,7 +633,7 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
"foreground-extraction", NULL);
gimp_scan_convert_render_value (scan_convert,
gimp_drawable_get_write_buffer (GIMP_DRAWABLE (mask)),
gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
0, 0, 128);
gimp_scan_convert_free (scan_convert);
......@@ -789,7 +789,7 @@ gimp_foreground_select_tool_stroke (GimpChannel *mask,
GIMP_JOIN_ROUND, GIMP_CAP_ROUND, 10.0,
0.0, NULL);
gimp_scan_convert_compose_value (scan_convert,
gimp_drawable_get_write_buffer (GIMP_DRAWABLE (mask)),
gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
0, 0, stroke->background ? 0 : 255);
gimp_scan_convert_free (scan_convert);
}
......
......@@ -542,7 +542,7 @@ iscissors_convert (GimpIscissorsTool *iscissors,
gimp_image_get_width (image),
gimp_image_get_height (image));
gimp_scan_convert_render (sc,
gimp_drawable_get_write_buffer (GIMP_DRAWABLE (iscissors->mask)),
gimp_drawable_get_buffer (GIMP_DRAWABLE (iscissors->mask)),
0, 0, options->antialias);