cache->func.dealloc(ie);
}
+static Eina_Bool
+_timestamp_compare(Image_Timestamp *tstamp, struct stat *st)
+{
+ if (tstamp->mtime != st->st_mtime) return EINA_FALSE;
+ if (tstamp->size != st->st_size) return EINA_FALSE;
+ if (tstamp->ino != st->st_ino) return EINA_FALSE;
+#ifdef _STAT_VER_LINUX
+#ifdef __USE_MISC
+ if (tstamp->mtime_nsec != (unsigned long int)st->st_mtim.tv_nsec) return EINA_FALSE;
+#else
+ if (tstamp->mtime_nsec != (unsigned long int)st->st_mtimensec) return EINA_FALSE;
+#endif
+#endif
+ return EINA_TRUE;
+}
+
+static void
+_timestamp_build(Image_Timestamp *tstamp, struct stat *st)
+{
+ tstamp->mtime = st->st_mtime;
+ tstamp->size = st->st_size;
+ tstamp->ino = st->st_ino;
+#ifdef _STAT_VER_LINUX
+#ifdef __USE_MISC
+ tstamp->mtime_nsec = (unsigned long int)st->st_mtim.tv_nsec;
+#else
+ tstamp->mtime_nsec = (unsigned long int)st->st_mtimensec;
+#endif
+#endif
+}
+
static Image_Entry *
_evas_cache_image_entry_new(Evas_Cache_Image *cache,
const char *hkey,
- time_t timestamp,
+ Image_Timestamp *tstamp,
const char *file,
const char *key,
RGBA_Image_Loadopts *lo,
ie->file = file ? eina_stringshare_add(file) : NULL;
ie->key = key ? eina_stringshare_add(key) : NULL;
- ie->timestamp = timestamp;
- ie->laststat = time(NULL);
+ if (tstamp) ie->tstamp = *tstamp;
+ else memset(&ie->tstamp, 0, sizeof(Image_Timestamp));
ie->load_opts.scale_down_by = 0;
ie->load_opts.dpi = 0;
free(cache);
}
-#define STAT_GAP 2
-
EAPI Image_Entry *
evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error)
{
size_t file_length;
size_t key_length;
struct stat st;
+ Image_Timestamp tstamp;
assert(cache != NULL);
#endif
if (im)
{
- time_t t;
- int ok;
-
- ok = 1;
- t = time(NULL);
- if ((t - im->laststat) > STAT_GAP)
+ int ok = 1;
+
+ stat_done = 1;
+ if (stat(file, &st) < 0) goto on_stat_error;
{
- stat_done = 1;
- if (stat(file, &st) < 0) goto on_stat_error;
-
- im->laststat = t;
- if (st.st_mtime != im->timestamp) ok = 0;
+ if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
}
if (ok) goto on_ok;
#endif
if (im)
{
- int ok;
+ int ok = 1;
- ok = 1;
if (!stat_done)
{
- time_t t;
-
- t = time(NULL);
- if ((t - im->laststat) > STAT_GAP)
- {
- stat_done = 1;
- if (stat(file, &st) < 0) goto on_stat_error;
-
- im->laststat = t;
- if (st.st_mtime != im->timestamp) ok = 0;
- }
+ stat_done = 1;
+ if (stat(file, &st) < 0) goto on_stat_error;
+ if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
}
else
- if (st.st_mtime != im->timestamp) ok = 0;
+ if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
if (ok)
{
{
if (stat(file, &st) < 0) goto on_stat_error;
}
-
- im = _evas_cache_image_entry_new(cache, hkey, st.st_mtime, file, key, lo, error);
+ _timestamp_build(&tstamp, &st);
+ im = _evas_cache_image_entry_new(cache, hkey, &tstamp, file, key, lo, error);
if (!im) return NULL;
if (cache->func.debug)
error = cache->func.dirty(im_dirty, im);
if (cache->func.debug)
cache->func.debug("dirty-out", im_dirty);
-/*
- im_dirty = _evas_cache_image_entry_new(cache, NULL, im->timestamp, im->file, im->key, &im->load_opts, &error);
- if (!im_dirty) goto on_error;
-
- if (cache->func.debug)
- cache->func.debug("dirty-src", im);
- error = cache->func.dirty(im_dirty, im);
- if (cache->func.debug)
- cache->func.debug("dirty-out", im_dirty);
-
- if (error != 0) goto on_error;
- */
#ifdef EVAS_FRAME_QUEUING
LKL(im_dirty->lock_references);
#endif
error = cache->func.dirty(im_dirty, im);
if (cache->func.debug)
cache->func.debug("dirty-out", im_dirty);
-/*
- im_dirty = _evas_cache_image_entry_new(cache, NULL, im->timestamp, im->file, im->key, &im->load_opts, &error);
- if (!im_dirty) goto on_error;
-
- if (cache->func.debug)
- cache->func.debug("dirty-src", im);
- error = cache->func.dirty(im_dirty, im);
- if (cache->func.debug)
- cache->func.debug("dirty-out", im_dirty);
-
- if (error != 0) goto on_error;
- */
#ifdef EVAS_FRAME_QUEUING
LKL(im_dirty->lock_references);
#endif
(cspace == EVAS_COLORSPACE_YCBCR422P709_PL))
w &= ~0x1;
- im = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
+ im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL);
if (!im) return NULL;
im->space = cspace;
(cspace == EVAS_COLORSPACE_YCBCR422P709_PL))
w &= ~0x1;
- im = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
+ im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL);
im->w = w;
im->h = h;
im->flags.alpha = alpha;
cache = im->cache;
- new = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, &error);
+ new = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, &error);
if (!new) goto on_error;
new->flags.alpha = im->flags.alpha;
{
Image_Entry *im;
- im = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
+ im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL);
if (!im) return NULL;
#ifdef EVAS_FRAME_QUEUING