mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 12:02:32 +00:00
minor cleanup.
2007-06-13 Sven Neumann <sven@gimp.org> * app/base/tile-cache.c: minor cleanup. svn path=/trunk/; revision=22771
This commit is contained in:
parent
0a1285fdae
commit
39fb488662
|
@ -1,3 +1,7 @@
|
|||
2007-06-13 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/base/tile-cache.c: minor cleanup.
|
||||
|
||||
2007-06-13 Mukund Sivaraman <muks@mukund.org>
|
||||
|
||||
* plug-ins/common/tiff-load.c: small fix to the previous commit
|
||||
|
|
|
@ -45,13 +45,13 @@ typedef struct _TileList
|
|||
Tile *last;
|
||||
} TileList;
|
||||
|
||||
static gulong max_tile_size = TILE_WIDTH * TILE_HEIGHT * 4;
|
||||
static gulong cur_cache_size = 0;
|
||||
static gulong max_cache_size = 0;
|
||||
static gulong cur_cache_dirty = 0;
|
||||
static TileList clean_list = { NULL, NULL };
|
||||
static TileList dirty_list = { NULL, NULL };
|
||||
static guint idle_swapper = 0;
|
||||
static const gulong max_tile_size = TILE_WIDTH * TILE_HEIGHT * 4;
|
||||
static gulong cur_cache_size = 0;
|
||||
static gulong max_cache_size = 0;
|
||||
static gulong cur_cache_dirty = 0;
|
||||
static TileList clean_list = { NULL, NULL };
|
||||
static TileList dirty_list = { NULL, NULL };
|
||||
static guint idle_swapper = 0;
|
||||
|
||||
|
||||
#ifdef ENABLE_MP
|
||||
|
@ -112,7 +112,7 @@ tile_cache_insert (Tile *tile)
|
|||
* it was the most recently accessed tile.
|
||||
*/
|
||||
|
||||
list = (TileList *) tile->listhead;
|
||||
list = tile->listhead;
|
||||
|
||||
newlist = ((tile->dirty || tile->swap_offset == -1) ?
|
||||
&dirty_list : &clean_list);
|
||||
|
@ -172,11 +172,6 @@ tile_cache_insert (Tile *tile)
|
|||
|
||||
newlist->last = tile;
|
||||
|
||||
/* gosgood@idt.net 1999-12-04 */
|
||||
/* bytes on cur_cache_dirty miscounted in CVS 1.12: */
|
||||
/* Invariant: test for selecting dirty list should be the same */
|
||||
/* as counting files dirty. */
|
||||
|
||||
if (tile->dirty || (tile->swap_offset == -1))
|
||||
{
|
||||
cur_cache_dirty += tile->size;
|
||||
|
@ -205,16 +200,30 @@ tile_cache_flush (Tile *tile)
|
|||
CACHE_UNLOCK;
|
||||
}
|
||||
|
||||
void
|
||||
tile_cache_set_size (gulong cache_size)
|
||||
{
|
||||
CACHE_LOCK;
|
||||
|
||||
max_cache_size = cache_size;
|
||||
|
||||
while (cur_cache_size > max_cache_size)
|
||||
{
|
||||
if (! tile_cache_zorch_next ())
|
||||
break;
|
||||
}
|
||||
|
||||
CACHE_UNLOCK;
|
||||
}
|
||||
|
||||
static void
|
||||
tile_cache_flush_internal (Tile *tile)
|
||||
{
|
||||
TileList *list;
|
||||
TileList *list = tile->listhead;
|
||||
|
||||
/* Find where the tile is in the cache.
|
||||
*/
|
||||
|
||||
list = (TileList *) tile->listhead;
|
||||
|
||||
if (list)
|
||||
{
|
||||
cur_cache_size -= tile->size;
|
||||
|
@ -236,24 +245,6 @@ tile_cache_flush_internal (Tile *tile)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tile_cache_set_size (gulong cache_size)
|
||||
{
|
||||
CACHE_LOCK;
|
||||
|
||||
max_cache_size = cache_size;
|
||||
|
||||
while (cur_cache_size > max_cache_size)
|
||||
{
|
||||
if (! tile_cache_zorch_next ())
|
||||
break;
|
||||
}
|
||||
|
||||
CACHE_UNLOCK;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
tile_cache_zorch_next (void)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue