allow configuring imlib2's cache size (#171)
by default imlib2 uses a 4mb cache, which is quite small. this allows users who have more memory to spare to set a bigger cache size and avoid reloading an already viewed image if it fits into the cache. Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
This commit is contained in:
parent
4396031233
commit
0639047dde
|
@ -59,6 +59,12 @@ static const bool ANTI_ALIAS = true;
|
||||||
*/
|
*/
|
||||||
static const bool ALPHA_LAYER = false;
|
static const bool ALPHA_LAYER = false;
|
||||||
|
|
||||||
|
/* cache size for imlib2, in bytes. For backwards compatibility reasons, the
|
||||||
|
* size is kept at 4MiB. For most users, it is advised to pick a value close to
|
||||||
|
* or above 128MiB for better image (re)loading performance.
|
||||||
|
*/
|
||||||
|
static const int CACHE_SIZE = 4 * 1024 * 1024; /* 4MiB */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef _THUMBS_CONFIG
|
#ifdef _THUMBS_CONFIG
|
||||||
|
|
||||||
|
|
1
image.c
1
image.c
|
@ -48,6 +48,7 @@ void img_init(img_t *img, win_t *win)
|
||||||
imlib_context_set_display(win->env.dpy);
|
imlib_context_set_display(win->env.dpy);
|
||||||
imlib_context_set_visual(win->env.vis);
|
imlib_context_set_visual(win->env.vis);
|
||||||
imlib_context_set_colormap(win->env.cmap);
|
imlib_context_set_colormap(win->env.cmap);
|
||||||
|
imlib_set_cache_size(CACHE_SIZE);
|
||||||
|
|
||||||
img->im = NULL;
|
img->im = NULL;
|
||||||
img->win = win;
|
img->win = win;
|
||||||
|
|
Loading…
Reference in New Issue