evas/evas_object_image - added EVAS_CALLBACK_IMAGE_RESIZE.

SVN revision: 76161
This commit is contained in:
ChunEon Park 2012-09-05 04:20:42 +00:00
parent 325526af5c
commit f7f9341419
6 changed files with 38 additions and 0 deletions

View File

@ -1020,3 +1020,7 @@
need the evas to get the framespace clip object, just directly use the need the evas to get the framespace clip object, just directly use the
framespace values from the canvas, rather than function call to get framespace values from the canvas, rather than function call to get
those values. those values.
2012-09-05 ChunEon Park (Hermet)
* Added EVAS_CALLBACK_IMAGE_RESIZE. Now user have a notify when image data size of the image object is changed.

View File

@ -6,6 +6,7 @@ Changes since Evas 1.7.0:
Additions: Additions:
* WEBP image loader support. * WEBP image loader support.
* EVAS_CALLBACK_IMAGE_RESIZE.
Improvements: Improvements:

View File

@ -425,6 +425,7 @@ typedef enum _Evas_Callback_Type
EVAS_CALLBACK_HOLD, /**< Events go on/off hold */ EVAS_CALLBACK_HOLD, /**< Events go on/off hold */
EVAS_CALLBACK_CHANGED_SIZE_HINTS, /**< Size hints changed event */ EVAS_CALLBACK_CHANGED_SIZE_HINTS, /**< Size hints changed event */
EVAS_CALLBACK_IMAGE_PRELOADED, /**< Image has been preloaded */ EVAS_CALLBACK_IMAGE_PRELOADED, /**< Image has been preloaded */
EVAS_CALLBACK_IMAGE_RESIZE, /**< Image size is changed @since 1.8 */
/* /*
* The following events are only for use with Evas canvases, with * The following events are only for use with Evas canvases, with

View File

@ -319,6 +319,7 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
{ {
Evas_Object_Image *o; Evas_Object_Image *o;
Evas_Image_Load_Opts lo; Evas_Image_Load_Opts lo;
Eina_Bool resize_call = EINA_FALSE;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return; return;
@ -387,6 +388,10 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
stride = w * 4; stride = w * 4;
o->cur.has_alpha = obj->layer->evas->engine.func->image_alpha_get(obj->layer->evas->engine.data.output, o->engine_data); o->cur.has_alpha = obj->layer->evas->engine.func->image_alpha_get(obj->layer->evas->engine.data.output, o->engine_data);
o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output, o->engine_data); o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output, o->engine_data);
if ((o->cur.image.w != w) || (o->cur.image.h != h))
resize_call = EINA_TRUE;
o->cur.image.w = w; o->cur.image.w = w;
o->cur.image.h = h; o->cur.image.h = h;
o->cur.image.stride = stride; o->cur.image.stride = stride;
@ -397,11 +402,17 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
o->load_error = EVAS_LOAD_ERROR_GENERIC; o->load_error = EVAS_LOAD_ERROR_GENERIC;
o->cur.has_alpha = 1; o->cur.has_alpha = 1;
o->cur.cspace = EVAS_COLORSPACE_ARGB8888; o->cur.cspace = EVAS_COLORSPACE_ARGB8888;
if ((o->cur.image.w != 0) || (o->cur.image.h != 0))
resize_call = EINA_TRUE;
o->cur.image.w = 0; o->cur.image.w = 0;
o->cur.image.h = 0; o->cur.image.h = 0;
o->cur.image.stride = 0; o->cur.image.stride = 0;
} }
o->changed = EINA_TRUE; o->changed = EINA_TRUE;
if (resize_call) evas_object_inform_call_image_resize(obj);
evas_object_change(obj); evas_object_change(obj);
} }
@ -822,6 +833,7 @@ evas_object_image_size_set(Evas_Object *obj, int w, int h)
*/ */
EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o); EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
o->changed = EINA_TRUE; o->changed = EINA_TRUE;
evas_object_inform_call_image_resize(obj);
evas_object_change(obj); evas_object_change(obj);
} }
@ -913,6 +925,7 @@ evas_object_image_data_set(Evas_Object *obj, void *data)
{ {
Evas_Object_Image *o; Evas_Object_Image *o;
void *p_data; void *p_data;
Eina_Bool resize_call = EINA_FALSE;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return; return;
@ -968,6 +981,8 @@ evas_object_image_data_set(Evas_Object *obj, void *data)
if (o->engine_data) if (o->engine_data)
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, o->engine_data); obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, o->engine_data);
o->load_error = EVAS_LOAD_ERROR_NONE; o->load_error = EVAS_LOAD_ERROR_NONE;
if ((o->cur.image.w != 0) || (o->cur.image.h != 0))
resize_call = EINA_TRUE;
o->cur.image.w = 0; o->cur.image.w = 0;
o->cur.image.h = 0; o->cur.image.h = 0;
o->cur.image.stride = 0; o->cur.image.stride = 0;
@ -986,6 +1001,7 @@ evas_object_image_data_set(Evas_Object *obj, void *data)
o->pixels_checked_out = 0; o->pixels_checked_out = 0;
} }
o->changed = EINA_TRUE; o->changed = EINA_TRUE;
if (resize_call) evas_object_inform_call_image_resize(obj);
evas_object_change(obj); evas_object_change(obj);
} }
@ -2525,6 +2541,7 @@ static void
evas_object_image_unload(Evas_Object *obj, Eina_Bool dirty) evas_object_image_unload(Evas_Object *obj, Eina_Bool dirty)
{ {
Evas_Object_Image *o; Evas_Object_Image *o;
Eina_Bool resize_call = EINA_FALSE;
o = (Evas_Object_Image *)(obj->object_data); o = (Evas_Object_Image *)(obj->object_data);
@ -2555,9 +2572,11 @@ evas_object_image_unload(Evas_Object *obj, Eina_Bool dirty)
o->load_error = EVAS_LOAD_ERROR_NONE; o->load_error = EVAS_LOAD_ERROR_NONE;
o->cur.has_alpha = 1; o->cur.has_alpha = 1;
o->cur.cspace = EVAS_COLORSPACE_ARGB8888; o->cur.cspace = EVAS_COLORSPACE_ARGB8888;
if ((o->cur.image.w != 0) || (o->cur.image.h != 0)) resize_call = EINA_TRUE;
o->cur.image.w = 0; o->cur.image.w = 0;
o->cur.image.h = 0; o->cur.image.h = 0;
o->cur.image.stride = 0; o->cur.image.stride = 0;
if (resize_call) evas_object_inform_call_image_resize(obj);
} }
static void static void
@ -2588,6 +2607,7 @@ evas_object_image_load(Evas_Object *obj)
{ {
int w, h; int w, h;
int stride = 0; int stride = 0;
Eina_Bool resize_call = EINA_FALSE;
obj->layer->evas->engine.func->image_size_get obj->layer->evas->engine.func->image_size_get
(obj->layer->evas->engine.data.output, (obj->layer->evas->engine.data.output,
@ -2604,9 +2624,12 @@ evas_object_image_load(Evas_Object *obj)
o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get
(obj->layer->evas->engine.data.output, (obj->layer->evas->engine.data.output,
o->engine_data); o->engine_data);
if ((o->cur.image.w != w) || (o->cur.image.h != h))
resize_call = EINA_TRUE;
o->cur.image.w = w; o->cur.image.w = w;
o->cur.image.h = h; o->cur.image.h = h;
o->cur.image.stride = stride; o->cur.image.stride = stride;
if (resize_call) evas_object_inform_call_image_resize(obj);
} }
else else
{ {

View File

@ -77,3 +77,11 @@ evas_object_inform_call_image_unloaded(Evas_Object *obj)
evas_object_event_callback_call(obj, EVAS_CALLBACK_IMAGE_UNLOADED, NULL, _evas_event_counter); evas_object_event_callback_call(obj, EVAS_CALLBACK_IMAGE_UNLOADED, NULL, _evas_event_counter);
_evas_post_event_callback_call(obj->layer->evas); _evas_post_event_callback_call(obj->layer->evas);
} }
void
evas_object_inform_call_image_resize(Evas_Object *obj)
{
_evas_object_event_new();
evas_object_event_callback_call(obj, EVAS_CALLBACK_IMAGE_RESIZE, NULL, _evas_event_counter);
_evas_post_event_callback_call(obj->layer->evas);
}

View File

@ -995,6 +995,7 @@ 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_changed_size_hints(Evas_Object *obj);
void evas_object_inform_call_image_preloaded(Evas_Object *obj); void evas_object_inform_call_image_preloaded(Evas_Object *obj);
void evas_object_inform_call_image_unloaded(Evas_Object *obj); void evas_object_inform_call_image_unloaded(Evas_Object *obj);
void evas_object_inform_call_image_resize(Evas_Object *obj);
void evas_object_intercept_cleanup(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_show(Evas_Object *obj);
int evas_object_intercept_call_hide(Evas_Object *obj); int evas_object_intercept_call_hide(Evas_Object *obj);