diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-12-23 08:09:51 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-01-17 14:35:28 +0900 |
commit | 5f1c993d1724013a76d02d6c2b16832b0e2357ca (patch) | |
tree | aee7ddabcbacbcf0ac19fb597c5a8a90e796faec /src | |
parent | cb294320dc68c54ac0562362fd6bc97e291ec5ba (diff) |
evas: Set gfx filters by name on textblock
This allows for much simpler markup, and easier tracking of
which filters are in use, etc... Next: data and sources.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/elementary/test_gfx_filters.c | 19 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_textblock.c | 164 |
2 files changed, 128 insertions, 55 deletions
diff --git a/src/bin/elementary/test_gfx_filters.c b/src/bin/elementary/test_gfx_filters.c index 3612e69e47..74737b99e9 100644 --- a/src/bin/elementary/test_gfx_filters.c +++ b/src/bin/elementary/test_gfx_filters.c | |||
@@ -361,18 +361,25 @@ test_gfx_filters(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve | |||
361 | efl_pack(box2, o); | 361 | efl_pack(box2, o); |
362 | // */ | 362 | // */ |
363 | 363 | ||
364 | const char *tbtxt = | 364 | const char *codes[] = { |
365 | "Hey dude, " | 365 | "fill{color='#0033'} padding_set{20} blur{3} blend{}", |
366 | "<gfx_filter='fill{color=\"#0033\"} padding_set{20} blur{3} blend{}'>hello</>" | 366 | "blur{15,color='red'} blend{}" |
367 | " world!<br>" | 367 | }; |
368 | "<gfx_filter='blur{15,color=\"red\"}blend{}'>Wanna dance?</><br>" | 368 | const char *names[] = { |
369 | "What's going on here???"; | 369 | "one", |
370 | "two" | ||
371 | }; | ||
372 | const char *tbtxt = "Hey dude, <gfx_filter='one'>hello</> world!<br>" | ||
373 | "<gfx_filter='two'>Wanna dance?<br>" | ||
374 | "What's going on here???</>"; | ||
370 | 375 | ||
371 | /* EXPERIMENTAL TEXTBLOCK FILTER */ | 376 | /* EXPERIMENTAL TEXTBLOCK FILTER */ |
372 | o = evas_object_textblock_add(evas_object_evas_get(win)); | 377 | o = evas_object_textblock_add(evas_object_evas_get(win)); |
373 | efl_event_callback_add(o, EFL_GFX_EVENT_RESIZE, _textblock_resize, NULL); | 378 | efl_event_callback_add(o, EFL_GFX_EVENT_RESIZE, _textblock_resize, NULL); |
374 | Evas_Textblock_Style *st = evas_textblock_style_new(); | 379 | Evas_Textblock_Style *st = evas_textblock_style_new(); |
375 | evas_textblock_style_set(st, "DEFAULT='font=Sans font_size=24 color=#FFF wrap=word'"); | 380 | evas_textblock_style_set(st, "DEFAULT='font=Sans font_size=24 color=#FFF wrap=word'"); |
381 | for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(codes); k++) | ||
382 | efl_gfx_filter_program_set(o, codes[k], names[k]); | ||
376 | evas_object_textblock_style_set(o, st); | 383 | evas_object_textblock_style_set(o, st); |
377 | evas_object_textblock_text_markup_set(o, tbtxt); | 384 | evas_object_textblock_text_markup_set(o, tbtxt); |
378 | efl_canvas_object_scale_set(o, elm_config_scale_get()); | 385 | efl_canvas_object_scale_set(o, elm_config_scale_get()); |
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 0d8ce5dc86..50386490bf 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c | |||
@@ -221,16 +221,22 @@ typedef struct _Evas_Textblock_Selection_Iterator Evas_Textblock_Selection_Itera | |||
221 | typedef struct _Efl_Canvas_Text_Annotation_Iterator Efl_Canvas_Text_Annotation_Iterator; | 221 | typedef struct _Efl_Canvas_Text_Annotation_Iterator Efl_Canvas_Text_Annotation_Iterator; |
222 | /** | 222 | /** |
223 | * @internal | 223 | * @internal |
224 | * @typedef Evas_Object_Textblock_Filter | 224 | * @typedef Efl_Canvas_Text_Filter |
225 | * A structure holding gfx filter information for a text item | 225 | * A structure holding gfx filter information for a text item |
226 | */ | 226 | */ |
227 | typedef struct _Evas_Object_Textblock_Filter Evas_Object_Textblock_Filter; | 227 | typedef struct _Efl_Canvas_Text_Filter Efl_Canvas_Text_Filter; |
228 | /** | 228 | /** |
229 | * @internal | 229 | * @internal |
230 | * @typedef Evas_Object_Textblock_Filter_Post_Render | 230 | * @typedef Efl_Canvas_Text_Filter_Post_Render |
231 | * Post-render data for async rendering of gfx filters | 231 | * Post-render data for async rendering of gfx filters |
232 | */ | 232 | */ |
233 | typedef struct _Evas_Object_Textblock_Filter_Post_Render Evas_Object_Textblock_Filter_Post_Render; | 233 | typedef struct _Efl_Canvas_Text_Filter_Post_Render Efl_Canvas_Text_Filter_Post_Render; |
234 | /** | ||
235 | * @internal | ||
236 | * @typedef Efl_Canvas_Text_Filter_Program | ||
237 | * Filter name - code database | ||
238 | */ | ||
239 | typedef struct _Efl_Canvas_Text_Filter_Program Efl_Canvas_Text_Filter_Program; | ||
234 | /** | 240 | /** |
235 | * @internal | 241 | * @internal |
236 | * @def IS_AT_END(ti, ind) | 242 | * @def IS_AT_END(ti, ind) |
@@ -446,13 +452,12 @@ struct _Evas_Object_Textblock_Format_Item | |||
446 | Eina_Bool formatme : 1; /**< EINA_TRUE if format required, else EINA_FALSE */ | 452 | Eina_Bool formatme : 1; /**< EINA_TRUE if format required, else EINA_FALSE */ |
447 | }; | 453 | }; |
448 | 454 | ||
449 | struct _Evas_Object_Textblock_Filter | 455 | struct _Efl_Canvas_Text_Filter |
450 | { | 456 | { |
451 | // FIXME: sources not handled! --> global to the textblock | 457 | // FIXME: sources not handled! --> global to the textblock |
452 | // FIXME: data not handled! --> global to the textblock | 458 | // FIXME: data not handled! --> global to the textblock |
453 | // FIXME: filters need names! --> global to the textblock | 459 | // FIXME: filters need names! --> global to the textblock |
454 | Eina_Stringshare *code; // only name! and reference to textblock's list of filters | 460 | Eina_Stringshare *name; |
455 | Evas_Filter_Program *pgm; | ||
456 | Evas_Filter_Context *ctx; | 461 | Evas_Filter_Context *ctx; |
457 | Evas_Object *eo_obj; | 462 | Evas_Object *eo_obj; |
458 | Evas_Public_Data *evas; | 463 | Evas_Public_Data *evas; |
@@ -464,12 +469,21 @@ struct _Evas_Object_Textblock_Filter | |||
464 | Eina_Bool async; | 469 | Eina_Bool async; |
465 | }; | 470 | }; |
466 | 471 | ||
467 | struct _Evas_Object_Textblock_Filter_Post_Render | 472 | struct _Efl_Canvas_Text_Filter_Post_Render |
468 | { | 473 | { |
469 | Evas_Object_Textblock_Filter *filter; | 474 | Efl_Canvas_Text_Filter *filter; |
470 | Eina_Bool success; | 475 | Eina_Bool success; |
471 | }; | 476 | }; |
472 | 477 | ||
478 | struct _Efl_Canvas_Text_Filter_Program | ||
479 | { | ||
480 | EINA_INLIST; | ||
481 | Eina_Stringshare *name; | ||
482 | Eina_Stringshare *code; | ||
483 | Evas_Filter_Program *pgm; | ||
484 | Eina_Bool changed; | ||
485 | }; | ||
486 | |||
473 | struct _Evas_Object_Textblock_Format | 487 | struct _Evas_Object_Textblock_Format |
474 | { | 488 | { |
475 | Evas_Object_Textblock_Node_Format *fnode; /**< Pointer to textblock format node. */ | 489 | Evas_Object_Textblock_Node_Format *fnode; /**< Pointer to textblock format node. */ |
@@ -490,7 +504,7 @@ struct _Evas_Object_Textblock_Format | |||
490 | struct { | 504 | struct { |
491 | int l, r; | 505 | int l, r; |
492 | } margin; /**< Left and right margin width. */ | 506 | } margin; /**< Left and right margin width. */ |
493 | Evas_Object_Textblock_Filter *gfx_filter; /**< Gfx Filter to apply to this node */ | 507 | Efl_Canvas_Text_Filter *gfx_filter; /**< Gfx Filter to apply to this node */ |
494 | int ref; /**< Value of the ref. */ | 508 | int ref; /**< Value of the ref. */ |
495 | int tabstops; /**< Value of the size of the tab character. */ | 509 | int tabstops; /**< Value of the size of the tab character. */ |
496 | int linesize; /**< Value of the size of the line of the text. */ | 510 | int linesize; /**< Value of the size of the line of the text. */ |
@@ -581,6 +595,9 @@ struct _Evas_Object_Textblock | |||
581 | int w, h, oneline_h; | 595 | int w, h, oneline_h; |
582 | Eina_Bool valid : 1; | 596 | Eina_Bool valid : 1; |
583 | } formatted, native; | 597 | } formatted, native; |
598 | struct { | ||
599 | Efl_Canvas_Text_Filter_Program *programs; | ||
600 | } gfx_filter; | ||
584 | Eina_Bool redraw : 1; | 601 | Eina_Bool redraw : 1; |
585 | Eina_Bool changed : 1; | 602 | Eina_Bool changed : 1; |
586 | Eina_Bool obstacle_changed : 1; | 603 | Eina_Bool obstacle_changed : 1; |
@@ -922,7 +939,7 @@ _format_unref_free(const Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt) | |||
922 | if (fmt->font.source) eina_stringshare_del(fmt->font.source); | 939 | if (fmt->font.source) eina_stringshare_del(fmt->font.source); |
923 | if (fmt->gfx_filter) | 940 | if (fmt->gfx_filter) |
924 | { | 941 | { |
925 | eina_stringshare_del(fmt->gfx_filter->code); | 942 | eina_stringshare_del(fmt->gfx_filter->name); |
926 | if (fmt->gfx_filter->dc) | 943 | if (fmt->gfx_filter->dc) |
927 | ENFN->context_free(ENDT, fmt->gfx_filter->dc); | 944 | ENFN->context_free(ENDT, fmt->gfx_filter->dc); |
928 | free(fmt->gfx_filter); | 945 | free(fmt->gfx_filter); |
@@ -2511,12 +2528,12 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch | |||
2511 | * | 2528 | * |
2512 | * Experimental filter, see efl_gfx_filter for more information. | 2529 | * Experimental filter, see efl_gfx_filter for more information. |
2513 | * @code | 2530 | * @code |
2514 | * gfx_filter='lua code' | 2531 | * gfx_filter='filter name' |
2515 | * @endcode | 2532 | * @endcode |
2516 | */ | 2533 | */ |
2517 | if (!fmt->gfx_filter) | 2534 | if (!fmt->gfx_filter) |
2518 | fmt->gfx_filter = calloc(1, sizeof(Evas_Object_Textblock_Filter)); | 2535 | fmt->gfx_filter = calloc(1, sizeof(Efl_Canvas_Text_Filter)); |
2519 | eina_stringshare_replace(&fmt->gfx_filter->code, param); | 2536 | eina_stringshare_replace(&fmt->gfx_filter->name, param); |
2520 | } | 2537 | } |
2521 | } | 2538 | } |
2522 | 2539 | ||
@@ -12796,7 +12813,7 @@ evas_object_textblock_free(Evas_Object *eo_obj) | |||
12796 | } | 12813 | } |
12797 | 12814 | ||
12798 | static void | 12815 | static void |
12799 | _filter_sync_end(Evas_Object_Textblock_Filter *filter, Eina_Bool success) | 12816 | _filter_sync_end(Efl_Canvas_Text_Filter *filter, Eina_Bool success) |
12800 | { | 12817 | { |
12801 | evas_filter_context_destroy(filter->ctx); | 12818 | evas_filter_context_destroy(filter->ctx); |
12802 | filter->invalid = !success; | 12819 | filter->invalid = !success; |
@@ -12806,7 +12823,7 @@ _filter_sync_end(Evas_Object_Textblock_Filter *filter, Eina_Bool success) | |||
12806 | static void | 12823 | static void |
12807 | _filter_post_render_cb(void *data) | 12824 | _filter_post_render_cb(void *data) |
12808 | { | 12825 | { |
12809 | Evas_Object_Textblock_Filter_Post_Render *post_data = data; | 12826 | Efl_Canvas_Text_Filter_Post_Render *post_data = data; |
12810 | 12827 | ||
12811 | _filter_sync_end(post_data->filter, post_data->success); | 12828 | _filter_sync_end(post_data->filter, post_data->success); |
12812 | free(post_data); | 12829 | free(post_data); |
@@ -12815,8 +12832,8 @@ _filter_post_render_cb(void *data) | |||
12815 | static void | 12832 | static void |
12816 | _filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success) | 12833 | _filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success) |
12817 | { | 12834 | { |
12818 | Evas_Object_Textblock_Filter_Post_Render *post_data; | 12835 | Efl_Canvas_Text_Filter_Post_Render *post_data; |
12819 | Evas_Object_Textblock_Filter *filter = data; | 12836 | Efl_Canvas_Text_Filter *filter = data; |
12820 | 12837 | ||
12821 | EINA_SAFETY_ON_FALSE_RETURN(filter->ctx == ctx); | 12838 | EINA_SAFETY_ON_FALSE_RETURN(filter->ctx == ctx); |
12822 | 12839 | ||
@@ -12832,6 +12849,20 @@ _filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success) | |||
12832 | evas_post_render_job_add(filter->evas, _filter_post_render_cb, post_data); | 12849 | evas_post_render_job_add(filter->evas, _filter_post_render_cb, post_data); |
12833 | } | 12850 | } |
12834 | 12851 | ||
12852 | static Efl_Canvas_Text_Filter_Program * | ||
12853 | _filter_program_find(Efl_Canvas_Text_Data *o, const char *name) | ||
12854 | { | ||
12855 | Efl_Canvas_Text_Filter_Program *prg; | ||
12856 | |||
12857 | EINA_INLIST_FOREACH(o->gfx_filter.programs, prg) | ||
12858 | { | ||
12859 | if (eina_streq(name, prg->name)) | ||
12860 | return prg; | ||
12861 | } | ||
12862 | |||
12863 | return NULL; | ||
12864 | } | ||
12865 | |||
12835 | static void | 12866 | static void |
12836 | evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, | 12867 | evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, |
12837 | Evas_Object_Protected_Data *obj, | 12868 | Evas_Object_Protected_Data *obj, |
@@ -12970,34 +13001,25 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, | |||
12970 | nr / 65025, ng / 65025, nb / 65025, na / 65025); \ | 13001 | nr / 65025, ng / 65025, nb / 65025, na / 65025); \ |
12971 | cr = nr; cg = ng; cb = nb; ca = na; \ | 13002 | cr = nr; cg = ng; cb = nb; ca = na; \ |
12972 | } | 13003 | } |
12973 | /* | ||
12974 | #define DRAW_TEXT(ox, oy) \ | ||
12975 | if (ti->parent.format->font.font) { \ | ||
12976 | ENFN->context_cutout_target(output, context, \ | ||
12977 | obj->cur->geometry.x + ln->x - (ln->h * 4) + ti->parent.x + x + (ox) - 100, \ | ||
12978 | obj->cur->geometry.y + ln->par->y + ln->y - ln->h + y + (oy), \ | ||
12979 | ti->parent.w + (ln->h * 8), ln->h * 3); \ | ||
12980 | evas_font_draw_async_check(obj, output, context, surface, \ | ||
12981 | ti->parent.format->font.font, \ | ||
12982 | obj->cur->geometry.x + ln->x + ti->parent.x + x + (ox), \ | ||
12983 | obj->cur->geometry.y + ln->par->y + ln->y + yoff + y + (oy), \ | ||
12984 | ti->parent.w, ti->parent.h, ti->parent.w, ti->parent.h, \ | ||
12985 | &ti->text_props, do_async); \ | ||
12986 | } | ||
12987 | */ | ||
12988 | 13004 | ||
12989 | #define DRAW_TEXT_FILTER(gfx_f, ox, oy) \ | 13005 | #define DRAW_TEXT_FILTER(gfx_f, ox, oy) do { \ |
12990 | evas_filter_input_render(eo_obj, gfx_f->ctx, gfx_f->dc, ti, \ | 13006 | evas_filter_input_render(eo_obj, gfx_f->ctx, gfx_f->dc, ti, \ |
12991 | gfx_f->pad.l, gfx_f->pad.r, \ | 13007 | gfx_f->pad.l, gfx_f->pad.r, \ |
12992 | gfx_f->pad.t, gfx_f->pad.b, do_async) | 13008 | gfx_f->pad.t, gfx_f->pad.b, do_async); \ |
12993 | 13009 | } while (0) | |
12994 | #define DRAW_TEXT_NOFILTER(ox, oy) \ | 13010 | |
13011 | #define DRAW_TEXT_NOFILTER(ox, oy) do { \ | ||
13012 | ENFN->context_cutout_target(output, context, \ | ||
13013 | obj->cur->geometry.x + ln->x - (ln->h * 4) + ti->parent.x + x + (ox) - 100, \ | ||
13014 | obj->cur->geometry.y + ln->par->y + ln->y - ln->h + y + (oy), \ | ||
13015 | ti->parent.w + (ln->h * 8), ln->h * 3); \ | ||
12995 | evas_font_draw_async_check(obj, output, context, surface, \ | 13016 | evas_font_draw_async_check(obj, output, context, surface, \ |
12996 | ti->parent.format->font.font, \ | 13017 | ti->parent.format->font.font, \ |
12997 | obj->cur->geometry.x + ln->x + ti->parent.x + x + (ox), \ | 13018 | obj->cur->geometry.x + ln->x + ti->parent.x + x + (ox), \ |
12998 | obj->cur->geometry.y + ln->par->y + ln->y + yoff + y + (oy), \ | 13019 | obj->cur->geometry.y + ln->par->y + ln->y + yoff + y + (oy), \ |
12999 | ti->parent.w, ti->parent.h, ti->parent.w, ti->parent.h, \ | 13020 | ti->parent.w, ti->parent.h, ti->parent.w, ti->parent.h, \ |
13000 | &ti->text_props, do_async) \ | 13021 | &ti->text_props, do_async); \ |
13022 | } while (0) | ||
13001 | 13023 | ||
13002 | #define DRAW_TEXT(ox, oy) do { \ | 13024 | #define DRAW_TEXT(ox, oy) do { \ |
13003 | if (ti->parent.format->font.font) \ | 13025 | if (ti->parent.format->font.font) \ |
@@ -13146,23 +13168,33 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, | |||
13146 | { | 13168 | { |
13147 | Efl_Canvas_Filter_State state = EFL_CANVAS_FILTER_STATE_DEFAULT; | 13169 | Efl_Canvas_Filter_State state = EFL_CANVAS_FILTER_STATE_DEFAULT; |
13148 | Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(itr); | 13170 | Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(itr); |
13149 | Evas_Object_Textblock_Filter *filter; | 13171 | Efl_Canvas_Text_Filter_Program *program; |
13172 | Efl_Canvas_Text_Filter *filter; | ||
13150 | Evas_Filter_Program *pgm; | 13173 | Evas_Filter_Program *pgm; |
13151 | Evas_Filter_Context *ctx; | 13174 | Evas_Filter_Context *ctx; |
13152 | Eina_Bool ok; | 13175 | Eina_Bool ok; |
13153 | 13176 | ||
13154 | filter = ti->parent.format->gfx_filter; | 13177 | filter = ti->parent.format->gfx_filter; |
13155 | if (!filter->code || filter->invalid) | 13178 | if (!filter->name || filter->invalid) |
13179 | { | ||
13180 | itr->has_gfx_filter = EINA_FALSE; | ||
13181 | continue; | ||
13182 | } | ||
13183 | |||
13184 | program = _filter_program_find(o, filter->name); | ||
13185 | if (!program) | ||
13156 | { | 13186 | { |
13187 | WRN("Filter '%s' not found on this object", filter->name); | ||
13157 | itr->has_gfx_filter = EINA_FALSE; | 13188 | itr->has_gfx_filter = EINA_FALSE; |
13158 | continue; | 13189 | continue; |
13159 | } | 13190 | } |
13160 | 13191 | ||
13161 | pgm = filter->pgm; | 13192 | pgm = program->pgm; |
13162 | if (!pgm) | 13193 | if (!pgm) |
13163 | { | 13194 | { |
13164 | pgm = evas_filter_program_new(NULL, EINA_FALSE); | 13195 | // TODO: data set |
13165 | ok = evas_filter_program_parse(pgm, filter->code); | 13196 | pgm = evas_filter_program_new(program->name, EINA_FALSE); |
13197 | ok = evas_filter_program_parse(pgm, program->code); | ||
13166 | if (!ok) | 13198 | if (!ok) |
13167 | { | 13199 | { |
13168 | evas_filter_program_del(pgm); | 13200 | evas_filter_program_del(pgm); |
@@ -13170,13 +13202,14 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, | |||
13170 | itr->has_gfx_filter = EINA_FALSE; | 13202 | itr->has_gfx_filter = EINA_FALSE; |
13171 | continue; | 13203 | continue; |
13172 | } | 13204 | } |
13173 | filter->pgm = pgm; | 13205 | program->pgm = pgm; |
13174 | } | 13206 | } |
13175 | 13207 | ||
13176 | #ifdef DEBUG | 13208 | #ifdef DEBUG |
13177 | if (filter->ctx) WRN("Previous filter context was not deleted"); | 13209 | if (filter->ctx) WRN("Previous filter context was not deleted"); |
13178 | #endif | 13210 | #endif |
13179 | 13211 | ||
13212 | // TODO: sources set | ||
13180 | ctx = evas_filter_context_new(obj->layer->evas, do_async); | 13213 | ctx = evas_filter_context_new(obj->layer->evas, do_async); |
13181 | evas_filter_state_prepare(eo_obj, &state, ti); | 13214 | evas_filter_state_prepare(eo_obj, &state, ti); |
13182 | evas_filter_program_state_set(pgm, &state); | 13215 | evas_filter_program_state_set(pgm, &state); |
@@ -13184,8 +13217,6 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, | |||
13184 | if (!ok) | 13217 | if (!ok) |
13185 | { | 13218 | { |
13186 | evas_filter_context_destroy(ctx); | 13219 | evas_filter_context_destroy(ctx); |
13187 | evas_filter_program_del(pgm); | ||
13188 | filter->pgm = NULL; | ||
13189 | filter->invalid = EINA_TRUE; | 13220 | filter->invalid = EINA_TRUE; |
13190 | itr->has_gfx_filter = EINA_FALSE; | 13221 | itr->has_gfx_filter = EINA_FALSE; |
13191 | continue; | 13222 | continue; |
@@ -13481,7 +13512,7 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, | |||
13481 | 13512 | ||
13482 | if (EINA_UNLIKELY(itr->has_gfx_filter)) | 13513 | if (EINA_UNLIKELY(itr->has_gfx_filter)) |
13483 | { | 13514 | { |
13484 | Evas_Object_Textblock_Filter *filter = ti->parent.format->gfx_filter; | 13515 | Efl_Canvas_Text_Filter *filter = ti->parent.format->gfx_filter; |
13485 | Evas_Filter_Context *ctx = filter->ctx; | 13516 | Evas_Filter_Context *ctx = filter->ctx; |
13486 | 13517 | ||
13487 | evas_filter_context_post_run_callback_set(ctx, _filter_cb, filter); | 13518 | evas_filter_context_post_run_callback_set(ctx, _filter_cb, filter); |
@@ -13515,8 +13546,10 @@ _efl_canvas_text_efl_canvas_filter_internal_filter_state_prepare( | |||
13515 | Eo *eo_obj, Efl_Canvas_Text_Data *pd EINA_UNUSED, Efl_Canvas_Filter_State *state, void *data) | 13546 | Eo *eo_obj, Efl_Canvas_Text_Data *pd EINA_UNUSED, Efl_Canvas_Filter_State *state, void *data) |
13516 | { | 13547 | { |
13517 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 13548 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); |
13549 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_TEXT_CLASS); | ||
13518 | Evas_Object_Textblock_Text_Item *ti = data; | 13550 | Evas_Object_Textblock_Text_Item *ti = data; |
13519 | int l, r, t, b; | 13551 | Efl_Canvas_Text_Filter_Program *program; |
13552 | int l = 0, r = 0, t = 0, b = 0; | ||
13520 | 13553 | ||
13521 | #define STATE_COLOR(dst, src) dst.r = src.r; dst.g = src.g; dst.b = src.b; dst.a = src.a | 13554 | #define STATE_COLOR(dst, src) dst.r = src.r; dst.g = src.g; dst.b = src.b; dst.a = src.a |
13522 | STATE_COLOR(state->color, ti->parent.format->color.normal); | 13555 | STATE_COLOR(state->color, ti->parent.format->color.normal); |
@@ -13526,7 +13559,8 @@ _efl_canvas_text_efl_canvas_filter_internal_filter_state_prepare( | |||
13526 | STATE_COLOR(state->text.outline, ti->parent.format->color.outline); | 13559 | STATE_COLOR(state->text.outline, ti->parent.format->color.outline); |
13527 | #undef STATE_COLOR | 13560 | #undef STATE_COLOR |
13528 | 13561 | ||
13529 | evas_filter_program_padding_get(ti->parent.format->gfx_filter->pgm, &l, &r, &t, &b); | 13562 | program = _filter_program_find(o, ti->parent.format->gfx_filter->name); |
13563 | if (program) evas_filter_program_padding_get(program->pgm, &l, &r, &t, &b); | ||
13530 | state->w = ti->parent.w + l + r; | 13564 | state->w = ti->parent.w + l + r; |
13531 | state->h = ti->parent.h + t + b; | 13565 | state->h = ti->parent.h + t + b; |
13532 | state->scale = obj->cur->scale; | 13566 | state->scale = obj->cur->scale; |
@@ -13553,6 +13587,38 @@ _efl_canvas_text_efl_canvas_filter_internal_filter_dirty( | |||
13553 | WRN("Filter marked as dirty. NOT IMPLEMENTED!"); | 13587 | WRN("Filter marked as dirty. NOT IMPLEMENTED!"); |
13554 | } | 13588 | } |
13555 | 13589 | ||
13590 | EOLIAN static void | ||
13591 | _efl_canvas_text_efl_gfx_filter_filter_program_set(Eo *eo_obj, Efl_Canvas_Text_Data *pd, const char *code, const char *name) | ||
13592 | { | ||
13593 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
13594 | Efl_Canvas_Text_Filter_Program *prg; | ||
13595 | |||
13596 | prg = _filter_program_find(pd, name); | ||
13597 | if (prg) | ||
13598 | { | ||
13599 | if (eina_streq(prg->code, code)) return; | ||
13600 | } | ||
13601 | else | ||
13602 | { | ||
13603 | prg = calloc(1, sizeof(*prg)); | ||
13604 | prg->name = eina_stringshare_add(name); | ||
13605 | pd->gfx_filter.programs = (Efl_Canvas_Text_Filter_Program *) | ||
13606 | eina_inlist_append(EINA_INLIST_GET(pd->gfx_filter.programs), EINA_INLIST_GET(prg)); | ||
13607 | } | ||
13608 | eina_stringshare_replace(&prg->code, code); | ||
13609 | prg->changed = EINA_TRUE; | ||
13610 | |||
13611 | evas_object_change(eo_obj, obj); | ||
13612 | } | ||
13613 | |||
13614 | EOLIAN static void | ||
13615 | _efl_canvas_text_efl_gfx_filter_filter_program_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *pd EINA_UNUSED, | ||
13616 | const char **code EINA_UNUSED, const char **name EINA_UNUSED) | ||
13617 | { | ||
13618 | // FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME | ||
13619 | ERR("Invalid API definition for this object! 'name' needs to be an @in or @inout value!"); | ||
13620 | } | ||
13621 | |||
13556 | static void | 13622 | static void |
13557 | evas_object_textblock_coords_recalc(Evas_Object *eo_obj, | 13623 | evas_object_textblock_coords_recalc(Evas_Object *eo_obj, |
13558 | Evas_Object_Protected_Data *obj, | 13624 | Evas_Object_Protected_Data *obj, |