From 11b43dad4b0565ac93e2f5d79c1d22e68c41f95d Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Fri, 31 May 2013 20:28:12 +0900 Subject: [PATCH] evas - fixed source clip. If the source object is a evas primitive object, then proxy won't clipped by proxy clipper itself. --- src/lib/evas/canvas/evas_object_image.c | 18 ++++++++++--- src/lib/evas/canvas/evas_render.c | 36 ++++++++++++++++--------- src/lib/evas/include/evas_private.h | 11 +++++++- 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 5f601e11ed..49505503fa 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -3308,7 +3308,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, Evas_Object *eo_proxy, Eina_Bool do_async) +_proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Evas_Object *eo_proxy, Evas_Object_Protected_Data *proxy_obj, Eina_Bool do_async) { Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CLASS); Evas_Object_Protected_Data *source; @@ -3355,10 +3355,20 @@ _proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Evas_Object *eo_proxy, Eina e->engine.func->context_free(e->engine.data.output, ctx); ctx = e->engine.func->context_new(e->engine.data.output); + + Eina_Bool source_clip; + eo_do(eo_proxy, evas_obj_image_source_clip_get(&source_clip)); + + Evas_Proxy_Render_Data proxy_render_data = { + .eo_proxy = eo_proxy, + .proxy_obj = proxy_obj, + .eo_src = eo_source, + .source_clip = source_clip + }; 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, eo_proxy + 1, 0, 0, e->output.w, e->output.h, &proxy_render_data #ifdef REND_DBG , 1 #endif @@ -3794,7 +3804,7 @@ 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, eo_obj, + _proxy_subrender(obj->layer->evas->evas, o->cur->source, eo_obj, obj, EINA_FALSE); pixels = source->proxy->surface; imagew = source->proxy->w; @@ -4679,7 +4689,7 @@ 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, eo_obj, + _proxy_subrender(obj->layer->evas->evas, o->cur->source, eo_obj, obj, EINA_FALSE); pixels = source->proxy->surface; imagew = source->proxy->w; diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c index 74506ead48..044bac6c9b 100644 --- a/src/lib/evas/canvas/evas_render.c +++ b/src/lib/evas/canvas/evas_render.c @@ -1001,7 +1001,8 @@ 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, Evas_Object *proxy_obj + int ecy, int ecw, int ech, + Evas_Proxy_Render_Data *proxy_render_data #ifdef REND_DBG , int level #endif @@ -1012,13 +1013,13 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj, Eina_Bool clean_them = EINA_FALSE; Eina_Bool proxy_src_clip = EINA_TRUE; - if (!proxy_obj) + if (!proxy_render_data) { if ((evas_object_is_source_invisible(eo_obj, obj))) return clean_them; } else - eo_do(proxy_obj, evas_obj_image_source_clip_get(&proxy_src_clip)); + proxy_src_clip = proxy_render_data->source_clip; evas_object_clip_recalc(obj); @@ -1188,7 +1189,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_obj + proxy_render_data #ifdef REND_DBG , level + 1 #endif @@ -1319,7 +1320,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_obj + proxy_render_data #ifdef REND_DBG , level + 1 #endif @@ -1355,19 +1356,30 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj, } else { - //FIXME: Consider to clip by the proxy clipper. - if (proxy_obj && (proxy_obj != eo_obj)) - { - if (_evas_render_has_map(eo_obj, obj)) - evas_object_clip_recalc(obj); + if (_evas_render_has_map(eo_obj, obj)) + evas_object_clip_recalc(obj); + //FIXME: Consider to clip by the proxy clipper. + if (proxy_render_data->eo_src != eo_obj) + { x = obj->cur->clipper->cur->geometry.x + off_x; y = obj->cur->clipper->cur->geometry.y + off_y; w = obj->cur->clipper->cur->geometry.w; h = obj->cur->clipper->cur->geometry.h; - e->engine.func->context_clip_set(e->engine.data.output, - ctx, x, y, w, h); } + else + { + Evas_Object_Protected_Data *proxy = + proxy_render_data->proxy_obj; + x = proxy->cur->clipper->cur->geometry.x + + off_x; + y = proxy->cur->clipper->cur->geometry.y + + off_y; + w = proxy->cur->clipper->cur->geometry.w; + h = proxy->cur->clipper->cur->geometry.h; + } + e->engine.func->context_clip_set(e->engine.data.output, + ctx, x, y, w, h); } } obj->func->render(eo_obj, obj, e->engine.data.output, ctx, diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 831f900570..9b0dc12d84 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -46,6 +46,7 @@ typedef struct _Evas_Post_Callback Evas_Post_Callback; typedef struct _Evas_Coord_Touch_Point Evas_Coord_Touch_Point; typedef struct _Evas_Object_Proxy_Data Evas_Object_Proxy_Data; typedef struct _Evas_Object_Map_Data Evas_Object_Map_Data; +typedef struct _Evas_Proxy_Render_Data Evas_Proxy_Render_Data; typedef struct _Evas_Object_Protected_State Evas_Object_Protected_State; typedef struct _Evas_Object_Protected_Data Evas_Object_Protected_Data; @@ -1192,6 +1193,14 @@ struct _Evas_Imaging_Font RGBA_Font *font; }; +struct _Evas_Proxy_Render_Data +{ + Evas_Object *eo_proxy; + Evas_Object_Protected_Data *proxy_obj; + Evas_Object *eo_src; + Eina_Bool source_clip : 1; +}; + int evas_async_events_init(void); int evas_async_events_shutdown(void); int evas_async_target_del(const void *target); @@ -1215,7 +1224,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, - Evas_Object *proxy_obj + Evas_Proxy_Render_Data *proxy_render_data #ifdef REND_DBG , int level #endif