chasing somethnig really bizarre... but this works right now.

SVN revision: 28533
This commit is contained in:
Carsten Haitzler 2007-03-02 23:12:10 +00:00
parent e58afbca6e
commit 63a4cbb869
3 changed files with 22 additions and 21 deletions

View File

@ -1,10 +1,6 @@
#include "evas_common.h"
#include "evas_private.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
extern Evas_List *evas_modules;
EAPI RGBA_Image *
@ -17,6 +13,7 @@ evas_common_load_image_from_file(const char *file, const char *key, RGBA_Image_L
char *loader = NULL;
Evas_Module *em;
struct stat st;
// time_t t;
if (file == NULL) return NULL;
@ -26,12 +23,14 @@ evas_common_load_image_from_file(const char *file, const char *key, RGBA_Image_L
evas_common_image_ref(im);
return im;
}
// t = time();
if (stat(file, &st) < 0) return NULL;
im = evas_common_image_new();
if (!im) return NULL;
im->timestamp = st.st_mtime;
// im->last_stat = t;
if (lo) im->load_opts = *lo;

View File

@ -478,7 +478,8 @@ evas_common_image_find(const char *file, const char *key, DATA64 timestamp, RGBA
char buf[4096 + 1024];
Evas_Object_List *l;
struct stat st;
static time_t last_stat = 0, t, mt;
static time_t last_stat = 0;
time_t t, mt = 0;
if ((!file) && (!key)) return NULL;
if (!file) return NULL;
@ -500,33 +501,32 @@ evas_common_image_find(const char *file, const char *key, DATA64 timestamp, RGBA
else
snprintf(buf, sizeof(buf), "//@/%i/%1.5f/%ix%i//%s", lo->scale_down_by, lo->dpi, lo->w, lo->h, file);
}
// t = time();
im = evas_hash_find(images, buf);
t = time();
if (im)
{
if ((t - last_stat) < STAT_GAP)
return im;
else
// if ((t - im->last_stat) < STAT_GAP)
// return im;
// else
{
struct stat st;
if (stat(file, &st) != 0) return NULL;
if (stat(file, &st) < 0) return NULL;
mt = st.st_mtime;
if (mt == im->timestamp)
{
last_stat = t;
// im->last_stat = t;
return im;
}
}
}
else
{
if ((t - last_stat) >= STAT_GAP)
{
if (stat(file, &st) != 0) return NULL;
// if ((t - last_stat) >= STAT_GAP)
// {
if (stat(file, &st) < 0) return NULL;
mt = st.st_mtime;
last_stat = t;
}
// }
}
for (l = cache; l; l = l->next)
@ -550,13 +550,13 @@ evas_common_image_find(const char *file, const char *key, DATA64 timestamp, RGBA
ok++;
else continue;
if ((t - last_stat) >= STAT_GAP)
{
// if ((t - im->last_stat) >= STAT_GAP)
// {
if (im->timestamp == mt)
ok++;
else continue;
}
else ok++;
// }
// else ok++;
if ((lo->scale_down_by == lo2->scale_down_by) &&
(lo->dpi == lo2->dpi) && (lo->w == lo2->w) &&
@ -564,6 +564,7 @@ evas_common_image_find(const char *file, const char *key, DATA64 timestamp, RGBA
ok++;
else continue;
// im->last_stat = t;
return im;
}
/*

View File

@ -348,12 +348,13 @@ struct _RGBA_Image
char *comment;
} info;
int references;
time_t timestamp;
void *extended_info;
RGBA_Image_Loadopts load_opts;
unsigned char scale;
RGBA_Pipe *pipe;
int ref;
time_t timestamp;
time_t laststat;
struct {
void *data;
int space;