From 4821dcf1f8c5a65075cfa46dc5d0c922cccd32de Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Fri, 19 Dec 2008 21:56:31 +0000 Subject: [PATCH] always call image preloaded callback. if image was already preloaded, inform user. regular use case is to have image hidden, ask for preload and then show image on callback, if there is no callback, image is never shown. SVN revision: 38236 --- legacy/evas/src/lib/canvas/evas_object_image.c | 9 ++++++++- legacy/evas/src/lib/canvas/evas_object_inform.c | 6 ++++++ legacy/evas/src/lib/include/evas_private.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/legacy/evas/src/lib/canvas/evas_object_image.c b/legacy/evas/src/lib/canvas/evas_object_image.c index e643f52710..f991278b05 100644 --- a/legacy/evas/src/lib/canvas/evas_object_image.c +++ b/legacy/evas/src/lib/canvas/evas_object_image.c @@ -1049,6 +1049,9 @@ evas_object_image_data_get(const Evas_Object *obj, Evas_Bool for_writing) * This function request the preload of the data image in the background. The * worked is queued before being processed. * + * If image data is already loaded, it will callback + * EVAS_CALLBACK_IMAGE_PRELOADED immediatelly and do nothing else. + * * If cancel is set, it will remove the image from the workqueue. * * @param obj The given image object. @@ -1066,7 +1069,11 @@ evas_object_image_preload(const Evas_Object *obj, Evas_Bool cancel) MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return ; MAGIC_CHECK_END(); - if (!o->engine_data) return ; + if (!o->engine_data) + { + evas_object_inform_call_image_preloaded((Evas_Object *)obj); + return ; + } if (cancel) obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, o->engine_data); diff --git a/legacy/evas/src/lib/canvas/evas_object_inform.c b/legacy/evas/src/lib/canvas/evas_object_inform.c index 31271fcabd..07554297d5 100644 --- a/legacy/evas/src/lib/canvas/evas_object_inform.c +++ b/legacy/evas/src/lib/canvas/evas_object_inform.c @@ -38,3 +38,9 @@ evas_object_inform_call_changed_size_hints(Evas_Object *obj) { evas_object_event_callback_call(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, NULL); } + +void +evas_object_inform_call_image_preloaded(Evas_Object *obj) +{ + evas_object_event_callback_call(obj, EVAS_CALLBACK_IMAGE_PRELOADED, NULL); +} diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h index 009afc7935..ae1bcc982d 100644 --- a/legacy/evas/src/lib/include/evas_private.h +++ b/legacy/evas/src/lib/include/evas_private.h @@ -750,6 +750,7 @@ void evas_object_inform_call_move(Evas_Object *obj); void evas_object_inform_call_resize(Evas_Object *obj); void evas_object_inform_call_restack(Evas_Object *obj); void evas_object_inform_call_changed_size_hints(Evas_Object *obj); +void evas_object_inform_call_image_preloaded(Evas_Object *obj); void evas_object_intercept_cleanup(Evas_Object *obj); int evas_object_intercept_call_show(Evas_Object *obj); int evas_object_intercept_call_hide(Evas_Object *obj);