always call image preloaded callback.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 19 Dec 2008 21:56:31 +0000 (21:56 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 19 Dec 2008 21:56:31 +0000 (21:56 +0000)
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.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@38236 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_image.c
src/lib/canvas/evas_object_inform.c
src/lib/include/evas_private.h

index e643f52..f991278 100644 (file)
@@ -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);
index 31271fc..0755429 100644 (file)
@@ -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);
+}
index 009afc7..ae1bcc9 100644 (file)
@@ -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);