forked from enlightenment/efl
evas_object_image.c/Evas.h: Added Eo apis for image preload.
1. Added evas_obj_image_preload_begin/cancel APIs. 2. Removed evas_obj_image_preload. This accepts 'cancel' as a parameter and it's so confusing to developers. 3. No ChangeLog/NEWS for this change because Eo APIs were not released yet. 4. Discussed with Raster. 5. It's encouraged to use elm_image however. elm_image has elm_image_preload_disabled_set() API.
This commit is contained in:
parent
8027d5f5d7
commit
20ff3f1bd2
|
@ -18471,7 +18471,8 @@ enum
|
|||
EVAS_OBJ_IMAGE_SUB_ID_DATA_CONVERT,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_DATA_SET,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_DATA_GET,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_PRELOAD,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_PRELOAD_BEGIN,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_PRELOAD_CANCEL,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_DATA_COPY_SET,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_DATA_UPDATE_ADD,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_ALPHA_SET,
|
||||
|
@ -18978,16 +18979,24 @@ enum
|
|||
#define evas_obj_image_smooth_scale_get(smooth_scale) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SMOOTH_SCALE_GET), EO_TYPECHECK(Eina_Bool *, smooth_scale)
|
||||
|
||||
/**
|
||||
* @def evas_obj_image_preload
|
||||
* @def evas_obj_image_preload_begin
|
||||
* @since 1.8
|
||||
*
|
||||
* Preload an image object's image data in the background
|
||||
*
|
||||
* @param[in] cancel in
|
||||
* Begin preloading an image object's image data in the background
|
||||
*
|
||||
* @see evas_object_image_preload
|
||||
*/
|
||||
#define evas_obj_image_preload(cancel) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_PRELOAD), EO_TYPECHECK(Eina_Bool, cancel)
|
||||
#define evas_obj_image_preload_begin() EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_PRELOAD_BEGIN)
|
||||
|
||||
/**
|
||||
* @def evas_obj_image_preload_cancel
|
||||
* @since 1.8
|
||||
*
|
||||
* Cancel preloading an image object's image data in the background
|
||||
*
|
||||
* @see evas_object_image_preload
|
||||
*/
|
||||
#define evas_obj_image_preload_cancel() EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_PRELOAD_CANCEL)
|
||||
|
||||
/**
|
||||
* @def evas_obj_image_reload
|
||||
|
|
|
@ -1566,11 +1566,14 @@ evas_object_image_preload(Evas_Object *eo_obj, Eina_Bool cancel)
|
|||
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
||||
return ;
|
||||
MAGIC_CHECK_END();
|
||||
eo_do(eo_obj, evas_obj_image_preload(cancel));
|
||||
if (cancel)
|
||||
eo_do(eo_obj, evas_obj_image_preload_cancel());
|
||||
else
|
||||
eo_do(eo_obj, evas_obj_image_preload_begin());
|
||||
}
|
||||
|
||||
static void
|
||||
_image_preload(Eo *eo_obj, void *_pd, va_list *list)
|
||||
_image_preload_internal(Eo *eo_obj, void *_pd, Eina_Bool cancel)
|
||||
{
|
||||
Evas_Object_Image *o = _pd;
|
||||
|
||||
|
@ -1583,7 +1586,6 @@ _image_preload(Eo *eo_obj, void *_pd, va_list *list)
|
|||
// FIXME: if already busy preloading, then dont request again until
|
||||
// preload done
|
||||
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
||||
Eina_Bool cancel = va_arg(*list, int);
|
||||
if (cancel)
|
||||
{
|
||||
if (o->preloading)
|
||||
|
@ -1606,6 +1608,18 @@ _image_preload(Eo *eo_obj, void *_pd, va_list *list)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_image_preload_begin(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
{
|
||||
_image_preload_internal(eo_obj, _pd, EINA_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
_image_preload_cancel(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
{
|
||||
_image_preload_internal(eo_obj, _pd, EINA_TRUE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_image_data_copy_set(Evas_Object *eo_obj, void *data)
|
||||
{
|
||||
|
@ -5093,7 +5107,8 @@ _class_constructor(Eo_Class *klass)
|
|||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_DATA_CONVERT), _image_data_convert),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_DATA_SET), _image_data_set),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_DATA_GET), _image_data_get),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_PRELOAD), _image_preload),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_PRELOAD_BEGIN), _image_preload_begin),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_PRELOAD_CANCEL), _image_preload_cancel),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_DATA_COPY_SET), _image_data_copy_set),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_DATA_UPDATE_ADD), _image_data_update_add),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_ALPHA_SET), _image_alpha_set),
|
||||
|
@ -5168,7 +5183,8 @@ static const Eo_Op_Description op_desc[] = {
|
|||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_DATA_CONVERT, "Converts the raw image data of the given image object to the specified colorspace."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_DATA_SET, "Sets the raw image data of the given image object."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_DATA_GET, "Get a pointer to the raw image data of the given image object."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_PRELOAD, "Preload an image object's image data in the background."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_PRELOAD_BEGIN, "Begin preload an image object's image data in the background."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_PRELOAD_CANCEL, "Cancel preload an image object's image data in the background."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_DATA_COPY_SET, "Replaces the raw image data of the given image object."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_DATA_UPDATE_ADD, "Mark a sub-region of the given image object to be redrawn."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_ALPHA_SET, "Enable or disable alpha channel usage on the given image object."),
|
||||
|
|
Loading…
Reference in New Issue