forked from old/legacy-imlib2
loading: Don't look for cached image when not caching
This commit is contained in:
parent
b39d33c800
commit
3f1f87b1fb
|
@ -379,40 +379,43 @@ __imlib_LoadImage(const char *file, ImlibLoadArgs * ila)
|
||||||
if (!file || file[0] == '\0')
|
if (!file || file[0] == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* see if we already have the image cached */
|
if (!ila->nocache)
|
||||||
im = __imlib_FindCachedImage(file, ila->frame);
|
|
||||||
|
|
||||||
/* if we found a cached image and we should always check that it is */
|
|
||||||
/* accurate to the disk conents if they changed since we last loaded */
|
|
||||||
/* and that it is still a valid image */
|
|
||||||
if (im && !IM_FLAG_ISSET(im, F_INVALID))
|
|
||||||
{
|
{
|
||||||
if (IM_FLAG_ISSET(im, F_ALWAYS_CHECK_DISK))
|
/* see if we already have the image cached */
|
||||||
{
|
im = __imlib_FindCachedImage(file, ila->frame);
|
||||||
time_t current_modified_time;
|
|
||||||
|
|
||||||
current_modified_time = ila->fp ?
|
/* if we found a cached image and we should always check that it is */
|
||||||
__imlib_FileModDateFd(fileno(ila->fp)) :
|
/* accurate to the disk conents if they changed since we last loaded */
|
||||||
__imlib_FileModDate(im->real_file);
|
/* and that it is still a valid image */
|
||||||
/* if the file on disk is newer than the cached one */
|
if (im && !IM_FLAG_ISSET(im, F_INVALID))
|
||||||
if (current_modified_time != im->moddate)
|
{
|
||||||
|
if (IM_FLAG_ISSET(im, F_ALWAYS_CHECK_DISK))
|
||||||
{
|
{
|
||||||
/* invalidate image */
|
time_t current_modified_time;
|
||||||
IM_FLAG_SET(im, F_INVALID);
|
|
||||||
|
current_modified_time = ila->fp ?
|
||||||
|
__imlib_FileModDateFd(fileno(ila->fp)) :
|
||||||
|
__imlib_FileModDate(im->real_file);
|
||||||
|
/* if the file on disk is newer than the cached one */
|
||||||
|
if (current_modified_time != im->moddate)
|
||||||
|
{
|
||||||
|
/* invalidate image */
|
||||||
|
IM_FLAG_SET(im, F_INVALID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* image is ok to re-use - program is just being stupid loading */
|
||||||
|
/* the same data twice */
|
||||||
|
im->references++;
|
||||||
|
return im;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* image is ok to re-use - program is just being stupid loading */
|
|
||||||
/* the same data twice */
|
|
||||||
im->references++;
|
im->references++;
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
im->references++;
|
|
||||||
return im;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
im_file = im_key = NULL;
|
im_file = im_key = NULL;
|
||||||
|
|
Loading…
Reference in New Issue