forked from enlightenment/efl
chasing somethnig really bizarre... but this works right now.
SVN revision: 28533
This commit is contained in:
parent
e58afbca6e
commit
63a4cbb869
|
@ -1,10 +1,6 @@
|
||||||
#include "evas_common.h"
|
#include "evas_common.h"
|
||||||
#include "evas_private.h"
|
#include "evas_private.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
extern Evas_List *evas_modules;
|
extern Evas_List *evas_modules;
|
||||||
|
|
||||||
EAPI RGBA_Image *
|
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;
|
char *loader = NULL;
|
||||||
Evas_Module *em;
|
Evas_Module *em;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
// time_t t;
|
||||||
|
|
||||||
if (file == NULL) return NULL;
|
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);
|
evas_common_image_ref(im);
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
// t = time();
|
||||||
if (stat(file, &st) < 0) return NULL;
|
if (stat(file, &st) < 0) return NULL;
|
||||||
|
|
||||||
im = evas_common_image_new();
|
im = evas_common_image_new();
|
||||||
if (!im) return NULL;
|
if (!im) return NULL;
|
||||||
|
|
||||||
im->timestamp = st.st_mtime;
|
im->timestamp = st.st_mtime;
|
||||||
|
// im->last_stat = t;
|
||||||
|
|
||||||
if (lo) im->load_opts = *lo;
|
if (lo) im->load_opts = *lo;
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,8 @@ evas_common_image_find(const char *file, const char *key, DATA64 timestamp, RGBA
|
||||||
char buf[4096 + 1024];
|
char buf[4096 + 1024];
|
||||||
Evas_Object_List *l;
|
Evas_Object_List *l;
|
||||||
struct stat st;
|
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) && (!key)) return NULL;
|
||||||
if (!file) return NULL;
|
if (!file) return NULL;
|
||||||
|
@ -500,33 +501,32 @@ evas_common_image_find(const char *file, const char *key, DATA64 timestamp, RGBA
|
||||||
else
|
else
|
||||||
snprintf(buf, sizeof(buf), "//@/%i/%1.5f/%ix%i//%s", lo->scale_down_by, lo->dpi, lo->w, lo->h, file);
|
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);
|
im = evas_hash_find(images, buf);
|
||||||
t = time();
|
|
||||||
if (im)
|
if (im)
|
||||||
{
|
{
|
||||||
if ((t - last_stat) < STAT_GAP)
|
// if ((t - im->last_stat) < STAT_GAP)
|
||||||
return im;
|
// return im;
|
||||||
else
|
// else
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (stat(file, &st) != 0) return NULL;
|
if (stat(file, &st) < 0) return NULL;
|
||||||
mt = st.st_mtime;
|
mt = st.st_mtime;
|
||||||
if (mt == im->timestamp)
|
if (mt == im->timestamp)
|
||||||
{
|
{
|
||||||
last_stat = t;
|
// im->last_stat = t;
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((t - last_stat) >= STAT_GAP)
|
// if ((t - last_stat) >= STAT_GAP)
|
||||||
{
|
// {
|
||||||
if (stat(file, &st) != 0) return NULL;
|
if (stat(file, &st) < 0) return NULL;
|
||||||
mt = st.st_mtime;
|
mt = st.st_mtime;
|
||||||
last_stat = t;
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l = cache; l; l = l->next)
|
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++;
|
ok++;
|
||||||
else continue;
|
else continue;
|
||||||
|
|
||||||
if ((t - last_stat) >= STAT_GAP)
|
// if ((t - im->last_stat) >= STAT_GAP)
|
||||||
{
|
// {
|
||||||
if (im->timestamp == mt)
|
if (im->timestamp == mt)
|
||||||
ok++;
|
ok++;
|
||||||
else continue;
|
else continue;
|
||||||
}
|
// }
|
||||||
else ok++;
|
// else ok++;
|
||||||
|
|
||||||
if ((lo->scale_down_by == lo2->scale_down_by) &&
|
if ((lo->scale_down_by == lo2->scale_down_by) &&
|
||||||
(lo->dpi == lo2->dpi) && (lo->w == lo2->w) &&
|
(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++;
|
ok++;
|
||||||
else continue;
|
else continue;
|
||||||
|
|
||||||
|
// im->last_stat = t;
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -348,12 +348,13 @@ struct _RGBA_Image
|
||||||
char *comment;
|
char *comment;
|
||||||
} info;
|
} info;
|
||||||
int references;
|
int references;
|
||||||
time_t timestamp;
|
|
||||||
void *extended_info;
|
void *extended_info;
|
||||||
RGBA_Image_Loadopts load_opts;
|
RGBA_Image_Loadopts load_opts;
|
||||||
unsigned char scale;
|
unsigned char scale;
|
||||||
RGBA_Pipe *pipe;
|
RGBA_Pipe *pipe;
|
||||||
int ref;
|
int ref;
|
||||||
|
time_t timestamp;
|
||||||
|
time_t laststat;
|
||||||
struct {
|
struct {
|
||||||
void *data;
|
void *data;
|
||||||
int space;
|
int space;
|
||||||
|
|
Loading…
Reference in New Issue