diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2014-03-04 15:17:11 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2014-03-04 15:17:11 +0900 |
commit | 8ddfa35da67fe035805961f5c89312e61325586f (patch) | |
tree | c6235187105a43b87094fd6ecc024ab6016490fc | |
parent | 752fde1025e9ff27af465800b250b15626c38e6c (diff) |
Evas filters: Add return value in filter callback
This will inform the client whether an asynchronous filter properly
rendered or not.
I actually don't know any case where rendering can fail at runtime.
Diffstat (limited to '')
-rw-r--r-- | src/lib/evas/canvas/evas_object_text.c | 36 | ||||
-rw-r--r-- | src/lib/evas/filters/evas_filter.c | 8 | ||||
-rw-r--r-- | src/lib/evas/include/evas_filter.h | 2 |
3 files changed, 37 insertions, 9 deletions
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c index d4a9561cad..308682524f 100644 --- a/src/lib/evas/canvas/evas_object_text.c +++ b/src/lib/evas/canvas/evas_object_text.c | |||
@@ -2024,9 +2024,37 @@ evas_font_draw_async_check(Evas_Object_Protected_Data *obj, | |||
2024 | } | 2024 | } |
2025 | 2025 | ||
2026 | static void | 2026 | static void |
2027 | evas_object_text_render(Evas_Object *eo_obj EINA_UNUSED, | 2027 | _filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success) |
2028 | Evas_Object_Protected_Data *obj, | 2028 | { |
2029 | void *type_private_data, | 2029 | Eo *eo_obj = data; |
2030 | |||
2031 | // Destroy context as we won't reuse it. | ||
2032 | evas_filter_context_destroy(ctx); | ||
2033 | |||
2034 | // Redraw text with normal styles in case of failure | ||
2035 | if (!success) | ||
2036 | { | ||
2037 | Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); | ||
2038 | Evas_Object_Text *o = (Evas_Object_Text *) obj->private_data; | ||
2039 | |||
2040 | ERR("Filter failed at runtime!"); | ||
2041 | o->cur.filter.invalid = EINA_TRUE; | ||
2042 | |||
2043 | // Update object | ||
2044 | _evas_object_text_items_clear(o); | ||
2045 | o->changed = 1; | ||
2046 | _evas_object_text_recalc(eo_obj, o->cur.text); | ||
2047 | evas_object_change(eo_obj, obj); | ||
2048 | evas_object_clip_dirty(eo_obj, obj); | ||
2049 | evas_object_coords_recalc(eo_obj, obj); | ||
2050 | evas_object_inform_call_resize(eo_obj); | ||
2051 | } | ||
2052 | } | ||
2053 | |||
2054 | static void | ||
2055 | evas_object_text_render(Evas_Object *eo_obj, | ||
2056 | Evas_Object_Protected_Data *obj, | ||
2057 | void *type_private_data, | ||
2030 | void *output, void *context, void *surface, | 2058 | void *output, void *context, void *surface, |
2031 | int x, int y, Eina_Bool do_async) | 2059 | int x, int y, Eina_Bool do_async) |
2032 | { | 2060 | { |
@@ -2244,7 +2272,7 @@ evas_object_text_render(Evas_Object *eo_obj EINA_UNUSED, | |||
2244 | ENFN->context_free(ENDT, filter_ctx); | 2272 | ENFN->context_free(ENDT, filter_ctx); |
2245 | 2273 | ||
2246 | // Add post-run callback and run filter | 2274 | // Add post-run callback and run filter |
2247 | evas_filter_context_autodestroy(filter); | 2275 | evas_filter_context_post_run_callback_set(filter, _filter_cb, eo_obj); |
2248 | ok = evas_filter_run(filter); | 2276 | ok = evas_filter_run(filter); |
2249 | o->cur.filter.changed = EINA_FALSE; | 2277 | o->cur.filter.changed = EINA_FALSE; |
2250 | 2278 | ||
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c index 816c30b041..8cb499140f 100644 --- a/src/lib/evas/filters/evas_filter.c +++ b/src/lib/evas/filters/evas_filter.c | |||
@@ -1719,10 +1719,10 @@ static void | |||
1719 | _filter_thread_run_cb(void *data) | 1719 | _filter_thread_run_cb(void *data) |
1720 | { | 1720 | { |
1721 | Evas_Filter_Context *ctx = data; | 1721 | Evas_Filter_Context *ctx = data; |
1722 | Eina_Bool success; | ||
1722 | void *buffer; | 1723 | void *buffer; |
1723 | 1724 | ||
1724 | // TODO: Add return value check and call error cb | 1725 | success = _filter_chain_run(ctx); |
1725 | _filter_chain_run(ctx); | ||
1726 | 1726 | ||
1727 | EINA_LIST_FREE(ctx->post_run.buffers_to_free, buffer) | 1727 | EINA_LIST_FREE(ctx->post_run.buffers_to_free, buffer) |
1728 | { | 1728 | { |
@@ -1731,7 +1731,7 @@ _filter_thread_run_cb(void *data) | |||
1731 | } | 1731 | } |
1732 | 1732 | ||
1733 | if (ctx->post_run.cb) | 1733 | if (ctx->post_run.cb) |
1734 | ctx->post_run.cb(ctx, ctx->post_run.data); | 1734 | ctx->post_run.cb(ctx, ctx->post_run.data, success); |
1735 | } | 1735 | } |
1736 | 1736 | ||
1737 | Eina_Bool | 1737 | Eina_Bool |
@@ -1755,6 +1755,6 @@ evas_filter_run(Evas_Filter_Context *ctx) | |||
1755 | 1755 | ||
1756 | ret = _filter_chain_run(ctx); | 1756 | ret = _filter_chain_run(ctx); |
1757 | if (ctx->post_run.cb) | 1757 | if (ctx->post_run.cb) |
1758 | ctx->post_run.cb(ctx, ctx->post_run.data); | 1758 | ctx->post_run.cb(ctx, ctx->post_run.data, ret); |
1759 | return ret; | 1759 | return ret; |
1760 | } | 1760 | } |
diff --git a/src/lib/evas/include/evas_filter.h b/src/lib/evas/include/evas_filter.h index 2ad272c0f2..e79fc9e396 100644 --- a/src/lib/evas/include/evas_filter.h +++ b/src/lib/evas/include/evas_filter.h | |||
@@ -19,7 +19,7 @@ typedef enum _Evas_Filter_Fill_Mode Evas_Filter_Fill_Mode; | |||
19 | typedef enum _Evas_Filter_Transform_Flags Evas_Filter_Transform_Flags; | 19 | typedef enum _Evas_Filter_Transform_Flags Evas_Filter_Transform_Flags; |
20 | 20 | ||
21 | typedef Eina_Bool (* Evas_Filter_Apply_Func) (Evas_Filter_Command *cmd); | 21 | typedef Eina_Bool (* Evas_Filter_Apply_Func) (Evas_Filter_Command *cmd); |
22 | typedef void (* Evas_Filter_Cb) (Evas_Filter_Context *ctx, void *data); | 22 | typedef void (* Evas_Filter_Cb) (Evas_Filter_Context *ctx, void *data, Eina_Bool success); |
23 | 23 | ||
24 | #define EVAS_FILTER_BUFFER_RGBA EINA_FALSE | 24 | #define EVAS_FILTER_BUFFER_RGBA EINA_FALSE |
25 | #define EVAS_FILTER_BUFFER_ALPHA EINA_TRUE | 25 | #define EVAS_FILTER_BUFFER_ALPHA EINA_TRUE |