void tile_lock (Tile *tile) { /* Increment the global reference count. */ tile_ref_count++; /* Increment this tile's reference count. */ tile->ref_count++; if (tile->ref_count == 1) { /* remove from cache, move to main store */ tile_cache_flush (tile); #ifdef TILE_PROFILING tile_active_count++; #endif } if (tile->data == NULL) { /* There is no data, so the tile must be swapped out */ tile_swap_in (tile); } /* Call 'tile_manager_validate' if the tile was invalid. */ if (! tile->valid) { /* an invalid tile should never be shared, so this should work */ tile_manager_validate_tile (tile->tlink->tm, tile); } }
static void tile_destroy (Tile *tile) { if (G_UNLIKELY (tile->ref_count)) { g_warning ("tried to destroy a ref'd tile"); return; } if (G_UNLIKELY (tile->share_count)) { g_warning ("tried to destroy an attached tile"); return; } if (tile->data) { g_free (tile->data); tile->data = NULL; #ifdef TILE_PROFILING tile_exist_count--; #endif } if (tile->rowhint) { g_slice_free1 (sizeof (TileRowHint) * TILE_HEIGHT, tile->rowhint); tile->rowhint = NULL; } /* must flush before deleting swap */ tile_cache_flush (tile); if (tile->swap_offset != -1) { /* If the tile is on disk, then delete its * presence there. */ tile_swap_delete (tile); } g_slice_free (Tile, tile); #ifdef TILE_PROFILING tile_count--; #endif }
static void tile_cache_zorch_next () { if (tile_list_head) tile_cache_flush ((Tile*) tile_list_head->data); }