static gpointer gegl_tile_backend_swap_set_tile (GeglTileSource *self, GeglTile *tile, gint x, gint y, gint z) { GeglTileBackend *backend; GeglTileBackendSwap *tile_backend_swap; SwapEntry *entry; backend = GEGL_TILE_BACKEND (self); tile_backend_swap = GEGL_TILE_BACKEND_SWAP (backend); entry = gegl_tile_backend_swap_lookup_entry (tile_backend_swap, x, y, z); gegl_tile_backend_swap_ensure_exist (); if (entry == NULL) { entry = gegl_tile_backend_swap_entry_create (x, y, z); entry->offset = gegl_tile_backend_swap_find_offset (gegl_tile_backend_get_tile_size (backend)); g_hash_table_insert (tile_backend_swap->index, entry, entry); } gegl_tile_backend_swap_entry_write (tile_backend_swap, entry, tile); gegl_tile_mark_as_stored (tile); return NULL; }
static GeglTile * gegl_tile_backend_swap_get_tile (GeglTileSource *self, gint x, gint y, gint z) { GeglTileBackend *backend; GeglTileBackendSwap *tile_backend_swap; SwapEntry *entry; GeglTile *tile = NULL; gint tile_size; backend = GEGL_TILE_BACKEND (self); tile_backend_swap = GEGL_TILE_BACKEND_SWAP (backend); entry = gegl_tile_backend_swap_lookup_entry (tile_backend_swap, x, y, z); if (!entry) return NULL; tile_size = gegl_tile_backend_get_tile_size (GEGL_TILE_BACKEND (self)); tile = gegl_tile_new (tile_size); gegl_tile_mark_as_stored (tile); gegl_tile_backend_swap_entry_read (tile_backend_swap, entry, gegl_tile_get_data (tile)); return tile; }
/* this is the only place that actually should * instantiate tiles, when the cache is large enough * that should make sure we don't hit this function * too often. */ static GeglTile * gegl_tile_backend_file_get_tile (GeglTileSource *self, gint x, gint y, gint z) { GeglTileBackend *backend; GeglTileBackendFile *tile_backend_file; GeglBufferTile *entry; GeglTile *tile = NULL; gint tile_size; backend = GEGL_TILE_BACKEND (self); tile_backend_file = GEGL_TILE_BACKEND_FILE (backend); entry = gegl_tile_backend_file_lookup_entry (tile_backend_file, x, y, z); if (!entry) return NULL; tile_size = gegl_tile_backend_get_tile_size (GEGL_TILE_BACKEND (self)); tile = gegl_tile_new (tile_size); 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)); return tile; }
static gpointer gegl_tile_backend_file_set_tile (GeglTileSource *self, GeglTile *tile, gint x, gint y, gint z) { GeglTileBackend *backend; GeglTileBackendFile *tile_backend_file; GeglBufferTile *entry; backend = GEGL_TILE_BACKEND (self); tile_backend_file = GEGL_TILE_BACKEND_FILE (backend); entry = gegl_tile_backend_file_lookup_entry (tile_backend_file, x, y, z); if (entry == NULL) { entry = gegl_tile_backend_file_file_entry_new (tile_backend_file); entry->x = x; entry->y = y; entry->z = z; g_hash_table_insert (tile_backend_file->index, entry, entry); } 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); return NULL; }
void gegl_tile_void (GeglTile *tile) { gegl_tile_mark_as_stored (tile); tile->tile_storage = NULL; if (tile->z==0) gegl_tile_void_pyramid (tile); }