[gegl/pluggable-buffer] trim down set of headers needed to be installed for pluggable buffers
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/pluggable-buffer] trim down set of headers needed to be installed for pluggable buffers
- Date: Sat, 29 Jan 2011 22:40:22 +0000 (UTC)
commit 8a6b11da8754c48badc6cfe16a967055974305a5
Author: �yvind Kolås <pippin gimp org>
Date: Sat Jan 29 22:40:02 2011 +0000
trim down set of headers needed to be installed for pluggable buffers
gegl/Makefile.am | 3 +-
gegl/buffer/gegl-buffer-private.h | 42 ++++++++++++++++++++++++
gegl/buffer/gegl-buffer-types.h | 1 -
gegl/buffer/gegl-tile-backend-file.c | 6 ++--
gegl/buffer/gegl-tile-backend-ram.c | 1 -
gegl/buffer/gegl-tile-backend.h | 6 +++
gegl/buffer/gegl-tile-handler-empty.c | 4 ++
gegl/buffer/gegl-tile-handler-zoom.c | 10 ++++--
gegl/buffer/gegl-tile-source.h | 25 +++++++++----
gegl/buffer/gegl-tile.c | 56 ++++++++++++--------------------
gegl/buffer/gegl-tile.h | 58 +++------------------------------
11 files changed, 106 insertions(+), 106 deletions(-)
---
diff --git a/gegl/Makefile.am b/gegl/Makefile.am
index 1954039..c9acc5a 100644
--- a/gegl/Makefile.am
+++ b/gegl/Makefile.am
@@ -37,10 +37,9 @@ GEGL_public_HEADERS = \
buffer/gegl-buffer.h \
buffer/gegl-buffer-iterator.h \
buffer/gegl-buffer-backend.h \
+ buffer/gegl-tile.h \
buffer/gegl-tile-backend.h \
buffer/gegl-tile-source.h \
- buffer/gegl-tile.h \
- buffer/gegl-buffer-types.h \
property-types/gegl-paramspecs.h \
property-types/gegl-color.h \
property-types/gegl-path.h \
diff --git a/gegl/buffer/gegl-buffer-private.h b/gegl/buffer/gegl-buffer-private.h
index 286035e..bdb13d2 100644
--- a/gegl/buffer/gegl-buffer-private.h
+++ b/gegl/buffer/gegl-buffer-private.h
@@ -132,4 +132,46 @@ void gegl_buffer_sampler (GeglBuffer *buffer,
gpointer sampler);
+
+/* the instance size of a GeglTile is a bit large, and should if possible be
+ * trimmed down
+ */
+struct _GeglTile
+{
+ /* GObject parent_instance;*/
+ gint ref_count;
+
+ 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)
+ */
+ 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 */
+
+ gchar lock; /* number of times the tile is write locked
+ * should in theory just have the values 0/1
+ */
+ GMutex *mutex;
+
+ /* the shared list is a doubly linked circular list */
+ GeglTile *next_shared;
+ GeglTile *prev_shared;
+
+ void (*destroy_notify) (gpointer pixels,
+ gpointer data);
+ gpointer destroy_notify_data;
+};
+
+#ifndef __GEGL_TILE_C
+#define gegl_tile_get_data(tile) ((guchar*)((tile)->data))
+#endif // __GEGL_TILE_C
+
#endif
diff --git a/gegl/buffer/gegl-buffer-types.h b/gegl/buffer/gegl-buffer-types.h
index d94c8b8..46b4716 100644
--- a/gegl/buffer/gegl-buffer-types.h
+++ b/gegl/buffer/gegl-buffer-types.h
@@ -19,7 +19,6 @@
#ifndef __GEGL_BUFFER_TYPES_H__
#define __GEGL_BUFFER_TYPES_H__
-typedef struct _GeglTile GeglTile;
typedef struct _GeglTileClass GeglTileClass;
typedef struct _GeglTileSource GeglTileSource;
diff --git a/gegl/buffer/gegl-tile-backend-file.c b/gegl/buffer/gegl-tile-backend-file.c
index 3c113cc..290745c 100644
--- a/gegl/buffer/gegl-tile-backend-file.c
+++ b/gegl/buffer/gegl-tile-backend-file.c
@@ -37,7 +37,7 @@
#include "gegl-tile-backend-file.h"
#include "gegl-buffer-index.h"
#include "gegl-debug.h"
-#include "gegl-types-internal.h"
+//#include "gegl-types-internal.h"
struct _GeglTileBackendFile
@@ -463,7 +463,7 @@ gegl_tile_backend_file_get_tile (GeglTileSource *self,
return NULL;
tile = gegl_tile_new (backend->tile_size);
- tile->rev = entry->rev;
+ gegl_tile_set_rev (tile, entry->rev);
gegl_tile_mark_as_stored (tile);
gegl_tile_backend_file_file_entry_read (tile_backend_file, entry, gegl_tile_get_data (tile));
@@ -493,7 +493,7 @@ gegl_tile_backend_file_set_tile (GeglTileSource *self,
entry->z = z;
g_hash_table_insert (tile_backend_file->index, entry, entry);
}
- entry->rev = tile->rev;
+ entry->rev = gegl_tile_get_rev (tile);
gegl_tile_backend_file_file_entry_write (tile_backend_file, entry, gegl_tile_get_data (tile));
gegl_tile_mark_as_stored (tile);
diff --git a/gegl/buffer/gegl-tile-backend-ram.c b/gegl/buffer/gegl-tile-backend-ram.c
index 8213bff..d1869ca 100644
--- a/gegl/buffer/gegl-tile-backend-ram.c
+++ b/gegl/buffer/gegl-tile-backend-ram.c
@@ -25,7 +25,6 @@
#include "gegl-tile-backend.h"
#include "gegl-tile-backend-ram.h"
-
static void dbg_alloc (int size);
static void dbg_dealloc (int size);
diff --git a/gegl/buffer/gegl-tile-backend.h b/gegl/buffer/gegl-tile-backend.h
index 467a0f8..144b278 100644
--- a/gegl/buffer/gegl-tile-backend.h
+++ b/gegl/buffer/gegl-tile-backend.h
@@ -34,6 +34,8 @@ struct _GeglTileBackend
{
GeglTileSource parent_instance;
+ /* XXXX: all of this should be private? */
+
gint tile_width;
gint tile_height;
Babl *format; /* defaults to the babl format "R'G'B'A u8" */
@@ -50,6 +52,10 @@ struct _GeglTileBackendClass
{
GeglTileSourceClass parent_class;
+ gpointer padding1;
+ gpointer padding2;
+ gpointer padding3;
+ gpointer padding4;
};
GType gegl_tile_backend_get_type (void) G_GNUC_CONST;
diff --git a/gegl/buffer/gegl-tile-handler-empty.c b/gegl/buffer/gegl-tile-handler-empty.c
index de3a029..ff3d497 100644
--- a/gegl/buffer/gegl-tile-handler-empty.c
+++ b/gegl/buffer/gegl-tile-handler-empty.c
@@ -20,6 +20,10 @@
#include <glib-object.h>
#include <string.h>
+#include "gegl-types.h"
+#include "gegl-matrix.h"
+#include "gegl-buffer-types.h"
+#include "gegl-buffer-private.h"
#include "gegl-tile-handler.h"
#include "gegl-tile-handler-empty.h"
#include "gegl-tile-handler-cache.h"
diff --git a/gegl/buffer/gegl-tile-handler-zoom.c b/gegl/buffer/gegl-tile-handler-zoom.c
index dc2f07d..4f8f2ff 100644
--- a/gegl/buffer/gegl-tile-handler-zoom.c
+++ b/gegl/buffer/gegl-tile-handler-zoom.c
@@ -20,6 +20,10 @@
#include <glib-object.h>
#include <string.h>
+#include "gegl-types.h"
+#include "gegl-matrix.h"
+#include "gegl-buffer-types.h"
+#include "gegl-buffer-private.h"
#include "gegl-tile-handler.h"
#include "gegl-tile-handler-zoom.h"
#include "gegl-tile-handler-cache.h"
@@ -255,9 +259,9 @@ get_tile (GeglTileSource *gegl_tile_source,
{
tile = gegl_tile_new (tile_size);
- tile->x = x;
- tile->y = y;
- tile->z = z;
+ tile->x = x;
+ tile->y = y;
+ tile->z = z;
tile->tile_storage = zoom->tile_storage;
if (zoom->cache)
diff --git a/gegl/buffer/gegl-tile-source.h b/gegl/buffer/gegl-tile-source.h
index 85c6a5a..a85a226 100644
--- a/gegl/buffer/gegl-tile-source.h
+++ b/gegl/buffer/gegl-tile-source.h
@@ -13,7 +13,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
*
- * Copyright 2006 �yvind Kolås <pippin gimp org>
+ * Copyright 2006-2011 �yvind Kolås <pippin gimp org>
*/
#ifndef __GEGL_TILE_SOURCE_H__
@@ -39,16 +39,24 @@ struct _GeglTileSource
{
GObject parent_instance;
gpointer (*command) (GeglTileSource *gegl_tile_source,
- GeglTileCommand command,
- gint x,
- gint y,
- gint z,
- gpointer data);
+ GeglTileCommand command,
+ gint x,
+ gint y,
+ gint z,
+ gpointer data);
+ gpointer padding1;
+ gpointer padding2;
+ gpointer padding3;
+ gpointer padding4;
};
struct _GeglTileSourceClass
{
GObjectClass parent_class;
+ gpointer padding1;
+ gpointer padding2;
+ gpointer padding3;
+ gpointer padding4;
};
GType gegl_tile_source_get_type (void) G_GNUC_CONST;
@@ -61,7 +69,7 @@ GType gegl_tile_source_get_type (void) G_GNUC_CONST;
enum _GeglTileCommand
{
GEGL_TILE_IDLE = 0,
- GEGL_TILE_SET,
+ GEGL_TILE_SET,
GEGL_TILE_GET,
GEGL_TILE_IS_CACHED,
GEGL_TILE_EXIST,
@@ -72,6 +80,7 @@ enum _GeglTileCommand
};
#ifdef NOT_REALLY_COS_THIS_IS_MACROS
+/* The functions documented below are actually macros, all using the command vfunc */
/**
* gegl_tile_source_get_tile:
@@ -99,7 +108,7 @@ GeglTile *gegl_tile_source_get_tile (GeglTileSource *source,
* @z: tile zoom level
* @tile: a #GeglTile
*
- * Get a GeglTile *from the buffer.
+ * Set a GeglTile in *from the buffer.
*
* Returns: the TRUE if the set was successful.
*/
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index 25af601..6215025 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -24,6 +24,8 @@
#include <unistd.h>
#endif
+#define __GEGL_TILE_C
+
#include <glib-object.h>
#include "gegl-types-internal.h"
@@ -261,41 +263,6 @@ gegl_tile_void (GeglTile *tile)
gegl_tile_void_pyramid (tile);
}
-void
-gegl_tile_cpy (GeglTile *src,
- GeglTile *dst)
-{
- gegl_tile_lock (dst);
-
- gegl_free (dst->data);
- dst->data = NULL;
-
- dst->next_shared = src->next_shared;
- src->next_shared = dst;
- dst->prev_shared = src;
- dst->next_shared->prev_shared = dst;
-
- dst->data = src->data;
-
- gegl_tile_unlock (dst);
-}
-
-void
-gegl_tile_swp (GeglTile *a,
- GeglTile *b)
-{
- guchar *tmp;
-
- gegl_tile_unclone (a);
- gegl_tile_unclone (b);
-
- g_assert (a->size == b->size);
-
- tmp = a->data;
- a->data = b->data;
- b->data = tmp;
-}
-
gboolean gegl_tile_store (GeglTile *tile)
{
if (gegl_tile_is_stored (tile))
@@ -308,3 +275,22 @@ gboolean gegl_tile_store (GeglTile *tile)
tile->z,
tile);
}
+
+/* for internal use, a macro poking directly at the data will be faster
+ */
+guchar *gegl_tile_get_data (GeglTile *tile)
+{
+ return tile->data;
+}
+
+
+void gegl_tile_set_rev (GeglTile *tile,
+ guint rev)
+{
+ tile->rev = rev;
+}
+
+guint gegl_tile_get_rev (GeglTile *tile)
+{
+ return tile->rev;
+}
diff --git a/gegl/buffer/gegl-tile.h b/gegl/buffer/gegl-tile.h
index 40e6df9..c871d45 100644
--- a/gegl/buffer/gegl-tile.h
+++ b/gegl/buffer/gegl-tile.h
@@ -21,44 +21,7 @@
#include <glib-object.h>
-#include "gegl-buffer-types.h"
-
-/* the instance size of a GeglTile is a bit large, and should if possible be
- * trimmed down
- */
-struct _GeglTile
-{
- /* GObject parent_instance;*/
- gint ref_count;
-
- 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)
- */
- 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 */
-
- gchar lock; /* number of times the tile is write locked
- * should in theory just have the values 0/1
- */
- GMutex *mutex;
-
- /* the shared list is a doubly linked circular list */
- GeglTile *next_shared;
- GeglTile *prev_shared;
-
- void (*destroy_notify) (gpointer pixels,
- gpointer data);
- gpointer destroy_notify_data;
-};
+typedef struct _GeglTile GeglTile;
GeglTile * gegl_tile_new (gint size);
GeglTile * gegl_tile_new_bare (void); /* special hack for linear bufs */
@@ -66,7 +29,6 @@ GeglTile * gegl_tile_ref (GeglTile *tile);
void gegl_tile_unref (GeglTile *tile);
void * gegl_tile_get_format (GeglTile *tile);
-
/* lock a tile for writing, this would allow writing to buffers
* later gotten with get_data()
*/
@@ -78,22 +40,15 @@ void gegl_tile_lock (GeglTile *tile);
void gegl_tile_unlock (GeglTile *tile);
-
void gegl_tile_mark_as_stored (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 an undo system in horizon
- * where the geglbufer originated, kept around in case they
- * become useful again
- */
-void gegl_tile_swp (GeglTile *a,
- GeglTile *b);
-void gegl_tile_cpy (GeglTile *src,
- GeglTile *dst);
-
+void gegl_tile_set_rev (GeglTile *tile,
+ guint rev);
+guint gegl_tile_get_rev (GeglTile *tile);
/* computes the positive integer remainder (also for negative dividends)
*/
@@ -102,9 +57,7 @@ void gegl_tile_cpy (GeglTile *src,
(divisor) - 1 - ((-((dividend) + 1)) % (divisor)) : \
(dividend) % (divisor))
-/* get a pointer to the linear buffer of the tile.
- */
-#define gegl_tile_get_data(tile) ((guchar*)((tile)->data))
+guchar *gegl_tile_get_data (GeglTile *tile);
#define gegl_tile_offset(coordinate, stride) GEGL_REMAINDER((coordinate), (stride))
@@ -116,5 +69,4 @@ void gegl_tile_cpy (GeglTile *src,
(coordinate) / (stride):\
((((coordinate) + 1) /(stride)) - 1))
-
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]