From 8f0311537b8d9746ccd19354dbd827b0232e479a Mon Sep 17 00:00:00 2001 From: Ji-Youn Park Date: Thu, 8 Sep 2016 11:16:23 +0830 Subject: [PATCH] evas_render: fix clipping the whole area in each rendering. evas_render should not be going and doing evas_object_clip_set () at all. The framespace clip should be enforced at RENDER time. Change-Id: I94d2f006ce23ce15523627e31308280a3a10782f opensource: commit 7ce79be1a1748c32c4d0e58358ce2242902cf89b Author: Ji-Youn Park Date: Thu Sep 8 09:56:30 2016 +0830 --- src/lib/evas/canvas/evas_render.c | 101 +++++++++++------------------------- src/lib/evas/include/evas_private.h | 1 - 2 files changed, 29 insertions(+), 73 deletions(-) diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c index bd90d3b..94f5503 100755 --- a/src/lib/evas/canvas/evas_render.c +++ b/src/lib/evas/canvas/evas_render.c @@ -183,6 +183,26 @@ _accumulate_time(double before, Eina_Bool async) #endif static int _render_busy = 0; + +static inline Eina_Bool +_is_obj_in_framespace(Evas_Object_Protected_Data *obj) +{ + return obj->is_frame; +} + +static inline void +_evas_render_framespace_context_clip_clip(Evas_Public_Data *evas, void *ctx) +{ + int fx, fy, fw, fh; + + fx = evas->framespace.x; + fy = evas->framespace.y; + fw = evas->viewport.w - evas->framespace.w; + fh = evas->viewport.h - evas->framespace.h; + + ENFN->context_clip_clip(ENDT, ctx, fx, fy, fw, fh); +} + //TIZEN_ONLY(20160624) : draw sky blue color bg before draw object. it is for debug. static int partial_render_debug=-1; @@ -1619,6 +1639,9 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj, } //if (surface == ENFN) ENFN->context_clip_clip(ENDT, ctx, ecx, ecy, ecw, ech); + if (!_is_obj_in_framespace(obj)) + _evas_render_framespace_context_clip_clip(evas, ctx); + if (obj->cur->cache.clip.visible || !proxy_src_clip) { ENFN->context_multiplier_unset(ENDT, ctx); @@ -1792,6 +1815,9 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj, clipper->cur->cache.clip.w, clipper->cur->cache.clip.h); ENFN->context_clip_set(ENDT, ctx, x + off_x, y + off_y, w, h); + if (!_is_obj_in_framespace(obj)) + _evas_render_framespace_context_clip_clip(evas, ctx); + if (proxy_src_clip) ENFN->context_clip_clip(ENDT, ctx, ecx, ecy, ecw, ech); } @@ -2354,6 +2380,9 @@ evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *e, context, x, y, w, h); + if (!_is_obj_in_framespace(obj)) + _evas_render_framespace_context_clip_clip(e, context); + /* Clipper masks */ if (_evas_render_object_is_mask(obj->cur->clipper)) mask = obj->cur->clipper; // main object clipped by this mask @@ -2453,7 +2482,6 @@ evas_render_updates_internal(Evas *eo_e, Evas_Render_Mode render_mode = !do_async ? EVAS_RENDER_MODE_SYNC : EVAS_RENDER_MODE_ASYNC_INIT; - Eina_Rectangle clip_rect; MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS); return EINA_FALSE; @@ -2523,57 +2551,6 @@ evas_render_updates_internal(Evas *eo_e, eina_evlog("-render_phase1", eo_e, 0.0, NULL); } - if (!strncmp(e->engine.module->definition->name, "wayland", 7)) - { - evas_event_freeze(eo_e); - /* check for master clip */ - if (!e->framespace.clip) - { - e->framespace.clip = evas_object_rectangle_add(eo_e); - evas_object_color_set(e->framespace.clip, 255, 255, 255, 255); - evas_object_move(e->framespace.clip, 0, 0); - evas_object_resize(e->framespace.clip, - e->viewport.w - e->framespace.w, - e->viewport.h - e->framespace.h); - evas_object_pass_events_set(e->framespace.clip, EINA_TRUE); - evas_object_layer_set(e->framespace.clip, EVAS_LAYER_MIN); - evas_object_show(e->framespace.clip); - } - - /* setup master clip rectangle for comparison to objects */ - EINA_RECTANGLE_SET(&clip_rect, e->framespace.x, e->framespace.y, - e->viewport.w - e->framespace.w, - e->viewport.h - e->framespace.h); - - for (i = 0; i < e->render_objects.count; ++i) - { - Eina_Rectangle obj_rect; - - obj = eina_array_data_get(&e->render_objects, i); - if (obj->delete_me) continue; - if (obj->is_frame) continue; - if (obj->object == e->framespace.clip) continue; - - /* setup object rectangle for comparison to clip rectangle */ - EINA_RECTANGLE_SET(&obj_rect, - obj->cur->geometry.x, obj->cur->geometry.y, - obj->cur->geometry.w, obj->cur->geometry.h); - - /* check if this object intersects with the master clip */ - if (!eina_rectangles_intersect(&clip_rect, &obj_rect)) - continue; - - if (!evas_object_clip_get(obj->object)) - { - /* clip this object to the master clip */ - evas_object_clip_set(obj->object, e->framespace.clip); - } - } - if (!evas_object_clipees_has(e->framespace.clip)) - evas_object_hide(e->framespace.clip); - evas_event_thaw(eo_e); - } - /* phase 1.5. check if the video should be inlined or stay in their overlay */ alpha = e->engine.func->canvas_alpha_get(e->engine.data.output, e->engine.data.context); @@ -2914,26 +2891,6 @@ evas_render_updates_internal(Evas *eo_e, } } - if (!strncmp(e->engine.module->definition->name, "wayland", 7)) - { - /* unclip objects from master clip */ - for (i = 0; i < e->render_objects.count; ++i) - { - obj = eina_array_data_get(&e->render_objects, i); - if (obj->is_frame) continue; - if (obj->object == e->framespace.clip) continue; - - if (evas_object_clip_get(obj->object) == e->framespace.clip) - { - /* unclip this object from the master clip */ - evas_object_clip_unset(obj->object); - } - } - - /* delete master clip */ - evas_object_del(e->framespace.clip); - e->framespace.clip = NULL; - } e->changed = EINA_FALSE; e->viewport.changed = EINA_FALSE; diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index f6d2a4f..bfb450e 100755 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -794,7 +794,6 @@ struct _Evas_Public_Data { Evas_Coord x, y, w, h; Eina_Bool changed : 1; - Evas_Object *clip; } framespace; Eina_List *damages; -- 2.7.4