forked from enlightenment/efl
evas - add evas_object_image_source_clip_set()/get()
This commit is contained in:
parent
a248548712
commit
9fc2835cf4
|
@ -1,6 +1,6 @@
|
|||
2013-04-26 ChunEon Park (Hermet)
|
||||
2013-04-29 ChunEon Park (Hermet)
|
||||
|
||||
* Evas: Fix the proxy object to not be clipped by source clipper.
|
||||
* Evas: Added evas_object_image_source_clip_set()/get().
|
||||
|
||||
2013-04-25 Tom Hacohen
|
||||
|
||||
|
|
3
NEWS
3
NEWS
|
@ -102,6 +102,7 @@ Additions:
|
|||
ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_BACK
|
||||
ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_SCROLL
|
||||
ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_MOUSE
|
||||
* Add evas_object_image_source_clip_set()/get()
|
||||
|
||||
Deprecations:
|
||||
* ecore_x:
|
||||
|
@ -256,5 +257,3 @@ Fixes:
|
|||
* Ecore-X: Fix selection parser to not overrun buffer read by using longs on 64bit.
|
||||
* Evas: Fix recursive proxy image rendering to just render black
|
||||
* Evas textblock: Fixed line size calculation when using multiple fonts.
|
||||
* Evas: Fix the proxy object to not be clipped by source clipper.
|
||||
|
||||
|
|
|
@ -5497,6 +5497,8 @@ enum
|
|||
EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_GET,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_SOURCE_EVENTS_SET,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_SOURCE_EVENTS_GET,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_SOURCE_CLIP_SET,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_SOURCE_CLIP_GET,
|
||||
EVAS_OBJ_IMAGE_SUB_ID_LAST
|
||||
};
|
||||
|
||||
|
@ -5590,7 +5592,7 @@ enum
|
|||
*
|
||||
* @param[in] visible in
|
||||
*
|
||||
* @see evas_object_image_source_visible_get
|
||||
* @see evas_object_image_source_visible_set
|
||||
*/
|
||||
#define evas_obj_image_source_visible_set(visible) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_SET), EO_TYPECHECK(Eina_Bool, visible)
|
||||
|
||||
|
@ -5602,7 +5604,7 @@ enum
|
|||
*
|
||||
* @param[out] visible out
|
||||
*
|
||||
* @see evas_obj_image_source_visible_set
|
||||
* @see evas_object_image_source_visible_get
|
||||
*/
|
||||
#define evas_obj_image_source_visible_get(visible) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_GET), EO_TYPECHECK(Eina_Bool *, visible)
|
||||
|
||||
|
@ -5614,7 +5616,7 @@ enum
|
|||
*
|
||||
* @param[in] source in
|
||||
*
|
||||
* @see evas_object_image_source_events_get
|
||||
* @see evas_object_image_source_events_set
|
||||
*/
|
||||
#define evas_obj_image_source_events_set(source) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_EVENTS_SET), EO_TYPECHECK(Eina_Bool, source)
|
||||
|
||||
|
@ -5626,10 +5628,34 @@ enum
|
|||
*
|
||||
* @param[out] source out
|
||||
*
|
||||
* @see evas_obj_image_source_event_set
|
||||
* @see evas_object_image_source_event_get
|
||||
*/
|
||||
#define evas_obj_image_source_events_get(source) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_EVENTS_GET), EO_TYPECHECK(Eina_Bool *, source)
|
||||
|
||||
/**
|
||||
* @def evas_obj_image_source_clip_set
|
||||
* @since 1.8
|
||||
*
|
||||
* Apply the source object's clip to the proxy
|
||||
*
|
||||
* @param[in] clip in
|
||||
*
|
||||
* @see evas_object_image_source_clip_set
|
||||
*/
|
||||
#define evas_obj_image_source_clip_set(source_clip) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_CLIP_SET), EO_TYPECHECK(Eina_Bool, source_clip)
|
||||
|
||||
/**
|
||||
* @def evas_obj_image_source_clip_get
|
||||
* @since 1.8
|
||||
*
|
||||
* Get the state of the source clip
|
||||
*
|
||||
* @param[out] source clip out
|
||||
*
|
||||
* @see evas_object_image_source_clip_get
|
||||
*/
|
||||
#define evas_obj_image_source_clip_get(source_clip) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_CLIP_GET), EO_TYPECHECK(Eina_Bool *, source_clip)
|
||||
|
||||
/**
|
||||
* @def evas_obj_image_border_set
|
||||
* @since 1.8
|
||||
|
|
|
@ -4866,6 +4866,32 @@ EAPI void evas_object_image_source_events_set(Evas_Object *obj, Eina_Bool source
|
|||
*/
|
||||
EAPI Eina_Bool evas_object_image_source_events_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Clip the proxy object with the source object's clipper.
|
||||
*
|
||||
* @param obj Proxy (image) object.
|
||||
* @param source_clip whether @p obj is clipped by the source clipper.
|
||||
* (@c EINA_TRUE) or not (@c EINA_FALSE)
|
||||
*
|
||||
* @see evas_object_clip_set()
|
||||
* @see evas_object_image_source_set()
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI void evas_object_image_source_clip_set(Evas_Object *obj, Eina_Bool source_clip) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Determine whether an object is clipped by source object's clipper.
|
||||
*
|
||||
* @param obj Proxy (image) object.
|
||||
* @return @c EINA_TRUE if source clip is enabled, @c EINA_FALSE otherwise.
|
||||
*
|
||||
* @see evas_object_clip_set()
|
||||
* @see evas_object_image_source_set()
|
||||
* @see evas_object_image_source_clip_set()
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI Eina_Bool evas_object_image_source_clip_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Check if an image object can be animated (have multiple frames)
|
||||
*
|
||||
|
|
|
@ -122,6 +122,7 @@ struct _Evas_Object_Image
|
|||
Eina_Bool video_visible : 1;
|
||||
Eina_Bool created : 1;
|
||||
Eina_Bool proxyerror : 1;
|
||||
Eina_Bool proxy_src_clip : 1;
|
||||
};
|
||||
|
||||
/* private methods for image objects */
|
||||
|
@ -311,6 +312,7 @@ _constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED)
|
|||
o->pixels = eina_cow_alloc(evas_object_image_pixels_cow);
|
||||
o->cur = eina_cow_alloc(evas_object_image_state_cow);
|
||||
o->prev = eina_cow_alloc(evas_object_image_state_cow);
|
||||
o->proxy_src_clip = EINA_TRUE;
|
||||
|
||||
cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
|
@ -734,6 +736,54 @@ evas_object_image_source_unset(Evas_Object *eo_obj)
|
|||
return result;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_image_source_clip_set(Evas_Object *eo_obj, Eina_Bool source_clip)
|
||||
{
|
||||
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
eo_do(eo_obj, evas_obj_image_source_clip_set(source_clip));
|
||||
}
|
||||
|
||||
static void
|
||||
_image_source_clip_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Evas_Object_Image *o = _pd;
|
||||
Eina_Bool source_clip = va_arg(*list, int);
|
||||
Evas_Object_Protected_Data *src_obj;
|
||||
|
||||
source_clip = !!source_clip;
|
||||
if (o->proxy_src_clip == source_clip) return;
|
||||
o->proxy_src_clip = source_clip;
|
||||
|
||||
if (!o->cur->source) return;
|
||||
|
||||
src_obj = eo_data_get(o->cur->source, EVAS_OBJ_CLASS);
|
||||
evas_object_change(o->cur->source, src_obj);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
evas_object_image_source_clip_get(const Evas_Object *eo_obj)
|
||||
{
|
||||
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
||||
return EINA_FALSE;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
Eina_Bool source_clip;
|
||||
eo_do((Eo*)eo_obj, evas_obj_image_source_clip_get(&source_clip));
|
||||
|
||||
return source_clip;
|
||||
}
|
||||
|
||||
static void
|
||||
_image_source_clip_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Evas_Object_Image *o = _pd;
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
*ret = o->proxy_src_clip;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_image_source_events_set(Evas_Object *eo_obj, Eina_Bool source_events)
|
||||
{
|
||||
|
@ -3204,7 +3254,7 @@ _proxy_subrender_recurse(Evas_Object *eo_obj, Evas_Object *clip, void *output, v
|
|||
* Used to force a draw if necessary, else just makes sures it's available.
|
||||
*/
|
||||
static void
|
||||
_proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Eina_Bool do_async)
|
||||
_proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Evas_Object *eo_proxy, Eina_Bool do_async)
|
||||
{
|
||||
Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
|
||||
Evas_Object_Protected_Data *source;
|
||||
|
@ -3254,7 +3304,7 @@ _proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Eina_Bool do_async)
|
|||
evas_render_mapped(e, eo_source, source, ctx, proxy_write->surface,
|
||||
-source->cur->geometry.x,
|
||||
-source->cur->geometry.y,
|
||||
1, 0, 0, e->output.w, e->output.h, EINA_TRUE
|
||||
1, 0, 0, e->output.w, e->output.h, eo_proxy
|
||||
#ifdef REND_DBG
|
||||
, 1
|
||||
#endif
|
||||
|
@ -3689,7 +3739,8 @@ evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, v
|
|||
else
|
||||
{
|
||||
o->proxyrendering = EINA_TRUE;
|
||||
_proxy_subrender(obj->layer->evas->evas, o->cur->source, EINA_FALSE);
|
||||
_proxy_subrender(obj->layer->evas->evas, o->cur->source, eo_obj,
|
||||
EINA_FALSE);
|
||||
pixels = source->proxy->surface;
|
||||
imagew = source->proxy->w;
|
||||
imageh = source->proxy->h;
|
||||
|
@ -4568,7 +4619,8 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
|||
else
|
||||
{
|
||||
o->proxyrendering = EINA_TRUE;
|
||||
_proxy_subrender(obj->layer->evas->evas, o->cur->source, EINA_FALSE);
|
||||
_proxy_subrender(obj->layer->evas->evas, o->cur->source, eo_obj,
|
||||
EINA_FALSE);
|
||||
pixels = source->proxy->surface;
|
||||
imagew = source->proxy->w;
|
||||
imageh = source->proxy->h;
|
||||
|
@ -5155,6 +5207,8 @@ _class_constructor(Eo_Class *klass)
|
|||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_GET), _image_source_visible_get),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_EVENTS_SET), _image_source_events_set),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_EVENTS_GET), _image_source_events_get),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_CLIP_SET), _image_source_clip_set),
|
||||
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_CLIP_GET), _image_source_clip_get),
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
|
||||
|
@ -5231,6 +5285,8 @@ static const Eo_Op_Description op_desc[] = {
|
|||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_GET, "Get the source object visibility of a given image object being used as a proxy."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_EVENTS_SET, "Set the events to be repeated to the source object."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_EVENTS_GET, "Get the state of the source events."),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_CLIP_SET, "Apply the source object's clip to the proxy"),
|
||||
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_CLIP_GET, "Get the state of the source clip"),
|
||||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
||||
|
|
|
@ -950,7 +950,7 @@ Eina_Bool
|
|||
evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
|
||||
Evas_Object_Protected_Data *obj, void *context,
|
||||
void *surface, int off_x, int off_y, int mapped, int ecx,
|
||||
int ecy, int ecw, int ech, Eina_Bool proxy_render
|
||||
int ecy, int ecw, int ech, Evas_Object *proxy_obj
|
||||
#ifdef REND_DBG
|
||||
, int level
|
||||
#endif
|
||||
|
@ -959,10 +959,14 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
|
|||
void *ctx;
|
||||
Evas_Object_Protected_Data *obj2;
|
||||
Eina_Bool clean_them = EINA_FALSE;
|
||||
Eina_Bool proxy_src_clip = EINA_FALSE;
|
||||
|
||||
if ((!proxy_render) && (evas_object_is_source_invisible(eo_obj, obj)))
|
||||
if ((!proxy_obj) && (evas_object_is_source_invisible(eo_obj, obj)))
|
||||
return clean_them;
|
||||
|
||||
if (proxy_obj)
|
||||
eo_do(proxy_obj, evas_obj_image_source_clip_get(&proxy_src_clip));
|
||||
|
||||
evas_object_clip_recalc(obj);
|
||||
|
||||
RDI(level);
|
||||
|
@ -970,7 +974,7 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
|
|||
|
||||
if (mapped)
|
||||
{
|
||||
if (!proxy_render)
|
||||
if (!proxy_obj || proxy_src_clip)
|
||||
{
|
||||
if ((!evas_object_is_visible(eo_obj, obj)) || (obj->clip.clipees)
|
||||
|| (obj->cur->have_clipees))
|
||||
|
@ -1134,7 +1138,7 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
|
|||
obj->map->surface,
|
||||
off_x2, off_y2, 1,
|
||||
ecx, ecy, ecw, ech,
|
||||
proxy_render
|
||||
proxy_obj
|
||||
#ifdef REND_DBG
|
||||
, level + 1
|
||||
#endif
|
||||
|
@ -1265,7 +1269,7 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
|
|||
obj2, ctx, surface,
|
||||
off_x, off_y, 1,
|
||||
ecx, ecy, ecw, ech,
|
||||
proxy_render
|
||||
proxy_obj
|
||||
#ifdef REND_DBG
|
||||
, level + 1
|
||||
#endif
|
||||
|
@ -1277,7 +1281,7 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
|
|||
RDI(level);
|
||||
|
||||
//FIXME: Consider to clip by the proxy clipper.
|
||||
if (obj->cur->clipper && !proxy_render)
|
||||
if (obj->cur->clipper && (!proxy_obj || proxy_src_clip))
|
||||
{
|
||||
RD(" clip: %i %i %ix%i [%i %i %ix%i]\n",
|
||||
obj->cur->cache.clip.x + off_x,
|
||||
|
@ -1322,7 +1326,7 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
|
|||
else
|
||||
{
|
||||
//FIXME: Consider to clip by the proxy clipper.
|
||||
if (obj->cur->clipper && !proxy_render)
|
||||
if (obj->cur->clipper && (!proxy_obj || proxy_src_clip))
|
||||
{
|
||||
int x, y, w, h;
|
||||
|
||||
|
@ -1744,7 +1748,7 @@ evas_render_updates_internal(Evas *eo_e,
|
|||
surface, off_x,
|
||||
off_y, 0,
|
||||
cx, cy, cw, ch,
|
||||
EINA_FALSE
|
||||
NULL
|
||||
#ifdef REND_DBG
|
||||
, 1
|
||||
#endif
|
||||
|
|
|
@ -1239,7 +1239,7 @@ Eina_Bool evas_render_mapped(Evas_Public_Data *e, Evas_Object *obj,
|
|||
Evas_Object_Protected_Data *source_pd,
|
||||
void *context, void *surface, int off_x, int off_y,
|
||||
int mapped, int ecx, int ecy, int ecw, int ech,
|
||||
Eina_Bool proxy_render
|
||||
Evas_Object *proxy_obj
|
||||
#ifdef REND_DBG
|
||||
, int level
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue