# HG changeset patch # User nadvornik # Date 1214085705 0 # Node ID e1d158ac6d365e820d303d773c305d260a2d43ca # Parent 77fc0ea3457d4d9a7ea837910fef3045a8611fdb cache size made configurable diff -r 77fc0ea3457d -r e1d158ac6d36 src/image.c --- a/src/image.c Sat Jun 21 19:26:01 2008 +0000 +++ b/src/image.c Sat Jun 21 22:01:45 2008 +0000 @@ -492,7 +492,8 @@ static FileCacheData *image_get_cache() { static FileCacheData *cache = NULL; - if (!cache) cache = file_cache_new(image_cache_release_cb, 120000000); + if (!cache) cache = file_cache_new(image_cache_release_cb, 1); + file_cache_set_max_size(cache, (gulong)options->image.image_cache_max * 1048576); /* update from options */ return cache; } diff -r 77fc0ea3457d -r e1d158ac6d36 src/options.c --- a/src/options.c Sat Jun 21 19:26:01 2008 +0000 +++ b/src/options.c Sat Jun 21 22:01:45 2008 +0000 @@ -76,6 +76,7 @@ options->image.read_buffer_size = IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT; options->image.scroll_reset_method = SCROLL_RESET_TOPLEFT; options->image.tile_cache_max = 10; + options->image.image_cache_max = 128; /* 4 x 10MPix */ options->image.use_custom_border_color = FALSE; options->image.zoom_2pass = TRUE; options->image.zoom_increment = 5; diff -r 77fc0ea3457d -r e1d158ac6d36 src/options.h --- a/src/options.h Sat Jun 21 19:26:01 2008 +0000 +++ b/src/options.h Sat Jun 21 22:01:45 2008 +0000 @@ -67,6 +67,7 @@ gint max_autofit_size; gint tile_cache_max; /* in megabytes */ + gint image_cache_max; /* in megabytes */ gint dither_quality; gint enable_read_ahead; diff -r 77fc0ea3457d -r e1d158ac6d36 src/preferences.c --- a/src/preferences.c Sat Jun 21 19:26:01 2008 +0000 +++ b/src/preferences.c Sat Jun 21 22:01:45 2008 +0000 @@ -262,6 +262,7 @@ options->collections.rectangular_selection = c_options->collections.rectangular_selection; options->image.tile_cache_max = c_options->image.tile_cache_max; + options->image.image_cache_max = c_options->image.image_cache_max; options->image.read_buffer_size = c_options->image.read_buffer_size; options->image.idle_read_loop_count = c_options->image.idle_read_loop_count; @@ -1509,6 +1510,9 @@ pref_spin_new_int(group, _("Offscreen cache size (Mb per image):"), NULL, 0, 128, 1, options->image.tile_cache_max, &c_options->image.tile_cache_max); + pref_spin_new_int(group, _("Decoded image cache size (Mb):"), NULL, + 0, 1024, 1, options->image.image_cache_max, &c_options->image.image_cache_max); + pref_spin_new_int(group, _("Image read buffer size (bytes):"), NULL, IMAGE_LOADER_READ_BUFFER_SIZE_MIN, IMAGE_LOADER_READ_BUFFER_SIZE_MAX, 512, options->image.read_buffer_size, &c_options->image.read_buffer_size); diff -r 77fc0ea3457d -r e1d158ac6d36 src/rcfile.c --- a/src/rcfile.c Sat Jun 21 19:26:01 2008 +0000 +++ b/src/rcfile.c Sat Jun 21 22:01:45 2008 +0000 @@ -448,6 +448,7 @@ WRITE_INT(image.max_autofit_size); WRITE_INT(image.scroll_reset_method); WRITE_INT(image.tile_cache_max); + WRITE_INT(image.image_cache_max); WRITE_INT(image.dither_quality); WRITE_BOOL(image.enable_read_ahead); WRITE_BOOL(image.exif_rotate_enable); @@ -807,6 +808,7 @@ READ_INT(image.max_autofit_size); READ_INT(image.scroll_reset_method); READ_INT(image.tile_cache_max); + READ_INT(image.image_cache_max); READ_INT_CLAMP(image.zoom_quality, GDK_INTERP_NEAREST, GDK_INTERP_HYPER); READ_INT_CLAMP(image.dither_quality, GDK_RGB_DITHER_NONE, GDK_RGB_DITHER_MAX); READ_INT(image.zoom_increment);