app: Add GimpTileBackendTileManagerPrivate

Also do some minor cleanup.
This commit is contained in:
Martin Nordholts 2011-09-30 10:28:18 +02:00
parent 93a0d51d16
commit 06a16afa7d
3 changed files with 24 additions and 8 deletions

View File

@ -84,6 +84,11 @@ typedef struct _GimpPosterizeConfig GimpPosterizeConfig;
typedef struct _GimpThresholdConfig GimpThresholdConfig;
/* temporary stuff */
typedef struct _GimpTileBackendTileManager GimpTileBackendTileManager;
/* non-object types */
typedef struct _GimpCagePoint GimpCagePoint;

View File

@ -34,6 +34,12 @@
#include "gimptilebackendtilemanager.h"
struct _GimpTileBackendTileManagerPrivate
{
GHashTable *entries;
};
typedef struct _RamEntry RamEntry;
struct _RamEntry
@ -99,6 +105,8 @@ gimp_tile_backend_tile_manager_class_init (GimpTileBackendTileManagerClass *klas
object_class->finalize = gimp_tile_backend_tile_manager_finalize;
object_class->get_property = gimp_tile_backend_tile_manager_get_property;
object_class->set_property = gimp_tile_backend_tile_manager_set_property;
g_type_class_add_private (klass, sizeof (GimpTileBackendTileManagerPrivate));
}
static void
@ -106,9 +114,12 @@ gimp_tile_backend_tile_manager_init (GimpTileBackendTileManager *backend)
{
GeglTileSource *source = GEGL_TILE_SOURCE (backend);
backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (backend,
GIMP_TYPE_TILE_BACKEND_TILE_MANAGER,
GimpTileBackendTileManagerPrivate);
source->command = gimp_tile_backend_tile_manager_command;
backend->entries = g_hash_table_new (hash_func, equal_func);
backend->priv->entries = g_hash_table_new (hash_func, equal_func);
}
static void
@ -116,7 +127,7 @@ gimp_tile_backend_tile_manager_finalize (GObject *object)
{
GimpTileBackendTileManager *backend = GIMP_TILE_BACKEND_TILE_MANAGER (object);
g_hash_table_unref (backend->entries);
g_hash_table_unref (backend->priv->entries);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -190,7 +201,7 @@ gimp_tile_backend_tile_manager_command (GeglTileSource *tile_store,
entry->y = y;
entry->z = z;
g_hash_table_insert (backend_tm->entries, entry, entry);
g_hash_table_insert (backend_tm->priv->entries, entry, entry);
}
ram_entry_write (backend_tm, entry, gegl_tile_get_data (tile));
@ -263,7 +274,7 @@ lookup_entry (GimpTileBackendTileManager *self,
key.z = z;
key.offset = 0;
return g_hash_table_lookup (self->entries, &key);
return g_hash_table_lookup (self->priv->entries, &key);
}
static guint
@ -400,7 +411,7 @@ ram_entry_destroy (RamEntry *entry,
{
gint tile_size = gegl_tile_backend_get_tile_size (GEGL_TILE_BACKEND (ram));
g_free (entry->offset);
g_hash_table_remove (ram->entries, entry);
g_hash_table_remove (ram->priv->entries, entry);
dbg_dealloc (tile_size);
g_slice_free (RamEntry, entry);

View File

@ -21,7 +21,7 @@
#ifndef __GIMP_TILE_BACKEND_TILE_MANAGER_H__
#define __GIMP_TILE_BACKEND_TILE_MANAGER_H__
#include "gegl-buffer-backend.h"
#include <gegl-buffer-backend.h>
G_BEGIN_DECLS
@ -32,14 +32,14 @@ G_BEGIN_DECLS
#define GIMP_IS_TILE_BACKEND_TILE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TILE_BACKEND_TILE_MANAGER))
#define GIMP_TILE_BACKEND_TILE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TILE_BACKEND_TILE_MANAGER, GimpTileBackendTileManagerClass))
typedef struct _GimpTileBackendTileManager GimpTileBackendTileManager;
typedef struct _GimpTileBackendTileManagerClass GimpTileBackendTileManagerClass;
typedef struct _GimpTileBackendTileManagerPrivate GimpTileBackendTileManagerPrivate;
struct _GimpTileBackendTileManager
{
GeglTileBackend parent_instance;
GHashTable *entries;
GimpTileBackendTileManagerPrivate *priv;
};
struct _GimpTileBackendTileManagerClass