[gimp/goat-invasion: 190/401] app: use a GeglBuffer instead of TileManager as storage in drawables \o/
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 190/401] app: use a GeglBuffer instead of TileManager as storage in drawables \o/
- Date: Mon, 2 Apr 2012 12:04:05 +0000 (UTC)
commit 5444dface26457a1154885aab5ce3597b8816716
Author: Michael Natterer <mitch gimp org>
Date: Wed Mar 21 21:26:05 2012 +0100
app: use a GeglBuffer instead of TileManager as storage in drawables \o/
app/core/gimpdrawable-private.h | 6 +--
app/core/gimpdrawable.c | 75 ++++++++------------------------------
app/core/gimpdrawable.h | 2 -
app/core/gimpimage.c | 8 ----
app/text/gimptextlayer-xcf.c | 4 +-
app/xcf/xcf-load.c | 8 ++--
6 files changed, 24 insertions(+), 79 deletions(-)
---
diff --git a/app/core/gimpdrawable-private.h b/app/core/gimpdrawable-private.h
index d42f93d..78c8ee7 100644
--- a/app/core/gimpdrawable-private.h
+++ b/app/core/gimpdrawable-private.h
@@ -22,10 +22,8 @@ struct _GimpDrawablePrivate
{
const Babl *format; /* format of drawable */
- TileManager *tiles; /* tiles for drawable data */
- TileManager *shadow; /* shadow buffer tiles */
-
- GeglBuffer *buffer;
+ GeglBuffer *buffer; /* buffer for drawable data */
+ TileManager *shadow; /* shadow buffer tiles */
GeglNode *source_node;
GeglNode *tile_source_node;
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index c7357fe..4a3ccf7 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -293,20 +293,14 @@ gimp_drawable_finalize (GObject *object)
{
GimpDrawable *drawable = GIMP_DRAWABLE (object);
- if (drawable->private->tiles)
- {
- tile_manager_unref (drawable->private->tiles);
- drawable->private->tiles = NULL;
- }
-
- gimp_drawable_free_shadow_tiles (drawable);
-
if (drawable->private->buffer)
{
g_object_unref (drawable->private->buffer);
drawable->private->buffer = NULL;
}
+ gimp_drawable_free_shadow_tiles (drawable);
+
if (drawable->private->source_node)
{
g_object_unref (drawable->private->source_node);
@@ -431,16 +425,11 @@ gimp_drawable_duplicate (GimpItem *item,
new_drawable->private->format = format;
- if (new_drawable->private->tiles)
- tile_manager_unref (new_drawable->private->tiles);
-
- new_drawable->private->tiles =
- tile_manager_new (gimp_item_get_width (new_item),
- gimp_item_get_height (new_item),
- gimp_drawable_bytes (new_drawable));
+ if (new_drawable->private->buffer)
+ g_object_unref (new_drawable->private->buffer);
- gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
- gimp_drawable_get_buffer (new_drawable), NULL);
+ new_drawable->private->buffer =
+ gimp_gegl_buffer_dup (gimp_drawable_get_buffer (drawable));
}
return new_item;
@@ -788,7 +777,7 @@ gimp_drawable_real_convert_type (GimpDrawable *drawable,
static TileManager *
gimp_drawable_real_get_tiles (GimpDrawable *drawable)
{
- return drawable->private->tiles;
+ return gimp_gegl_buffer_get_tiles (drawable->private->buffer);
}
static void
@@ -818,18 +807,15 @@ gimp_drawable_real_set_tiles (GimpDrawable *drawable,
/* ref new before unrefing old, they might be the same */
tile_manager_ref (tiles);
- if (drawable->private->tiles)
- tile_manager_unref (drawable->private->tiles);
+ if (drawable->private->buffer)
+ g_object_unref (drawable->private->buffer);
- drawable->private->tiles = tiles;
drawable->private->format = gimp_image_get_format (gimp_item_get_image (item),
type);
+ drawable->private->buffer = gimp_tile_manager_create_buffer (tiles,
+ drawable->private->format);
- if (drawable->private->buffer)
- {
- g_object_unref (drawable->private->buffer);
- drawable->private->buffer = NULL;
- }
+ tile_manager_unref (tiles);
gimp_item_set_offset (item, offset_x, offset_y);
gimp_item_set_size (item,
@@ -1202,8 +1188,9 @@ gimp_drawable_new (GType type,
width, height));
drawable->private->format = format;
- drawable->private->tiles = tile_manager_new (width, height,
- gimp_drawable_bytes (drawable));
+ drawable->private->buffer = gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0,
+ width, height),
+ format);
return drawable;
}
@@ -1470,25 +1457,12 @@ gimp_drawable_init_src_region (GimpDrawable *drawable,
*temp_tiles = NULL;
}
-static GeglBuffer *
-gimp_drawable_create_buffer (GimpDrawable *drawable)
-{
- TileManager *tiles = gimp_drawable_get_tiles (drawable);
- const Babl *format = gimp_drawable_get_format (drawable);
-
- return gimp_tile_manager_create_buffer (tiles, format);
-}
-
GeglBuffer *
gimp_drawable_get_buffer (GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
- if (! drawable->private->buffer)
- {
- drawable->private->buffer = gimp_drawable_create_buffer (drawable);
- }
- else
+ if (drawable->private->buffer)
{
gegl_buffer_flush (drawable->private->buffer);
gimp_gegl_buffer_refetch_tiles (drawable->private->buffer);
@@ -1541,23 +1515,6 @@ gimp_drawable_set_buffer_full (GimpDrawable *drawable,
offset_x, offset_y);
}
-void
-gimp_drawable_recreate_buffers (GimpDrawable *drawable)
-{
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-
- if (drawable->private->buffer)
- {
- 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_buffer (drawable),
- NULL);
-}
-
TileManager *
gimp_drawable_get_tiles (GimpDrawable *drawable)
{
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index a4681e9..95c2918 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -191,8 +191,6 @@ void gimp_drawable_set_buffer_full (GimpDrawable *drawable,
GimpImageType type,
gint offset_x,
gint offset_y);
-/* FIXME gegl migration hack */
-void gimp_drawable_recreate_buffers (GimpDrawable *drawable);
TileManager * gimp_drawable_get_tiles (GimpDrawable *drawable);
void gimp_drawable_set_tiles (GimpDrawable *drawable,
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 4516dd7..4661197 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1155,14 +1155,6 @@ gimp_image_get_description (GimpViewable *viewable,
static void
gimp_image_real_mode_changed (GimpImage *image)
{
- GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
- GList *layers;
-
- /* FIXME gegl migration hack */
- layers = gimp_item_stack_get_item_list (GIMP_ITEM_STACK (private->layers->container));
- g_list_foreach (layers, (GFunc) gimp_drawable_recreate_buffers, NULL);
- g_list_free (layers);
-
gimp_projectable_structure_changed (GIMP_PROJECTABLE (image));
}
diff --git a/app/text/gimptextlayer-xcf.c b/app/text/gimptextlayer-xcf.c
index 61e65f5..47882cd 100644
--- a/app/text/gimptextlayer-xcf.c
+++ b/app/text/gimptextlayer-xcf.c
@@ -195,8 +195,8 @@ gimp_text_layer_from_layer (GimpLayer *layer,
drawable = GIMP_DRAWABLE (text_layer);
drawable->private->format = gimp_drawable_get_format (GIMP_DRAWABLE (layer));
- drawable->private->tiles = gimp_drawable_get_tiles (GIMP_DRAWABLE (layer));
- GIMP_DRAWABLE (layer)->private->tiles = NULL;
+ drawable->private->buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
+ GIMP_DRAWABLE (layer)->private->buffer = NULL;
gimp_layer_set_opacity (GIMP_LAYER (text_layer),
gimp_layer_get_opacity (layer), FALSE);
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 3007e44..3c54014 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -945,10 +945,10 @@ xcf_load_channel_props (XcfInfo *info,
gimp_item_get_height (GIMP_ITEM (*channel)));
g_object_ref_sink (mask);
- tile_manager_unref (GIMP_DRAWABLE (mask)->private->tiles);
- GIMP_DRAWABLE (mask)->private->tiles =
- GIMP_DRAWABLE (*channel)->private->tiles;
- GIMP_DRAWABLE (*channel)->private->tiles = NULL;
+ g_object_unref (GIMP_DRAWABLE (mask)->private->buffer);
+ GIMP_DRAWABLE (mask)->private->buffer =
+ GIMP_DRAWABLE (*channel)->private->buffer;
+ GIMP_DRAWABLE (*channel)->private->buffer = NULL;
g_object_unref (*channel);
*channel = mask;
(*channel)->boundary_known = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]