mirror of https://github.com/GNOME/gimp.git
app/tile_cache.c Maybe fixed tile_cache_set_size() so that it actually
Thu Jan 6 18:39:05 GMT 2000 Adam D. Moss <adam@gimp.org> * app/tile_cache.c * app/tile_swap.c: Maybe fixed tile_cache_set_size() so that it actually works now. You can use this to set GIMP's tile cache size at runtime without restarting. If the prefs guys (Sven, Michael?) don't wire it in I'll look at it, but it can't be soon.
This commit is contained in:
parent
884f223569
commit
a60cd2f202
|
@ -1,3 +1,12 @@
|
|||
Thu Jan 6 18:39:05 GMT 2000 Adam D. Moss <adam@gimp.org>
|
||||
|
||||
* app/tile_cache.c
|
||||
* app/tile_swap.c: Maybe fixed tile_cache_set_size()
|
||||
so that it actually works now. You can use this to set GIMP's
|
||||
tile cache size at runtime without restarting. If the prefs
|
||||
guys (Sven, Michael?) don't wire it in I'll look at it, but it
|
||||
can't be soon.
|
||||
|
||||
2000-01-06 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/[all files using the dialog or action area constructors]
|
||||
|
|
|
@ -112,9 +112,12 @@ tile_cache_insert (Tile *tile)
|
|||
{
|
||||
g_warning ("cache: unable to find room for a tile");
|
||||
goto out;
|
||||
/* goto grump;*/
|
||||
}
|
||||
}
|
||||
|
||||
/*grump:*/
|
||||
|
||||
/* Note the increase in the number of bytes the cache
|
||||
* is referencing.
|
||||
*/
|
||||
|
@ -196,6 +199,8 @@ tile_cache_flush_internal (Tile *tile)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* untested -- ADM */
|
||||
void
|
||||
tile_cache_set_size (unsigned long cache_size)
|
||||
{
|
||||
|
@ -204,9 +209,10 @@ tile_cache_set_size (unsigned long cache_size)
|
|||
|
||||
max_cache_size = cache_size;
|
||||
CACHE_LOCK;
|
||||
while (cache_size >= max_cache_size)
|
||||
while (cur_cache_size > max_cache_size)
|
||||
{
|
||||
if (!tile_cache_zorch_next ()) break;
|
||||
if (!tile_cache_zorch_next ())
|
||||
break;
|
||||
}
|
||||
CACHE_UNLOCK;
|
||||
}
|
||||
|
@ -239,7 +245,7 @@ tile_cache_zorch_next ()
|
|||
{
|
||||
Tile *tile;
|
||||
|
||||
/* printf("cache zorch: %u/%u\n", cur_cache_size, cur_cache_dirty); */
|
||||
/* fprintf(stderr, "cache zorch: %u/%u\n", cur_cache_size, cur_cache_dirty);*/
|
||||
|
||||
if (clean_list.first) tile = clean_list.first;
|
||||
else if (dirty_list.first) tile = dirty_list.first;
|
||||
|
|
|
@ -717,7 +717,11 @@ tile_swap_resize (DefSwapFile *def_swap_file,
|
|||
long new_size)
|
||||
{
|
||||
if (def_swap_file->swap_file_end > new_size)
|
||||
{
|
||||
ftruncate (fd, new_size);
|
||||
/*fprintf(stderr, "TRUNCATED SWAP from %d to %d bytes.\n",
|
||||
(int)def_swap_file->swap_file_end, (int) new_size);*/
|
||||
}
|
||||
def_swap_file->swap_file_end = new_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,9 +112,12 @@ tile_cache_insert (Tile *tile)
|
|||
{
|
||||
g_warning ("cache: unable to find room for a tile");
|
||||
goto out;
|
||||
/* goto grump;*/
|
||||
}
|
||||
}
|
||||
|
||||
/*grump:*/
|
||||
|
||||
/* Note the increase in the number of bytes the cache
|
||||
* is referencing.
|
||||
*/
|
||||
|
@ -196,6 +199,8 @@ tile_cache_flush_internal (Tile *tile)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* untested -- ADM */
|
||||
void
|
||||
tile_cache_set_size (unsigned long cache_size)
|
||||
{
|
||||
|
@ -204,9 +209,10 @@ tile_cache_set_size (unsigned long cache_size)
|
|||
|
||||
max_cache_size = cache_size;
|
||||
CACHE_LOCK;
|
||||
while (cache_size >= max_cache_size)
|
||||
while (cur_cache_size > max_cache_size)
|
||||
{
|
||||
if (!tile_cache_zorch_next ()) break;
|
||||
if (!tile_cache_zorch_next ())
|
||||
break;
|
||||
}
|
||||
CACHE_UNLOCK;
|
||||
}
|
||||
|
@ -239,7 +245,7 @@ tile_cache_zorch_next ()
|
|||
{
|
||||
Tile *tile;
|
||||
|
||||
/* printf("cache zorch: %u/%u\n", cur_cache_size, cur_cache_dirty); */
|
||||
/* fprintf(stderr, "cache zorch: %u/%u\n", cur_cache_size, cur_cache_dirty);*/
|
||||
|
||||
if (clean_list.first) tile = clean_list.first;
|
||||
else if (dirty_list.first) tile = dirty_list.first;
|
||||
|
|
|
@ -717,7 +717,11 @@ tile_swap_resize (DefSwapFile *def_swap_file,
|
|||
long new_size)
|
||||
{
|
||||
if (def_swap_file->swap_file_end > new_size)
|
||||
{
|
||||
ftruncate (fd, new_size);
|
||||
/*fprintf(stderr, "TRUNCATED SWAP from %d to %d bytes.\n",
|
||||
(int)def_swap_file->swap_file_end, (int) new_size);*/
|
||||
}
|
||||
def_swap_file->swap_file_end = new_size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue