gegl r2242 - in trunk: . gegl/buffer
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2242 - in trunk: . gegl/buffer
- Date: Sun, 27 Apr 2008 14:01:49 +0100 (BST)
Author: ok
Date: Sun Apr 27 13:01:49 2008
New Revision: 2242
URL: http://svn.gnome.org/viewvc/gegl?rev=2242&view=rev
Log:
* gegl/buffer/gegl-tile.h: removed flags from tile, as well as the
only user the for now deprecated quarter dirtying code. Not storing
per tile flags simplifies the tile storage backends, adding this back
can be considered with a working implementation.
* gegl/buffer/gegl-tile-source.h:
* gegl/buffer/gegl-tile-backend-file.c:
* gegl/buffer/gegl-tile-backend-ram.c:
* gegl/buffer/gegl-tile-backend-tiledir.c:
* gegl/buffer/gegl-tile-handler-log.c:
* gegl/buffer/gegl-tile-handler-zoom.c:
* gegl/buffer/gegl-tile.c: refactored to use a much smaller recurse
function and removed defunct quarter dirtying code in favor of voiding
all smaller versions of a tile.
Modified:
trunk/ChangeLog
trunk/gegl/buffer/gegl-tile-backend-file.c
trunk/gegl/buffer/gegl-tile-backend-ram.c
trunk/gegl/buffer/gegl-tile-backend-tiledir.c
trunk/gegl/buffer/gegl-tile-handler-log.c
trunk/gegl/buffer/gegl-tile-handler-zoom.c
trunk/gegl/buffer/gegl-tile-source.h
trunk/gegl/buffer/gegl-tile.c
trunk/gegl/buffer/gegl-tile.h
Modified: trunk/gegl/buffer/gegl-tile-backend-file.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-backend-file.c (original)
+++ trunk/gegl/buffer/gegl-tile-backend-file.c Sun Apr 27 13:01:49 2008
@@ -393,9 +393,6 @@
g_hash_table_insert (tile_backend_file->index, entry, entry);
}
- g_assert (tile->flags == 0); /* when this one is triggered, dirty pyramid data
- has been tried written to persistent tile_storage.
- */
file_entry_write (tile_backend_file, entry, tile->data);
tile->stored_rev = tile->rev;
return NULL;
Modified: trunk/gegl/buffer/gegl-tile-backend-ram.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-backend-ram.c (original)
+++ trunk/gegl/buffer/gegl-tile-backend-ram.c Sun Apr 27 13:01:49 2008
@@ -179,9 +179,6 @@
entry->z = z;
g_hash_table_insert (tile_backend_ram->entries, entry, entry);
}
- g_assert (tile->flags == 0); /* when this one is triggered, dirty pyramid data
- has been tried written to persistent tile_storage.
- */
ram_entry_write (tile_backend_ram, entry, tile->data);
tile->stored_rev = tile->rev;
return TRUE;
Modified: trunk/gegl/buffer/gegl-tile-backend-tiledir.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-backend-tiledir.c (original)
+++ trunk/gegl/buffer/gegl-tile-backend-tiledir.c Sun Apr 27 13:01:49 2008
@@ -170,9 +170,6 @@
GioEntry entry = {x,y,z};
- g_assert (tile->flags == 0); /* when this one is triggered, dirty pyramid data
- has been tried written to persistent tile_storage.
- */
gio_entry_write (tile_backend_tiledir, &entry, tile->data);
tile->stored_rev = tile->rev;
return NULL;
Modified: trunk/gegl/buffer/gegl-tile-handler-log.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-handler-log.c (original)
+++ trunk/gegl/buffer/gegl-tile-handler-log.c Sun Apr 27 13:01:49 2008
@@ -33,10 +33,6 @@
"is_cached",
"exist",
"-", /*void*/
- "void tl",
- "void tr",
- "void bl",
- "void br",
"flush",
"invalidated",
"last command",
Modified: trunk/gegl/buffer/gegl-tile-handler-zoom.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-handler-zoom.c (original)
+++ trunk/gegl/buffer/gegl-tile-handler-zoom.c Sun Apr 27 13:01:49 2008
@@ -215,15 +215,8 @@
tile = gegl_tile_source_get_tile (source, x, y, z);
}
- if (tile != NULL)
- {
- /* Check that the tile is fully valid */
- if (!(tile->flags & (GEGL_TILE_DIRT_TL |
- GEGL_TILE_DIRT_TR |
- GEGL_TILE_DIRT_BL |
- GEGL_TILE_DIRT_BR)))
- return tile;
- }
+ if (tile)
+ return tile;
if (z == 0)/* at base level with no tile found->send null, and shared empty
tile will be used instead */
@@ -240,38 +233,13 @@
{
gint i, j;
guchar *data;
- gboolean had_tile = tile != NULL;
GeglTile *source_tile[2][2] = { { NULL, NULL }, { NULL, NULL } };
- gboolean fetch[2][2] = { { FALSE, FALSE },
- { FALSE, FALSE } };
-
- if (had_tile)
- {
- if (tile->flags & GEGL_TILE_DIRT_TL)
- fetch[0][0] = TRUE;
- if (tile->flags & GEGL_TILE_DIRT_TR)
- fetch[1][0] = TRUE;
- if (tile->flags & GEGL_TILE_DIRT_BL)
- fetch[0][1] = TRUE;
- if (tile->flags & GEGL_TILE_DIRT_BR)
- fetch[1][1] = TRUE;
-
- tile->flags = 0;
- }
- else
- {
- fetch[0][0] = TRUE;
- fetch[1][0] = TRUE;
- fetch[0][1] = TRUE;
- fetch[1][1] = TRUE;
- }
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
{
/* we get the tile from ourselves, to make successive rescales work
* correctly */
- if (fetch[i][j])
source_tile[i][j] = gegl_tile_source_get_tile (gegl_tile_source,
x * 2 + i, y * 2 + j, z - 1);
}
@@ -281,21 +249,15 @@
source_tile[1][0] == NULL &&
source_tile[1][1] == NULL)
{
- if (had_tile)
- {
- g_object_unref (tile);
- }
return NULL; /* no data from level below, return NULL and let GeglTileHandlerEmpty
fill in the shared empty tile */
}
- if (!had_tile)
+ g_assert (tile == NULL);
+ if (tile == NULL)
{
tile = gegl_tile_new (tile_size);
- /* it is a bit hacky, but adding enough information (probably too much)
- * enabling the tile_storage system to attempt swapping out of zoom tiles
- */
tile->x = x;
tile->y = y;
tile->z = z;
@@ -304,7 +266,8 @@
tile->rev = 1;
{
- GeglTileHandlerCache *cache = g_object_get_data (G_OBJECT (gegl_tile_source), "cache");
+ GeglTileHandlerCache *cache;
+ cacje = g_object_get_data (G_OBJECT (gegl_tile_source), "cache");
if (cache)
{
gegl_tile_handler_cache_insert (cache, tile, x, y, z);
@@ -334,8 +297,6 @@
gegl_tile_unlock (tile);
}
- tile->flags = 0;
-
return tile;
}
@@ -350,43 +311,14 @@
GeglTileHandler *handler = GEGL_HANDLER (tile_store);
/*GeglTileSource *source = handler->source;*/
- if (command == GEGL_TILE_GET)
- return get_tile (tile_store, x, y, z);
- if (command == GEGL_TILE_VOID_TL ||
- command == GEGL_TILE_VOID_TR ||
- command == GEGL_TILE_VOID_BL ||
- command == GEGL_TILE_VOID_BR)
+ switch (command)
{
- GeglTile *tile = gegl_tile_source_get_tile (tile_store, x, y, z);
-
- if (!tile)
- return FALSE;
- switch (command)
- {
- case GEGL_TILE_VOID_TL:
- tile->flags |= GEGL_TILE_DIRT_TL;
- break;
-
- case GEGL_TILE_VOID_TR:
- tile->flags |= GEGL_TILE_DIRT_TR;
- break;
-
- case GEGL_TILE_VOID_BL:
- tile->flags |= GEGL_TILE_DIRT_BL;
- break;
-
- case GEGL_TILE_VOID_BR:
- tile->flags |= GEGL_TILE_DIRT_BR;
- break;
-
- default:
- break;
- }
- g_object_unref (tile);
- return FALSE;
+ case GEGL_TILE_GET:
+ return get_tile (tile_store, x, y, z);
+ default:
+ /* pass the command on */
+ return gegl_tile_handler_chain_up (handler, command, x, y, z, data);
}
- /* pass the command on */
- return gegl_tile_handler_chain_up (handler, command, x, y, z, data);
}
Modified: trunk/gegl/buffer/gegl-tile-source.h
==============================================================================
--- trunk/gegl/buffer/gegl-tile-source.h (original)
+++ trunk/gegl/buffer/gegl-tile-source.h Sun Apr 27 13:01:49 2008
@@ -43,10 +43,6 @@
GEGL_TILE_IS_CACHED,
GEGL_TILE_EXIST,
GEGL_TILE_VOID,
- GEGL_TILE_VOID_TL,
- GEGL_TILE_VOID_TR,
- GEGL_TILE_VOID_BL,
- GEGL_TILE_VOID_BR,
GEGL_TILE_FLUSH,
GEGL_TILE_INVALIDATED,
GEGL_TILE_LAST_COMMAND
Modified: trunk/gegl/buffer/gegl-tile.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile.c (original)
+++ trunk/gegl/buffer/gegl-tile.c Sun Apr 27 13:01:49 2008
@@ -178,7 +178,6 @@
tile->rev = 0;
tile->lock = 0;
tile->data = NULL;
- tile->flags = 0;
tile->next_shared = tile;
tile->prev_shared = tile;
@@ -260,56 +259,27 @@
}
static void
+_gegl_tile_void_pyramid (GeglTileSource *source,
+ gint x,
+ gint y,
+ gint z)
+{
+ if (z>10)
+ return;
+ gegl_tile_source_void (source, x, y, z);
+ _gegl_tile_void_pyramid (source, x/2, y/2, z+1);
+}
+
+static void
gegl_tile_void_pyramid (GeglTile *tile)
{
- /* should, to tile->tile_storage, request it's toplevel tile, and mark
- * it as dirty, to force a recomputation of it's toplevel at the
- * next subdivision request. NB: a full voiding might not be neccesary,
- * forcing a rerender of just the dirtied part might be better, more
- * similar to how it was done in horizon, this will only work with 4->1 px
- * averageing.
- */
- gint x, y, z;
-
- x = tile->x;
- y = tile->y;
- z = 0;/*tile->z;*/
-
- for (z = 1; z < 10; z++)
+ if (tile->z == 0) /* we only accepting voiding the base level */
{
-#if 0
- gint ver = (y % 2);
- gint hor = (x % 2);
-#endif
- x /= 2;
- y /= 2;
-
- gegl_tile_source_void (GEGL_TILE_SOURCE (tile->tile_storage), x, y, z);
-#if 0
- /* FIXME: reenable this code */
- if (!ver)
- {
- if (!hor)
- {
- gegl_tile_source_void_tl (GEGL_TILE_SOURCE (tile->tile_storage), x,y,z);
- }
- else
- {
- gegl_tile_source_void_tr (GEGL_TILE_SOURCE (tile->tile_storage), x,y,z);
- }
- }
- else
- {
- if (!hor)
- {
- gegl_tile_source_void_bl (GEGL_TILE_SOURCE (tile->tile_storage), x,y,z);
- }
- else
- {
- gegl_tile_source_void_br (GEGL_TILE_SOURCE (tile->tile_storage), x,y,z);
- }
- }
-#endif
+ _gegl_tile_void_pyramid (GEGL_TILE_SOURCE (tile->tile_storage),
+ tile->x/2,
+ tile->y/2,
+ tile->z+1);
+ return;
}
}
@@ -346,9 +316,8 @@
{
tile->stored_rev = tile->rev;
tile->tile_storage = NULL;
- /* FIXME: make sure the tile is evicted from any tile_storage/buffer caches
- * as well
- */
+ if (tile->z==0)
+ gegl_tile_void_pyramid (tile);
}
void
@@ -404,7 +373,8 @@
return gegl_tile_source_set_tile (GEGL_TILE_SOURCE (tile->tile_storage),
tile->x,
tile->y,
- tile->z, tile);
+ tile->z,
+ tile);
}
/* compute the tile indice of a coordinate
Modified: trunk/gegl/buffer/gegl-tile.h
==============================================================================
--- trunk/gegl/buffer/gegl-tile.h (original)
+++ trunk/gegl/buffer/gegl-tile.h Sun Apr 27 13:01:49 2008
@@ -35,41 +35,33 @@
*/
struct _GeglTile
{
- GObject parent_instance;
+ GObject parent_instance;
- guchar *data; /* A small linear buffer for pixel data */
- gint size; /* The size of the data element in bytes */
+ guchar *data; /* actual pixel data for tile, a linear buffer*/
+ gint size; /* The size of the linear buffer */
- GeglTileStorage *tile_storage; /* the buffer from which this tile was retrieved
- * needed for the tile to be able to store itself
- * back (for instance when it is unreffed for the last time)
+ GeglTileStorage *tile_storage; /* the buffer from which this tile was
+ * retrieved needed for the tile to be able to
+ * store itself back (for instance when it is
+ * unreffed for the last time)
*/
- gint x, y, z;
+ gint x, y, z;
- guint rev; /* this tile revision */
- guint stored_rev; /* what revision was we when we from tile_storage?
- (currently set to 1 when loaded from disk */
+ guint rev; /* this tile revision */
+ guint stored_rev; /* what revision was we when we from tile_storage?
+ (currently set to 1 when loaded from disk */
- guint flags; /* used to store zoom dirt info */
-
- gchar lock; /* number of times the tile is write locked
- * should in theory just have the values 0/1
- */
+ gchar lock; /* number of times the tile is write locked
+ * should in theory just have the values 0/1
+ */
#if ENABLE_MP
- GMutex *mutex;
+ GMutex *mutex;
#endif
/* the shared list is a doubly linked circular list */
- GeglTile *next_shared;
- GeglTile *prev_shared;
-};
-
-enum {
- GEGL_TILE_DIRT_TL = 1<<0,
- GEGL_TILE_DIRT_TR = 1<<1,
- GEGL_TILE_DIRT_BL = 1<<2,
- GEGL_TILE_DIRT_BR = 1<<3
+ GeglTile *next_shared;
+ GeglTile *prev_shared;
};
struct _GeglTileClass
@@ -77,25 +69,31 @@
GObjectClass parent_class;
};
-GType gegl_tile_get_type (void) G_GNUC_CONST;
+GType gegl_tile_get_type (void) G_GNUC_CONST;
+
+GeglTile * gegl_tile_new (gint size);
+void * gegl_tile_get_format (GeglTile *tile);
+void gegl_tile_lock (GeglTile *tile);
+guchar * gegl_tile_get_data (GeglTile *tile);
+void gegl_tile_unlock (GeglTile *tile);
+gboolean gegl_tile_is_stored (GeglTile *tile);
+gboolean gegl_tile_store (GeglTile *tile);
+void gegl_tile_void (GeglTile *tile);
+GeglTile *gegl_tile_dup (GeglTile *tile);
+
+
+/* helper functions to compute tile indices and offsets for coordinates
+ * based on a tile stride (tile_width or tile_height)
+ */
+gint gegl_tile_indice (gint coordinate,
+ gint stride);
+gint gegl_tile_offset (gint coordinate,
+ gint stride);
-GeglTile * gegl_tile_new (gint size);
-guchar * gegl_tile_get_data (GeglTile *tile);
-void * gegl_tile_get_format (GeglTile *tile);
-void gegl_tile_lock (GeglTile *tile);
-void gegl_tile_unlock (GeglTile *tile);
-gboolean gegl_tile_is_stored (GeglTile *tile);
-gboolean gegl_tile_store (GeglTile *tile);
-void gegl_tile_void (GeglTile *tile);
-GeglTile *gegl_tile_dup (GeglTile *tile);
/* utility low-level functions used by undo system */
-void gegl_tile_swp (GeglTile *a,
- GeglTile *b);
-void gegl_tile_cpy (GeglTile *src,
- GeglTile *dst);
-gint gegl_tile_indice (gint coordinate,
- gint stride);
-gint gegl_tile_offset (gint coordinate,
- gint stride);
+void gegl_tile_swp (GeglTile *a,
+ GeglTile *b);
+void gegl_tile_cpy (GeglTile *src,
+ GeglTile *dst);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]