From f909a6d6eae94d4d089ef238c3d3a5c1514de4d0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 8 Nov 2016 14:47:50 +0900 Subject: [PATCH] evas: Fix masks of masks and clippers of clippers in general The root cause was simple: smart object clipped was not calling efl_super() on clip_set. Fixes T4813 (and probably a whole lot of other bugs) --- src/lib/emotion/emotion_smart.c | 2 ++ src/lib/evas/Evas_Legacy.h | 1 - src/lib/evas/canvas/evas_clip.c | 2 +- src/lib/evas/canvas/evas_object_intercept.c | 17 ++++++++--------- .../evas/canvas/evas_object_smart_clipped.c | 18 ++++++------------ src/tests/evas/evas_test_mask.c | 8 ++++---- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index bc3a7eb8b6..5ea48bbcd8 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -2016,6 +2016,8 @@ _efl_canvas_video_efl_canvas_object_clip_set(Evas_Object *obj, Efl_Canvas_Video_ if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip)) return; + efl_canvas_object_clip_set(efl_super(obj, MY_CLASS), clip); + if (sd->crop.clipper) evas_object_clip_set(sd->crop.clipper, clip); else evas_object_clip_set(sd->obj, clip); evas_object_clip_set(sd->bg, clip); diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index f385d00a32..78653e78bd 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -2514,7 +2514,6 @@ enum _Evas_Object_Intercept_Cb_Type EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET, EVAS_OBJECT_INTERCEPT_CB_COLOR_SET, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, - EVAS_OBJECT_INTERCEPT_CB_CLIP_UNSET, }; typedef enum _Evas_Object_Intercept_Cb_Type Evas_Object_Intercept_Cb_Type; diff --git a/src/lib/evas/canvas/evas_clip.c b/src/lib/evas/canvas/evas_clip.c index 1813696922..0f7be1b0fb 100644 --- a/src/lib/evas/canvas/evas_clip.c +++ b/src/lib/evas/canvas/evas_clip.c @@ -433,7 +433,7 @@ static void _clip_unset(Eo *eo_obj, Evas_Object_Protected_Data *obj) { if (_efl_canvas_object_clip_unset_block(eo_obj, obj)) return; - if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_UNSET, 1)) return; + if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 1, NULL)) return; if (obj->is_smart && obj->smart.smart && obj->smart.smart->smart_class && obj->smart.smart->smart_class->clip_unset) { diff --git a/src/lib/evas/canvas/evas_object_intercept.c b/src/lib/evas/canvas/evas_object_intercept.c index 42b490e896..f4bbe9db6e 100644 --- a/src/lib/evas/canvas/evas_object_intercept.c +++ b/src/lib/evas/canvas/evas_object_intercept.c @@ -195,18 +195,17 @@ _evas_object_intercept_call(Evas_Object *eo_obj, Evas_Object_Intercept_Cb_Type c } if (!obj->interceptors) goto end_noblock; blocked = evas_object_intercept_call_clip_set(eo_obj, obj, eo_other); - break; } - // else: fallthrough to unset - - case EVAS_OBJECT_INTERCEPT_CB_CLIP_UNSET: - if (!internal) + else { - if (_efl_canvas_object_clip_unset_block(eo_obj, obj)) - goto end_block; + if (!internal) + { + if (_efl_canvas_object_clip_unset_block(eo_obj, obj)) + goto end_block; + } + if (!obj->interceptors) goto end_noblock; + blocked = evas_object_intercept_call_clip_unset(eo_obj, obj); } - if (!obj->interceptors) goto end_noblock; - blocked = evas_object_intercept_call_clip_unset(eo_obj, obj); break; } diff --git a/src/lib/evas/canvas/evas_object_smart_clipped.c b/src/lib/evas/canvas/evas_object_smart_clipped.c index 8cbc5c539c..252709a02f 100644 --- a/src/lib/evas/canvas/evas_object_smart_clipped.c +++ b/src/lib/evas/canvas/evas_object_smart_clipped.c @@ -166,18 +166,12 @@ evas_object_smart_clipped_smart_clip_unset(Evas_Object *eo_obj) EOLIAN static void _efl_canvas_group_clipped_efl_canvas_object_clip_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *clip) { - if (clip) - { - if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip)) - return; - evas_object_smart_clipped_smart_clip_set(eo_obj, clip); - } - else - { - if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_UNSET, 0)) - return; - evas_object_smart_clipped_smart_clip_unset(eo_obj); - } + if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip)) + return; + + efl_canvas_object_clip_set(efl_super(eo_obj, MY_CLASS), clip); + if (clip) evas_object_smart_clipped_smart_clip_set(eo_obj, clip); + else evas_object_smart_clipped_smart_clip_unset(eo_obj); } static void diff --git a/src/tests/evas/evas_test_mask.c b/src/tests/evas/evas_test_mask.c index d8b64d341a..b3dd17b42c 100644 --- a/src/tests/evas/evas_test_mask.c +++ b/src/tests/evas/evas_test_mask.c @@ -37,7 +37,7 @@ static int _bgra_compare(unsigned int *data, unsigned int *ref, int w, int h) { - int i,j; + int i, j, ret = 0; for (j = 0; j < h; j++) { #if 0 @@ -50,12 +50,12 @@ _bgra_compare(unsigned int *data, unsigned int *ref, int w, int h) for (i = 0; i < w; i++) if (data[i+j*w] != ref[i+j*w]) { - printf("Pixel %d differ: %#x vs. %#x\n", i+j*w, data[i+j*w], ref[i+j*w]); + printf("Pixel %2dx%-2d differ: %#x vs. %#x\n", i, j, data[i+j*w], ref[i+j*w]); fflush(stdout); - return 1; + ret = 1; } } - return 0; + return ret; } // The usual useless unit test