fix image preload signature and make it callback if already preloaded.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 20 Dec 2008 13:39:15 +0000 (13:39 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 20 Dec 2008 13:39:15 +0000 (13:39 +0000)
evas_object_image_preload() should not use object as const because it
will mdofiy the object state (so it's semantic makes more sense).

if data was already loaded, then callback before ignored it (return).

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@38246 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Evas.h
src/lib/cache/evas_cache_image.c
src/lib/canvas/evas_object_image.c

index 3ec8b83..67794d3 100644 (file)
@@ -532,7 +532,7 @@ extern "C" {
    EAPI Evas_Bool         evas_object_image_alpha_get       (const Evas_Object *obj);
    EAPI void              evas_object_image_smooth_scale_set(Evas_Object *obj, Evas_Bool smooth_scale);
    EAPI Evas_Bool         evas_object_image_smooth_scale_get(const Evas_Object *obj);
-   EAPI void              evas_object_image_preload         (const Evas_Object *obj, Evas_Bool cancel);
+   EAPI void              evas_object_image_preload         (Evas_Object *obj, Evas_Bool cancel);
    EAPI void              evas_object_image_reload          (Evas_Object *obj);
    EAPI Evas_Bool         evas_object_image_save            (const Evas_Object *obj, const char *file, const char *key, const char *flags);
    EAPI Evas_Bool         evas_object_image_pixels_import          (Evas_Object *obj, Evas_Pixel_Import_Source *pixels);
index be6dc60..05cd340 100644 (file)
@@ -906,7 +906,11 @@ evas_cache_image_preload_data(Image_Entry *im, const void *target)
    assert(im);
    assert(im->cache);
 
-   if (im->flags.loaded) return ;
+   if (im->flags.loaded)
+     {
+       evas_async_events_put(target, EVAS_CALLBACK_IMAGE_PRELOADED, NULL, evas_object_event_callback_call);
+       return ;
+     }
 
    cache = im->cache;
 
index f991278..6d518a5 100644 (file)
@@ -1058,7 +1058,7 @@ evas_object_image_data_get(const Evas_Object *obj, Evas_Bool for_writing)
  * @param cancel 0 means add to the workqueue, 1 remove it.
  */
 EAPI void
-evas_object_image_preload(const Evas_Object *obj, Evas_Bool cancel)
+evas_object_image_preload(Evas_Object *obj, Evas_Bool cancel)
 {
    Evas_Object_Image *o;
 
@@ -1071,7 +1071,7 @@ evas_object_image_preload(const Evas_Object *obj, Evas_Bool cancel)
    MAGIC_CHECK_END();
    if (!o->engine_data)
      {
-       evas_object_inform_call_image_preloaded((Evas_Object *)obj);
+       evas_object_inform_call_image_preloaded(obj);
        return ;
      }
    if (cancel)