fix load opts to only unload/reload if opts changed for cserve

SVN revision: 40573
This commit is contained in:
Carsten Haitzler 2009-05-10 03:06:49 +00:00
parent 22969c71ef
commit 47f6f036c1
4 changed files with 40 additions and 7 deletions

View File

@ -455,7 +455,6 @@ img_new(const char *file, const char *key, RGBA_Image_Loadopts *load_opts, const
img->image.alpha = ie->flags.alpha; img->image.alpha = ie->flags.alpha;
img->ref = 1; img->ref = 1;
img->active = 1; img->active = 1;
img->usage = sizeof(Img) + strlen(img->key) + 1 + img->usage = sizeof(Img) + strlen(img->key) + 1 +
strlen(img->file.file) + 1; strlen(img->file.file) + 1;
if (img->file.key) img->usage += strlen(img->file.key) + 1; if (img->file.key) img->usage += strlen(img->file.key) + 1;

View File

@ -676,7 +676,6 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
ok = 1; ok = 1;
t = time(NULL); t = time(NULL);
if ((t - im->laststat) > STAT_GAP) if ((t - im->laststat) > STAT_GAP)
{ {
stat_done = 1; stat_done = 1;
@ -730,8 +729,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
} }
im = _evas_cache_image_entry_new(cache, hkey, st.st_mtime, file, key, lo, error); im = _evas_cache_image_entry_new(cache, hkey, st.st_mtime, file, key, lo, error);
if (!im) if (!im) return NULL;
return NULL;
if (cache->func.debug) if (cache->func.debug)
cache->func.debug("request", im); cache->func.debug("request", im);
@ -814,6 +812,18 @@ evas_cache_image_dirty(Image_Entry *im, int x, int y, int w, int h)
{ {
int error; int error;
im_dirty = evas_cache_image_copied_data
(cache, im->w, im->h,
evas_cache_image_pixels(im),
im->flags.alpha,
im->space);
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);
/*
im_dirty = _evas_cache_image_entry_new(cache, NULL, im->timestamp, im->file, im->key, &im->load_opts, &error); 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 (!im_dirty) goto on_error;
@ -824,7 +834,7 @@ evas_cache_image_dirty(Image_Entry *im, int x, int y, int w, int h)
cache->func.debug("dirty-out", im_dirty); cache->func.debug("dirty-out", im_dirty);
if (error != 0) goto on_error; if (error != 0) goto on_error;
*/
im_dirty->references = 1; im_dirty->references = 1;
evas_cache_image_drop(im); evas_cache_image_drop(im);
@ -869,6 +879,18 @@ evas_cache_image_alone(Image_Entry *im)
{ {
int error; int error;
im_dirty = evas_cache_image_copied_data
(cache, im->w, im->h,
evas_cache_image_pixels(im),
im->flags.alpha,
im->space);
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);
/*
im_dirty = _evas_cache_image_entry_new(cache, NULL, im->timestamp, im->file, im->key, &im->load_opts, &error); 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 (!im_dirty) goto on_error;
@ -879,7 +901,7 @@ evas_cache_image_alone(Image_Entry *im)
cache->func.debug("dirty-out", im_dirty); cache->func.debug("dirty-out", im_dirty);
if (error != 0) goto on_error; if (error != 0) goto on_error;
*/
im_dirty->references = 1; im_dirty->references = 1;
evas_cache_image_drop(im); evas_cache_image_drop(im);

View File

@ -1588,6 +1588,7 @@ evas_object_image_load_dpi_set(Evas_Object *obj, double dpi)
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return; return;
MAGIC_CHECK_END(); MAGIC_CHECK_END();
if (dpi == o->load_opts.dpi) return;
o->load_opts.dpi = dpi; o->load_opts.dpi = dpi;
if (o->cur.file) if (o->cur.file)
{ {
@ -1637,6 +1638,7 @@ evas_object_image_load_size_set(Evas_Object *obj, int w, int h)
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return; return;
MAGIC_CHECK_END(); MAGIC_CHECK_END();
if ((o->load_opts.w == w) && (o->load_opts.h == h)) return;
o->load_opts.w = w; o->load_opts.w = w;
o->load_opts.h = h; o->load_opts.h = h;
if (o->cur.file) if (o->cur.file)
@ -1682,6 +1684,7 @@ evas_object_image_load_scale_down_set(Evas_Object *obj, int scale_down)
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return; return;
MAGIC_CHECK_END(); MAGIC_CHECK_END();
if (o->load_opts.scale_down_by == scale_down) return;
o->load_opts.scale_down_by = scale_down; o->load_opts.scale_down_by = scale_down;
if (o->cur.file) if (o->cur.file)
{ {

View File

@ -246,6 +246,8 @@ _sci_find(RGBA_Image *im,
sci->usage = 0; sci->usage = 0;
sci->usage_count = 0; sci->usage_count = 0;
sci->populate_me = 0; sci->populate_me = 0;
sci->smooth = smooth;
sci->forced_unload = 0;
sci->flop = 0; sci->flop = 0;
sci->im = NULL; sci->im = NULL;
sci->src_x = src_region_x; sci->src_x = src_region_x;
@ -254,7 +256,6 @@ _sci_find(RGBA_Image *im,
sci->src_h = src_region_h; sci->src_h = src_region_h;
sci->dst_w = dst_region_w; sci->dst_w = dst_region_w;
sci->dst_h = dst_region_h; sci->dst_h = dst_region_h;
sci->smooth = smooth;
im->cache.list = eina_list_prepend(im->cache.list, sci); im->cache.list = eina_list_prepend(im->cache.list, sci);
return sci; return sci;
} }
@ -299,6 +300,7 @@ _cache_prune(Scaleitem *notsci, Evas_Bool copies_only)
EAPI void EAPI void
evas_common_rgba_image_scalecache_size_set(int size) evas_common_rgba_image_scalecache_size_set(int size)
{ {
#ifdef SCALECACHE
LKL(cache_lock); LKL(cache_lock);
if (size != max_cache_size) if (size != max_cache_size)
{ {
@ -306,21 +308,27 @@ evas_common_rgba_image_scalecache_size_set(int size)
_cache_prune(NULL, 1); _cache_prune(NULL, 1);
} }
LKU(cache_lock); LKU(cache_lock);
#endif
} }
EAPI int EAPI int
evas_common_rgba_image_scalecache_size_get(void) evas_common_rgba_image_scalecache_size_get(void)
{ {
#ifdef SCALECACHE
int t; int t;
LKL(cache_lock); LKL(cache_lock);
t = max_cache_size; t = max_cache_size;
LKU(cache_lock); LKU(cache_lock);
return t; return t;
#else
return 0;
#endif
} }
EAPI void EAPI void
evas_common_rgba_image_scalecache_flush(void) evas_common_rgba_image_scalecache_flush(void)
{ {
#ifdef SCALECACHE
int t; int t;
LKL(cache_lock); LKL(cache_lock);
t = max_cache_size; t = max_cache_size;
@ -328,6 +336,7 @@ evas_common_rgba_image_scalecache_flush(void)
_cache_prune(NULL, 1); _cache_prune(NULL, 1);
max_cache_size = t; max_cache_size = t;
LKU(cache_lock); LKU(cache_lock);
#endif
} }
EAPI void EAPI void