From 3bb0f57c0fd92040b0178450df3de0d4cf33476d Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 29 May 2019 15:37:07 -0400 Subject: [PATCH] evas_inline: Clean up evas_object_is_opaque function Summary: This file is full of functions called as: foo(eo_obj, obj); Most of them can be reduced to foo(obj); and internally get the eo_obj with obj->object This would make it impossible to screw up calling them passing an unrelated pair, and make calling code a little more readable. ref T7230 Depends on D9048 Reviewers: raster, cedric, zmike Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7230 Differential Revision: https://phab.enlightenment.org/D9049 --- src/lib/evas/canvas/efl_canvas_vg_object.c | 2 +- src/lib/evas/canvas/evas_object_image.c | 8 ++++---- src/lib/evas/canvas/evas_object_rectangle.c | 2 +- src/lib/evas/canvas/evas_render.c | 20 +++++++++----------- src/lib/evas/include/evas_inline.x | 4 ++-- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c index 6728983..245685f 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_object.c +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c @@ -774,7 +774,7 @@ _efl_canvas_vg_object_render_pre(Evas_Object *eo_obj, /* area so if there were updates for it they get wiped. don't do it if we */ /* arent fully opaque and we are visible */ if (evas_object_is_visible(obj) && - evas_object_is_opaque(eo_obj, obj) && + evas_object_is_opaque(obj) && (!obj->clip.clipees)) { Evas_Coord x, y, w, h; diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 7a603b9..9362ef1 100755 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -2679,7 +2679,7 @@ evas_object_image_render_pre(Evas_Object *eo_obj, Eina_Rectangle *rr; if ((!o->cur->has_alpha) && - (evas_object_is_opaque(eo_obj, obj)) && + (evas_object_is_opaque(obj)) && (obj->cur->color.a == 255)) { Evas_Coord x, y, w, h; @@ -2771,7 +2771,7 @@ evas_object_image_render_pre(Evas_Object *eo_obj, Eina_Rectangle *rr; if ((!o->cur->has_alpha) && - (evas_object_is_opaque(eo_obj, obj)) && + (evas_object_is_opaque(obj)) && (obj->cur->color.a == 255)) { Evas_Coord x, y, w, h; @@ -2871,7 +2871,7 @@ evas_object_image_render_pre(Evas_Object *eo_obj, /* it obviously didn't change - add a NO obscure - this "unupdates" this */ /* area so if there were updates for it they get wiped. don't do it if we */ /* aren't fully opaque and we are visible */ - if (evas_object_is_opaque(eo_obj, obj)) + if (evas_object_is_opaque(obj)) { Evas_Coord x, y, w, h; @@ -3010,7 +3010,7 @@ evas_object_image_is_opaque(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *cur_source = efl_data_scope_get(o->cur->source, EFL_CANVAS_OBJECT_CLASS); EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write) { - state_write->opaque = evas_object_is_opaque(o->cur->source, cur_source); + state_write->opaque = evas_object_is_opaque(cur_source); } EINA_COW_IMAGE_STATE_WRITE_END(o, state_write); return o->cur->opaque; /* FIXME: Should go poke at the object */ diff --git a/src/lib/evas/canvas/evas_object_rectangle.c b/src/lib/evas/canvas/evas_object_rectangle.c index b2f1aae..fe45ece 100644 --- a/src/lib/evas/canvas/evas_object_rectangle.c +++ b/src/lib/evas/canvas/evas_object_rectangle.c @@ -204,7 +204,7 @@ evas_object_rectangle_render_pre(Evas_Object *eo_obj, /* area so if there were updates for it they get wiped. don't do it if we */ /* arent fully opaque and we are visible */ if (evas_object_is_visible(obj) && - evas_object_is_opaque(eo_obj, obj) && + evas_object_is_opaque(obj) && (!obj->clip.clipees)) { Evas_Coord x, y, w, h; diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c index 99c9f03..ce7e9f6 100644 --- a/src/lib/evas/canvas/evas_render.c +++ b/src/lib/evas/canvas/evas_render.c @@ -524,7 +524,7 @@ _evas_render_phase1_direct(Evas_Public_Data *e, } else if (evas_object_is_visible(obj) && ((obj->rect_del) || - (evas_object_is_opaque(eo_obj, obj))) && + (evas_object_is_opaque(obj))) && (!evas_object_is_source_invisible(eo_obj, obj))) { RD(0, " rect del\n"); @@ -1036,9 +1036,7 @@ _evas_render_phase1_object_no_changed_normal(Phase1_Context *p1ctx, #endif ) { - Evas_Object *eo_obj = obj->object; - - if (evas_object_is_opaque(eo_obj, obj) && + if (evas_object_is_opaque(obj) && evas_object_is_visible(obj)) { RD(level, " opaque + visible\n"); @@ -1316,7 +1314,7 @@ _evas_render_check_pending_objects(Eina_Array *pending_objects, Evas *eo_e EINA_ { if ((!obj->clip.clipees) && (obj->delete_me == 0) && (!obj->cur->have_clipees || (evas_object_was_visible(obj) && (!obj->prev->have_clipees))) - && evas_object_is_opaque(eo_obj, obj) && evas_object_is_visible(obj)) + && evas_object_is_opaque(obj) && evas_object_is_visible(obj)) { if (obj->rect_del || obj->is_smart) ok = EINA_TRUE; } @@ -1521,7 +1519,7 @@ _evas_render_can_use_overlay(Evas_Public_Data *e, Evas_Object *eo_obj, Efl_Canva break; } - if (evas_object_is_opaque(eo_current, current) || + if (evas_object_is_opaque(current) || ((current->func->has_opaque_rect) && (current->func->has_opaque_rect(eo_current, current, current->private_data)))) { @@ -2653,7 +2651,7 @@ _evas_render_cutout_add(Evas_Public_Data *evas, void *context, Evas_Coord cox = 0, coy = 0, cow = 0, coh = 0; if (evas_object_is_source_invisible(obj->object, obj)) return; - if (evas_object_is_opaque(obj->object, obj)) + if (evas_object_is_opaque(obj)) { cox = obj->cur->cache.clip.x; coy = obj->cur->cache.clip.y; @@ -2828,7 +2826,7 @@ _snapshot_redraw_update(Evas_Public_Data *evas, Evas_Object_Protected_Data *snap if (obj == snap) above = EINA_TRUE; continue; } - if (!obj->cur->snapshot || evas_object_is_opaque(obj->object, obj)) + if (!obj->cur->snapshot || evas_object_is_opaque(obj)) { const Eina_Rectangle cur = { obj->cur->cache.clip.x - x, obj->cur->cache.clip.y - y, @@ -2934,7 +2932,7 @@ evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *evas, OBJ_ARRAY_PUSH(&evas->temporary_objects, obj); if (above_top) continue; - if (obj->cur->snapshot && !evas_object_is_opaque(obj->object, obj)) + if (obj->cur->snapshot && !evas_object_is_opaque(obj)) continue; /* reset the background of the area if needed (using cutout and engine alpha flag to help) */ @@ -3060,7 +3058,7 @@ evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *evas, if (obj2->cur->snapshot) { if (above_top) continue; - if (!evas_object_is_opaque(obj2->object, obj2)) continue; + if (!evas_object_is_opaque(obj2)) continue; } #if 1 if ( @@ -3381,7 +3379,7 @@ evas_render_updates_internal(Evas *eo_e, if (UNLIKELY( (!obj->is_smart) && (!obj->clip.clipees) && - (evas_object_is_opaque(eo_obj, obj) || obj->cur->snapshot || + (evas_object_is_opaque(obj) || obj->cur->snapshot || ((obj->func->has_opaque_rect) && (obj->func->has_opaque_rect(eo_obj, obj, obj->private_data)))) && evas_object_is_visible(obj) && diff --git a/src/lib/evas/include/evas_inline.x b/src/lib/evas/include/evas_inline.x index b9989ee..c5e7fa5 100644 --- a/src/lib/evas/include/evas_inline.x +++ b/src/lib/evas/include/evas_inline.x @@ -98,7 +98,7 @@ evas_common_draw_context_cutouts_add(Cutout_Rects* rects, } static inline int -evas_object_is_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) +evas_object_is_opaque(Evas_Object_Protected_Data *obj) { if (obj->is_smart || obj->no_render) return 0; if (obj->cur->render_op == EVAS_RENDER_COPY) @@ -111,7 +111,7 @@ evas_object_is_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) (obj->clip.mask)) return 0; if (obj->func->is_opaque) - return obj->func->is_opaque(eo_obj, obj, obj->private_data); + return obj->func->is_opaque(obj->object, obj, obj->private_data); return 1; } return 0; -- 2.7.4