forked from enlightenment/efl
Correctly cancel each image object and not all at once.
SVN revision: 38658
This commit is contained in:
parent
0d166092ac
commit
5621e47f1c
|
@ -154,7 +154,7 @@ EAPI Engine_Image_Entry* evas_cache_engine_image_size_set(Engine_Image_Entr
|
|||
EAPI void evas_cache_engine_image_load_data(Engine_Image_Entry *eim);
|
||||
|
||||
EAPI void evas_cache_image_preload_data(Image_Entry *im, const void *target);
|
||||
EAPI void evas_cache_image_preload_cancel(Image_Entry *im);
|
||||
EAPI void evas_cache_image_preload_cancel(Image_Entry *im, const void *target);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -300,6 +300,22 @@ _evas_cache_image_entry_surface_alloc(Evas_Cache_Image *cache,
|
|||
}
|
||||
|
||||
#ifdef BUILD_ASYNC_PRELOAD
|
||||
static void
|
||||
_evas_cache_image_async_call(Image_Entry *im)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
while (im->targets)
|
||||
{
|
||||
Evas_Cache_Target *tmp = im->targets;
|
||||
|
||||
evas_async_events_put(tmp->target, EVAS_CALLBACK_IMAGE_PRELOADED, NULL,
|
||||
(void (*)(void*, Evas_Callback_Type, void*))evas_object_event_callback_call);
|
||||
im->targets = (Evas_Cache_Target*) eina_inlist_remove(EINA_INLIST_GET(im->targets), EINA_INLIST_GET(im->targets));
|
||||
free(tmp);
|
||||
}
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
static int
|
||||
_evas_cache_image_entry_preload_add(Image_Entry *ie,
|
||||
const void *target)
|
||||
|
@ -347,7 +363,7 @@ _evas_cache_image_entry_preload_add(Image_Entry *ie,
|
|||
}
|
||||
|
||||
static int
|
||||
_evas_cache_image_entry_preload_remove(Image_Entry *ie)
|
||||
_evas_cache_image_entry_preload_remove(Image_Entry *ie, const void *target)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
@ -369,9 +385,35 @@ _evas_cache_image_entry_preload_remove(Image_Entry *ie)
|
|||
{
|
||||
if (l->ie == ie)
|
||||
{
|
||||
preload = eina_inlist_remove(preload,
|
||||
EINA_INLIST_GET(l));
|
||||
free(l);
|
||||
Evas_Cache_Target *tg;
|
||||
|
||||
if (target) {
|
||||
EINA_INLIST_FOREACH(ie->targets, tg)
|
||||
{
|
||||
if (tg->target == target) {
|
||||
ie->targets = (Evas_Cache_Target*) eina_inlist_remove(EINA_INLIST_GET(ie->targets), EINA_INLIST_GET(tg));
|
||||
free(tg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_evas_cache_image_async_call(ie);
|
||||
|
||||
while (ie->targets)
|
||||
{
|
||||
tg = ie->targets;
|
||||
ie->targets = (Evas_Cache_Target*) eina_inlist_remove(EINA_INLIST_GET(ie->targets), EINA_INLIST_GET(tg));
|
||||
free(tg);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ie->targets)
|
||||
{
|
||||
preload = eina_inlist_remove(preload,
|
||||
EINA_INLIST_GET(l));
|
||||
free(l);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -385,22 +427,6 @@ _evas_cache_image_entry_preload_remove(Image_Entry *ie)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_evas_cache_image_async_call(Image_Entry *im)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
while (im->targets)
|
||||
{
|
||||
Evas_Cache_Target *tmp = im->targets;
|
||||
|
||||
evas_async_events_put(tmp->target, EVAS_CALLBACK_IMAGE_PRELOADED, NULL,
|
||||
(void (*)(void*, Evas_Callback_Type, void*))evas_object_event_callback_call);
|
||||
im->targets = (Evas_Cache_Target*) eina_inlist_remove(EINA_INLIST_GET(im->targets), EINA_INLIST_GET(im->targets));
|
||||
free(tmp);
|
||||
}
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
#endif
|
||||
|
||||
EAPI int
|
||||
|
@ -677,7 +703,7 @@ evas_cache_image_drop(Image_Entry *im)
|
|||
if (im->references == 0)
|
||||
{
|
||||
#ifdef BUILD_ASYNC_PRELOAD
|
||||
_evas_cache_image_entry_preload_remove(im);
|
||||
_evas_cache_image_entry_preload_remove(im, NULL);
|
||||
#endif
|
||||
|
||||
if (im->flags.dirty)
|
||||
|
@ -945,7 +971,7 @@ evas_cache_image_load_data(Image_Entry *im)
|
|||
#ifdef BUILD_ASYNC_PRELOAD
|
||||
int preload = im->flags.preload;
|
||||
/* We check a first time, to prevent useless lock. */
|
||||
_evas_cache_image_entry_preload_remove(im);
|
||||
_evas_cache_image_entry_preload_remove(im, NULL);
|
||||
if (im->flags.loaded) return ;
|
||||
pthread_mutex_lock(&im->lock);
|
||||
#endif
|
||||
|
@ -1005,7 +1031,7 @@ evas_cache_image_preload_data(Image_Entry *im, const void *target)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
evas_cache_image_preload_cancel(Image_Entry *im)
|
||||
evas_cache_image_preload_cancel(Image_Entry *im, const void *target)
|
||||
{
|
||||
#ifdef BUILD_ASYNC_PRELOAD
|
||||
Evas_Cache_Image *cache;
|
||||
|
@ -1014,7 +1040,7 @@ evas_cache_image_preload_cancel(Image_Entry *im)
|
|||
assert(im->cache);
|
||||
cache = im->cache;
|
||||
|
||||
_evas_cache_image_entry_preload_remove(im);
|
||||
_evas_cache_image_entry_preload_remove(im, target);
|
||||
#else
|
||||
(void) im;
|
||||
#endif
|
||||
|
|
|
@ -267,7 +267,8 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
|
|||
|
||||
if (!o->engine_data)
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
o->engine_data,
|
||||
obj);
|
||||
|
||||
if (o->cur.file) eina_stringshare_del(o->cur.file);
|
||||
if (o->cur.key) eina_stringshare_del(o->cur.key);
|
||||
|
@ -1081,7 +1082,8 @@ evas_object_image_preload(Evas_Object *obj, Evas_Bool cancel)
|
|||
}
|
||||
if (cancel)
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
o->engine_data,
|
||||
obj);
|
||||
else
|
||||
obj->layer->evas->engine.func->image_data_preload_request(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
|
|
|
@ -632,7 +632,7 @@ struct _Evas_Func
|
|||
void *(*image_data_get) (void *data, void *image, int to_write, DATA32 **image_data);
|
||||
void *(*image_data_put) (void *data, void *image, DATA32 *image_data);
|
||||
void (*image_data_preload_request) (void *data, void *image, const void *target);
|
||||
void (*image_data_preload_cancel) (void *data, void *image);
|
||||
void (*image_data_preload_cancel) (void *data, void *image, const void *target);
|
||||
void *(*image_alpha_set) (void *data, void *image, int has_alpha);
|
||||
int (*image_alpha_get) (void *data, void *image);
|
||||
void *(*image_border_set) (void *data, void *image, int l, int r, int t, int b);
|
||||
|
|
|
@ -79,8 +79,8 @@ static void *eng_image_size_set(void *data, void *image, int w, int h);
|
|||
static void *eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h);
|
||||
static void *eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data);
|
||||
static void *eng_image_data_put(void *data, void *image, DATA32 *image_data);
|
||||
static void eng_image_data_preload_request(void *data, void *image, void *target);
|
||||
static void eng_image_data_preload_cancel(void *data, void *image);
|
||||
static void eng_image_data_preload_request(void *data, void *image, const void *target);
|
||||
static void eng_image_data_preload_cancel(void *data, void *image, const void *target);
|
||||
static void *eng_image_alpha_set(void *data, void *image, int has_alpha);
|
||||
static int eng_image_alpha_get(void *data, void *image);
|
||||
static void *eng_image_border_set(void *data, void *image, int l, int r, int t, int b);
|
||||
|
@ -1047,7 +1047,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_request(void *data, void *image, void *target)
|
||||
eng_image_data_preload_request(void *data, void *image, const void *target)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
|
@ -1057,7 +1057,7 @@ eng_image_data_preload_request(void *data, void *image, void *target)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_cancel(void *data, void *image)
|
||||
eng_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
|
|
|
@ -1414,7 +1414,7 @@ evas_engine_dfb_image_data_put(void *data, void *image, DATA32* image_data)
|
|||
}
|
||||
|
||||
static void
|
||||
evas_engine_dfb_image_data_preload_request(void *data, void *image, void *target)
|
||||
evas_engine_dfb_image_data_preload_request(void *data, void *image, const void *target)
|
||||
{
|
||||
DirectFB_Engine_Image_Entry *deie = image;
|
||||
RGBA_Image *im;
|
||||
|
@ -1426,7 +1426,7 @@ evas_engine_dfb_image_data_preload_request(void *data, void *image, void *target
|
|||
}
|
||||
|
||||
static void
|
||||
evas_engine_dfb_image_data_preload_cancel(void *data, void *image)
|
||||
evas_engine_dfb_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||
{
|
||||
DirectFB_Engine_Image_Entry *deie = image;
|
||||
RGBA_Image *im;
|
||||
|
@ -1434,7 +1434,7 @@ evas_engine_dfb_image_data_preload_cancel(void *data, void *image)
|
|||
if (!deie) return ;
|
||||
im = (RGBA_Image*) deie->cache_entry.src;
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_cancel(&im->cache_entry);
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
|
@ -837,7 +837,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_request(void *data, void *image, void *target)
|
||||
eng_image_data_preload_request(void *data, void *image, const void *target)
|
||||
{
|
||||
Evas_GL_Image *gim = image;
|
||||
RGBA_Image *im;
|
||||
|
@ -849,7 +849,7 @@ eng_image_data_preload_request(void *data, void *image, void *target)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_cancel(void *data, void *image)
|
||||
eng_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||
{
|
||||
Evas_GL_Image *gim = image;
|
||||
RGBA_Image *im;
|
||||
|
@ -857,7 +857,7 @@ eng_image_data_preload_cancel(void *data, void *image)
|
|||
if (!gim) return ;
|
||||
im = (RGBA_Image*) gim->im;
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_cancel(&im->cache_entry);
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -967,7 +967,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_request(void *data, void *image, void *target)
|
||||
eng_image_data_preload_request(void *data, void *image, const void *target)
|
||||
{
|
||||
Evas_GL_Image *gim = image;
|
||||
RGBA_Image *im;
|
||||
|
@ -979,7 +979,7 @@ eng_image_data_preload_request(void *data, void *image, void *target)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_cancel(void *data, void *image)
|
||||
eng_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||
{
|
||||
Evas_GL_Image *gim = image;
|
||||
RGBA_Image *im;
|
||||
|
@ -987,7 +987,7 @@ eng_image_data_preload_cancel(void *data, void *image)
|
|||
if (!gim) return ;
|
||||
im = (RGBA_Image*) gim->im;
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_cancel(&im->cache_entry);
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -624,12 +624,12 @@ eng_image_data_preload_request(void *data, void *image, const void *target)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_cancel(void *data, void *image)
|
||||
eng_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||
{
|
||||
Soft16_Image *im = image;
|
||||
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_cancel(&im->cache_entry);
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -742,7 +742,7 @@ evas_engine_sdl16_image_data_preload_request(void *data, void *image, const void
|
|||
}
|
||||
|
||||
static void
|
||||
evas_engine_sdl16_image_data_preload_cancel(void *data, void *image)
|
||||
evas_engine_sdl16_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||
{
|
||||
SDL_Engine_Image_Entry *eim = image;
|
||||
Soft16_Image *im;
|
||||
|
@ -750,7 +750,7 @@ evas_engine_sdl16_image_data_preload_cancel(void *data, void *image)
|
|||
if (!eim) return ;
|
||||
im = (Soft16_Image *) eim->cache_entry.src;
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_cancel(&im->cache_entry);
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void*
|
||||
|
|
|
@ -723,12 +723,12 @@ eng_image_data_preload_request(void *data, void *image, const void *target)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_cancel(void *data, void *image)
|
||||
eng_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||
{
|
||||
RGBA_Image *im = image;
|
||||
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_cancel(&im->cache_entry);
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -515,7 +515,7 @@ evas_engine_sdl_image_data_preload_request(void *data, void *image, const void *
|
|||
}
|
||||
|
||||
static void
|
||||
evas_engine_sdl_image_data_preload_cancel(void *data, void *image)
|
||||
evas_engine_sdl_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||
{
|
||||
SDL_Engine_Image_Entry *eim = image;
|
||||
RGBA_Image *im;
|
||||
|
@ -523,7 +523,7 @@ evas_engine_sdl_image_data_preload_cancel(void *data, void *image)
|
|||
if (!eim) return ;
|
||||
im = (RGBA_Image*) eim->cache_entry.src;
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_cancel(&im->cache_entry);
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void*
|
||||
|
|
|
@ -915,7 +915,7 @@ eng_image_data_preload_request(void *data, void *image, const void *target)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_image_data_preload_cancel(void *data, void *image)
|
||||
eng_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||
{
|
||||
XR_Image *xim = image;
|
||||
RGBA_Image *im;
|
||||
|
@ -923,7 +923,7 @@ eng_image_data_preload_cancel(void *data, void *image)
|
|||
if (!xim) return ;
|
||||
im = (RGBA_Image*) xim->im;
|
||||
if (!im) return ;
|
||||
evas_cache_image_preload_cancel(&im->cache_entry);
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue