image: Use imlib2's image cache
This makes imlib add images loaded from files to its image cache again. That way
we avoid loading the same image again and again (e.g. if you cycle through the
list layouts all the layout icons are loaded).
To not reintroduce FS#651 (fixed in 2dadce9b
), we call
imlib_image_set_changes_on_disk(). This causes two stat() calls if the same file
is loaded again to check if the file's timestamps changed which is still less
expensive than loading the whole image again.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
84acfc4652
commit
4b622523eb
8
image.c
8
image.c
|
@ -282,12 +282,18 @@ image_new_from_file(const char *filename)
|
|||
if(!filename)
|
||||
return 0;
|
||||
|
||||
if(!(imimage = imlib_load_image_without_cache(filename)))
|
||||
if(!(imimage = imlib_load_image(filename)))
|
||||
{
|
||||
warn("cannot load image %s", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Make imlib check if the file changed on disk if it's later opened by the
|
||||
* same file name again before using its cache.
|
||||
*/
|
||||
imlib_context_set_image(imimage);
|
||||
imlib_image_set_changes_on_disk();
|
||||
|
||||
image = image_new(globalconf.L);
|
||||
image->image = imimage;
|
||||
|
||||
|
|
Loading…
Reference in New Issue