summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c228
-rw-r--r--src/lib/evas/filters/evas_filter.c21
-rw-r--r--src/lib/evas/filters/evas_filter_private.h2
-rw-r--r--src/lib/evas/include/evas_filter.h5
4 files changed, 163 insertions, 93 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index ca0ef1a00b..1cd85cd345 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -437,7 +437,8 @@ struct _Evas_Object_Textblock_Text_Item
437 Evas_Object_Textblock_Item parent; /**< Textblock item. */ 437 Evas_Object_Textblock_Item parent; /**< Textblock item. */
438 Evas_Text_Props text_props; /**< Props for this item. */ 438 Evas_Text_Props text_props; /**< Props for this item. */
439 Evas_Coord x_adjustment; /**< Used to indicate by how much we adjusted sizes */ 439 Evas_Coord x_adjustment; /**< Used to indicate by how much we adjusted sizes */
440 int gfx_filter_id; /**< Index for the filter context in parent.format->gfx_filter */ 440 Evas_Filter_Context *gfx_filter_ctx; /* temp variable FIXME */
441 void *gfx_buffer; /* FIXME */
441}; 442};
442 443
443struct _Evas_Object_Textblock_Format_Item 444struct _Evas_Object_Textblock_Format_Item
@@ -453,25 +454,20 @@ struct _Evas_Object_Textblock_Format_Item
453 454
454struct _Efl_Canvas_Text_Filter 455struct _Efl_Canvas_Text_Filter
455{ 456{
456 // FIXME: sources not handled! --> global to the textblock
457 // FIXME: data not handled! --> global to the textblock
458 Eina_Stringshare *name; 457 Eina_Stringshare *name;
459 Eina_Array *contexts; /* contains Evas_Filter_Context items for each sub text item */
460 Evas_Object *eo_obj; 458 Evas_Object *eo_obj;
461 Evas_Public_Data *evas; 459 Evas_Public_Data *evas;
462 void *dc; /* draw context - no clip, white, no colmul... */ 460 void *dc; /* draw context - no clip, white, no colmul... */
463 struct { 461 struct {
464 int l, r, t, b; 462 int l, r, t, b;
465 } pad; 463 } pad;
466 int pending_ctx;
467 Eina_Bool invalid; 464 Eina_Bool invalid;
468 Eina_Bool async; 465 Eina_Bool redraw;
469}; 466};
470 467
471struct _Efl_Canvas_Text_Filter_Post_Render 468struct _Efl_Canvas_Text_Filter_Post_Render
472{ 469{
473 Efl_Canvas_Text_Filter *filter; 470 Evas_Filter_Context *ctx;
474 int ctx_id;
475 Eina_Bool success; 471 Eina_Bool success;
476}; 472};
477 473
@@ -952,6 +948,33 @@ _format_unref_free(const Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt)
952 free(fmt); 948 free(fmt);
953} 949}
954 950
951typedef struct _Post_Render_Image_Unref_Job
952{
953 Evas_Public_Data *evas;
954 void *image;
955} Post_Render_Image_Unref_Job;
956
957static void
958_image_post_render_unref_cb(void *data)
959{
960 Post_Render_Image_Unref_Job *job = data;
961
962 job->evas->engine.func->image_free(job->evas->engine.data.output, job->image);
963 free(job);
964}
965
966static inline void
967_image_safe_unref(Evas_Public_Data *e, void *image)
968{
969 Post_Render_Image_Unref_Job *job;
970
971 if (!image) return;
972 job = calloc(1, sizeof(*job));
973 job->evas = e;
974 job->image = image;
975 evas_post_render_job_add(e, _image_post_render_unref_cb, job);
976}
977
955/** 978/**
956 * @internal 979 * @internal
957 * Free a layout item 980 * Free a layout item
@@ -967,6 +990,16 @@ _item_free(const Evas_Object *eo_obj, Evas_Object_Textblock_Line *ln, Evas_Objec
967 Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(it); 990 Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(it);
968 991
969 evas_common_text_props_content_unref(&ti->text_props); 992 evas_common_text_props_content_unref(&ti->text_props);
993 if (ti->gfx_filter_ctx)
994 {
995 WRN("filter context still alive? (ignored)");
996 }
997 if (ti->gfx_buffer)
998 {
999 Evas_Public_Data *e = efl_data_scope_get(evas_object_evas_get(eo_obj), EVAS_CANVAS_CLASS);
1000 _image_safe_unref(e, ti->gfx_buffer);
1001 ti->gfx_buffer = NULL;
1002 }
970 } 1003 }
971 else 1004 else
972 { 1005 {
@@ -4000,15 +4033,17 @@ _text_item_update_sizes(Ctxt *c, Evas_Object_Textblock_Text_Item *ti)
4000 Evas_Filter_Program *pgm; 4033 Evas_Filter_Program *pgm;
4001 4034
4002 pgm = _format_filter_program_get(c->o, ti->parent.format); 4035 pgm = _format_filter_program_get(c->o, ti->parent.format);
4003 evas_filter_program_padding_get(pgm, &l, &r, &t, &b); 4036 if (pgm)
4004 4037 {
4005 // FIXME: Those values are very very strange 4038 evas_filter_program_padding_get(pgm, &l, &r, &t, &b);
4006 ti->x_adjustment = r + l; 4039
4007 ti->parent.w = tw + ti->x_adjustment; 4040 ti->x_adjustment = r + l;
4008 ti->parent.h = th; 4041 ti->parent.w = tw + ti->x_adjustment; // FIXME: why add l+r here,
4009 ti->parent.adv = advw; 4042 ti->parent.h = th; // but not t+b here?
4010 ti->parent.x = 0; 4043 ti->parent.adv = advw;
4011 return; 4044 ti->parent.x = 0;
4045 return;
4046 }
4012 } 4047 }
4013 4048
4014 /* These adjustments are calculated and thus heavily linked to those in 4049 /* These adjustments are calculated and thus heavily linked to those in
@@ -4590,20 +4625,17 @@ _layout_do_format(const Evas_Object *obj, Ctxt *c,
4590 } 4625 }
4591 4626
4592 { 4627 {
4593 Evas_Coord pad_l, pad_r, pad_t, pad_b; 4628 Evas_Coord pad_l = 0, pad_r = 0, pad_t = 0, pad_b = 0;
4594 pad_l = pad_r = pad_t = pad_b = 0; 4629 Evas_Filter_Program *pgm = NULL;
4595 4630
4596 if (EINA_LIKELY(!fmt->gfx_filter)) 4631 if (EINA_UNLIKELY(fmt->gfx_filter != NULL))
4597 evas_text_style_pad_get(fmt->style, &pad_l, &pad_r, &pad_t, &pad_b); 4632 pgm = _format_filter_program_get(efl_data_scope_get(obj, MY_CLASS), fmt);
4633
4634 if (EINA_UNLIKELY(pgm != NULL))
4635 evas_filter_program_padding_get(pgm, &pad_l, &pad_r, &pad_t, &pad_b);
4598 else 4636 else
4599 { 4637 evas_text_style_pad_get(fmt->style, &pad_l, &pad_r, &pad_t, &pad_b);
4600 Evas_Filter_Program *pgm;
4601 Efl_Canvas_Text_Data *o;
4602 4638
4603 o = efl_data_scope_get(obj, MY_CLASS);
4604 pgm = _format_filter_program_get(o, fmt);
4605 evas_filter_program_padding_get(pgm, &pad_l, &pad_r, &pad_t, &pad_b);
4606 }
4607 if (pad_l > *style_pad_l) *style_pad_l = pad_l; 4639 if (pad_l > *style_pad_l) *style_pad_l = pad_l;
4608 if (pad_r > *style_pad_r) *style_pad_r = pad_r; 4640 if (pad_r > *style_pad_r) *style_pad_r = pad_r;
4609 if (pad_t > *style_pad_t) *style_pad_t = pad_t; 4641 if (pad_t > *style_pad_t) *style_pad_t = pad_t;
@@ -12910,22 +12942,42 @@ evas_object_textblock_free(Evas_Object *eo_obj)
12910 free(o->utf8); 12942 free(o->utf8);
12911} 12943}
12912 12944
12945static Evas_Filter_Context *
12946_filter_context_get(Evas_Object_Textblock_Text_Item *ti)
12947{
12948 // FIXME: optimize this (memory usage)
12949 if (!ti) return NULL;
12950 return ti->gfx_filter_ctx;
12951}
12952
12913static void 12953static void
12914_filter_sync_end(Efl_Canvas_Text_Filter *filter, int id, Eina_Bool success) 12954_filter_context_set(Evas_Object_Textblock_Text_Item *ti, Evas_Filter_Context *ctx)
12915{ 12955{
12916 Evas_Filter_Context *ctx; 12956 if (!ti) return;
12957 ti->gfx_filter_ctx = ctx;
12958}
12917 12959
12918 EINA_SAFETY_ON_NULL_RETURN(filter->contexts); 12960static void
12919 ctx = eina_array_data_get(filter->contexts, id); 12961_filter_sync_end(Evas_Filter_Context *ctx, Eina_Bool success)
12920 eina_array_data_set(filter->contexts, id, NULL); 12962{
12921 evas_filter_context_destroy(ctx); 12963 Evas_Object_Textblock_Text_Item *ti;
12922 filter->invalid = !success; 12964 Efl_Canvas_Text_Filter *filter;
12965 void *buffer;
12923 12966
12924 if ((--filter->pending_ctx) == 0) 12967 ti = evas_filter_context_data_get(ctx);
12968 filter = ti->parent.format->gfx_filter;
12969
12970 buffer = evas_filter_buffer_backing_steal(ctx, EVAS_FILTER_BUFFER_OUTPUT_ID);
12971 if (buffer)
12925 { 12972 {
12926 eina_array_free(filter->contexts); 12973 if (ti->gfx_buffer)
12927 filter->contexts = NULL; 12974 _image_safe_unref(filter->evas, ti->gfx_buffer);
12975 ti->gfx_buffer = buffer;
12928 } 12976 }
12977
12978 evas_filter_context_destroy(ctx);
12979 _filter_context_set(ti, NULL);
12980 filter->invalid = !success;
12929} 12981}
12930 12982
12931static void 12983static void
@@ -12933,7 +12985,7 @@ _filter_post_render_cb(void *data)
12933{ 12985{
12934 Efl_Canvas_Text_Filter_Post_Render *post_data = data; 12986 Efl_Canvas_Text_Filter_Post_Render *post_data = data;
12935 12987
12936 _filter_sync_end(post_data->filter, post_data->ctx_id, post_data->success); 12988 _filter_sync_end(post_data->ctx, post_data->success);
12937 free(post_data); 12989 free(post_data);
12938} 12990}
12939 12991
@@ -12942,20 +12994,16 @@ _filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success)
12942{ 12994{
12943 Efl_Canvas_Text_Filter_Post_Render *post_data; 12995 Efl_Canvas_Text_Filter_Post_Render *post_data;
12944 Efl_Canvas_Text_Filter *filter = data; 12996 Efl_Canvas_Text_Filter *filter = data;
12945 int ctx_id;
12946 12997
12947 ctx_id = evas_filter_context_id_get(ctx); 12998 if (!evas_filter_context_async_get(ctx))
12948
12949 if (!filter->async)
12950 { 12999 {
12951 _filter_sync_end(filter, ctx_id, success); 13000 _filter_sync_end(ctx, success);
12952 return; 13001 return;
12953 } 13002 }
12954 13003
12955 post_data = calloc(1, sizeof(*post_data)); 13004 post_data = calloc(1, sizeof(*post_data));
12956 post_data->success = success; 13005 post_data->success = success;
12957 post_data->filter = filter; 13006 post_data->ctx = ctx;
12958 post_data->ctx_id = ctx_id;
12959 evas_post_render_job_add(filter->evas, _filter_post_render_cb, post_data); 13007 evas_post_render_job_add(filter->evas, _filter_post_render_cb, post_data);
12960} 13008}
12961 13009
@@ -13098,9 +13146,8 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13098 cr = nr; cg = ng; cb = nb; ca = na; \ 13146 cr = nr; cg = ng; cb = nb; ca = na; \
13099 } 13147 }
13100 13148
13101#define DRAW_TEXT_FILTER(gf, gf_id, ox, oy) do { \ 13149#define DRAW_TEXT_FILTER(gf, ox, oy) do { \
13102 Evas_Filter_Context *ctx = eina_array_data_get(gf->contexts, gf_id); \ 13150 evas_filter_input_render(eo_obj, _filter_context_get(ti), gf->dc, ti, \
13103 evas_filter_input_render(eo_obj, ctx, gf->dc, ti, \
13104 gf->pad.l, gf->pad.r, \ 13151 gf->pad.l, gf->pad.r, \
13105 gf->pad.t, gf->pad.b, do_async); \ 13152 gf->pad.t, gf->pad.b, do_async); \
13106 } while (0) 13153 } while (0)
@@ -13121,10 +13168,10 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13121#define DRAW_TEXT(ox, oy) do { \ 13168#define DRAW_TEXT(ox, oy) do { \
13122 if (ti->parent.format->font.font) \ 13169 if (ti->parent.format->font.font) \
13123 { \ 13170 { \
13124 if (EINA_LIKELY(!ti->gfx_filter_id)) \ 13171 if (EINA_LIKELY(!ti->gfx_filter_ctx)) \
13125 DRAW_TEXT_NOFILTER(ox, oy); \ 13172 DRAW_TEXT_NOFILTER(ox, oy); \
13126 else \ 13173 else if (!ti->gfx_buffer) \
13127 DRAW_TEXT_FILTER(ti->parent.format->gfx_filter, ti->gfx_filter_id - 1, ox, oy); \ 13174 DRAW_TEXT_FILTER(ti->parent.format->gfx_filter, ox, oy); \
13128 } } while(0) 13175 } } while(0)
13129 13176
13130 /* backing */ 13177 /* backing */
@@ -13258,8 +13305,6 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13258 /* There are size adjustments that depend on the styles drawn here back 13305 /* There are size adjustments that depend on the styles drawn here back
13259 * in "_text_item_update_sizes" should not modify one without the other. */ 13306 * in "_text_item_update_sizes" should not modify one without the other. */
13260 13307
13261 /* prepare everything for text draw */
13262
13263 /* gfx filters preparation */ 13308 /* gfx filters preparation */
13264 EINA_LIST_FOREACH(gfx_filters, li, itr) 13309 EINA_LIST_FOREACH(gfx_filters, li, itr)
13265 { 13310 {
@@ -13268,27 +13313,29 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13268 Efl_Canvas_Text_Filter *filter; 13313 Efl_Canvas_Text_Filter *filter;
13269 Evas_Filter_Program *pgm; 13314 Evas_Filter_Program *pgm;
13270 Evas_Filter_Context *ctx; 13315 Evas_Filter_Context *ctx;
13271 int filter_id;
13272 Eina_Bool ok; 13316 Eina_Bool ok;
13317 int X, Y;
13273 13318
13319 ln = ti->parent.ln;
13274 filter = ti->parent.format->gfx_filter; 13320 filter = ti->parent.format->gfx_filter;
13275 pgm = _format_filter_program_get(o, ti->parent.format); 13321 pgm = _format_filter_program_get(o, ti->parent.format);
13276 if (!pgm) 13322 if (!pgm)
13277 { 13323 {
13278 WRN("Filter '%s' not found on this object", filter->name); 13324 WRN("Filter '%s' not found on this object", filter->name);
13279 ti->gfx_filter_id = 0;
13280 continue; 13325 continue;
13281 } 13326 }
13282 13327
13283#ifdef DEBUG 13328 // previous run
13284 if (filter->contexts) WRN("Previous filter context was not deleted"); 13329 if (ti->gfx_buffer)
13285#endif 13330 {
13331 if (!filter->redraw) continue;
13286 13332
13287 if (!filter->contexts) 13333 _image_safe_unref(obj->layer->evas, ti->gfx_buffer);
13288 filter->contexts = eina_array_new(8); 13334 ti->gfx_buffer = NULL;
13289 filter_id = eina_array_count(filter->contexts); 13335 }
13290 13336
13291 ctx = evas_filter_context_new(obj->layer->evas, do_async, filter_id); 13337 // prepare filter context
13338 ctx = evas_filter_context_new(obj->layer->evas, do_async, ti);
13292 evas_filter_state_prepare(eo_obj, &state, ti); 13339 evas_filter_state_prepare(eo_obj, &state, ti);
13293 evas_filter_program_state_set(pgm, &state); 13340 evas_filter_program_state_set(pgm, &state);
13294 ok = evas_filter_context_program_use(ctx, pgm); 13341 ok = evas_filter_context_program_use(ctx, pgm);
@@ -13296,26 +13343,26 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13296 { 13343 {
13297 evas_filter_context_destroy(ctx); 13344 evas_filter_context_destroy(ctx);
13298 filter->invalid = EINA_TRUE; 13345 filter->invalid = EINA_TRUE;
13299 ti->gfx_filter_id = 0;
13300 continue; 13346 continue;
13301 } 13347 }
13302 13348
13303 eina_array_push(filter->contexts, ctx); 13349 // target position
13304 ti->gfx_filter_id = filter_id + 1; 13350 evas_filter_program_padding_get(pgm,
13351 &filter->pad.l, &filter->pad.r,
13352 &filter->pad.t, &filter->pad.b);
13353 X = obj->cur->geometry.x + ln->x + ti->parent.x + x - filter->pad.l;
13354 Y = obj->cur->geometry.y + ln->par->y + ln->y + y - filter->pad.t;
13305 13355
13306 ln = ti->parent.ln;
13307 ENFN->context_color_set(ENDT, context, 255, 255, 255, 255); 13356 ENFN->context_color_set(ENDT, context, 255, 255, 255, 255);
13308 ENFN->context_multiplier_set(ENDT, context, 13357 ENFN->context_multiplier_set(ENDT, context,
13309 obj->cur->cache.clip.r, obj->cur->cache.clip.g, 13358 obj->cur->cache.clip.r, obj->cur->cache.clip.g,
13310 obj->cur->cache.clip.b, obj->cur->cache.clip.a); 13359 obj->cur->cache.clip.b, obj->cur->cache.clip.a);
13311 evas_filter_program_padding_get(pgm,
13312 &filter->pad.l, &filter->pad.r,
13313 &filter->pad.t, &filter->pad.b);
13314 evas_filter_context_proxy_render_all(ctx, eo_obj, EINA_FALSE); 13360 evas_filter_context_proxy_render_all(ctx, eo_obj, EINA_FALSE);
13315 evas_filter_context_buffers_allocate_all(ctx); 13361 evas_filter_context_buffers_allocate_all(ctx);
13316 evas_filter_target_set(ctx, context, surface, 13362 evas_filter_target_set(ctx, context, surface, X, Y);
13317 obj->cur->geometry.x + ln->x + ti->parent.x + x - filter->pad.l, 13363 _filter_context_set(ti, ctx);
13318 obj->cur->geometry.y + ln->par->y + ln->y + y - filter->pad.t); 13364
13365 // common data for all items (FIXME: should be common to object)
13319 if (!filter->dc) 13366 if (!filter->dc)
13320 { 13367 {
13321 filter->dc = ENFN->context_new(ENDT); 13368 filter->dc = ENFN->context_new(ENDT);
@@ -13323,8 +13370,6 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13323 } 13370 }
13324 filter->eo_obj = eo_obj; 13371 filter->eo_obj = eo_obj;
13325 filter->evas = obj->layer->evas; 13372 filter->evas = obj->layer->evas;
13326 filter->async = do_async;
13327 filter->pending_ctx++;
13328 13373
13329 ENFN->context_multiplier_unset(ENDT, context); 13374 ENFN->context_multiplier_unset(ENDT, context);
13330 } 13375 }
@@ -13342,7 +13387,7 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13342 yoff = itr->yoff; 13387 yoff = itr->yoff;
13343 ln = itr->ln; 13388 ln = itr->ln;
13344 13389
13345 if (EINA_UNLIKELY(ti->gfx_filter_id)) 13390 if (EINA_UNLIKELY(ti->gfx_filter_ctx != NULL))
13346 context = ti->parent.format->gfx_filter->dc; 13391 context = ti->parent.format->gfx_filter->dc;
13347 13392
13348 shad_dst = shad_sz = dx = dy = haveshad = 0; 13393 shad_dst = shad_sz = dx = dy = haveshad = 0;
@@ -13457,7 +13502,7 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13457 yoff = itr->yoff; 13502 yoff = itr->yoff;
13458 ln = itr->ln; 13503 ln = itr->ln;
13459 13504
13460 if (EINA_UNLIKELY(ti->gfx_filter_id)) 13505 if (EINA_UNLIKELY(ti->gfx_filter_ctx != NULL))
13461 context = ti->parent.format->gfx_filter->dc; 13506 context = ti->parent.format->gfx_filter->dc;
13462 13507
13463 if ((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) == EVAS_TEXT_STYLE_GLOW) 13508 if ((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) == EVAS_TEXT_STYLE_GLOW)
@@ -13495,7 +13540,7 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13495 yoff = itr->yoff; 13540 yoff = itr->yoff;
13496 ln = itr->ln; 13541 ln = itr->ln;
13497 13542
13498 if (EINA_UNLIKELY(ti->gfx_filter_id)) 13543 if (EINA_UNLIKELY(ti->gfx_filter_ctx != NULL))
13499 context = ti->parent.format->gfx_filter->dc; 13544 context = ti->parent.format->gfx_filter->dc;
13500 13545
13501 if (((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) == EVAS_TEXT_STYLE_OUTLINE) || 13546 if (((ti->parent.format->style & EVAS_TEXT_STYLE_MASK_BASIC) == EVAS_TEXT_STYLE_OUTLINE) ||
@@ -13580,7 +13625,7 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13580 { 13625 {
13581 void *fi = _ITEM_TEXT(itr)->text_props.font_instance; 13626 void *fi = _ITEM_TEXT(itr)->text_props.font_instance;
13582 13627
13583 if (EINA_UNLIKELY(ti->gfx_filter_id)) 13628 if (EINA_UNLIKELY(ti->gfx_filter_ctx != NULL))
13584 context = ti->parent.format->gfx_filter->dc; 13629 context = ti->parent.format->gfx_filter->dc;
13585 13630
13586 COLOR_SET(normal); 13631 COLOR_SET(normal);
@@ -13590,13 +13635,30 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
13590 13635
13591 context = context_save; 13636 context = context_save;
13592 13637
13593 if (EINA_UNLIKELY(ti->gfx_filter_id)) 13638 if (EINA_UNLIKELY(ti->parent.format->gfx_filter != NULL))
13594 { 13639 {
13640 Evas_Filter_Context *ctx = _filter_context_get(ti);
13595 Efl_Canvas_Text_Filter *filter = ti->parent.format->gfx_filter; 13641 Efl_Canvas_Text_Filter *filter = ti->parent.format->gfx_filter;
13596 Evas_Filter_Context *ctx = eina_array_data_get(filter->contexts, ti->gfx_filter_id - 1); 13642 void *buffer = ti->gfx_buffer;
13643
13644 if (buffer)
13645 {
13646 int X, Y, W = 0, H = 0;
13647
13648 X = obj->cur->geometry.x + ln->x + ti->parent.x + x - filter->pad.l;
13649 Y = obj->cur->geometry.y + ln->par->y + ln->y + y - filter->pad.t;
13597 13650
13598 evas_filter_context_post_run_callback_set(ctx, _filter_cb, filter); 13651 ENFN->context_color_set(ENDT, context, 255, 255, 255, 255);
13599 evas_filter_run(ctx); 13652 ENFN->context_multiplier_unset(ENDT, context);
13653 ENFN->image_size_get(ENDT, buffer, &W, &H);
13654 ENFN->image_draw(ENDT, context, surface, buffer,
13655 0, 0, W, H, X, Y, W, H, 0, do_async);
13656 }
13657 else if (ctx)
13658 {
13659 evas_filter_context_post_run_callback_set(ctx, _filter_cb, filter);
13660 evas_filter_run(ctx);
13661 }
13600 } 13662 }
13601 } 13663 }
13602 13664
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c
index 2b6fbae23c..6ce9cb980d 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -49,7 +49,7 @@ _evas_image_get(Ector_Buffer *buf)
49/* Main functions */ 49/* Main functions */
50 50
51Evas_Filter_Context * 51Evas_Filter_Context *
52evas_filter_context_new(Evas_Public_Data *evas, Eina_Bool async, int id) 52evas_filter_context_new(Evas_Public_Data *evas, Eina_Bool async, void *user_data)
53{ 53{
54 Evas_Filter_Context *ctx; 54 Evas_Filter_Context *ctx;
55 55
@@ -60,17 +60,23 @@ evas_filter_context_new(Evas_Public_Data *evas, Eina_Bool async, int id)
60 60
61 ctx->evas = evas; 61 ctx->evas = evas;
62 ctx->async = async; 62 ctx->async = async;
63 ctx->context_id = id; 63 ctx->user_data = user_data;
64 64
65 return ctx; 65 return ctx;
66} 66}
67 67
68int 68void *
69evas_filter_context_id_get(Evas_Filter_Context *ctx) 69evas_filter_context_data_get(Evas_Filter_Context *ctx)
70{ 70{
71 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, -1); 71 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL);
72 72
73 return ctx->context_id; 73 return ctx->user_data;
74}
75
76Eina_Bool
77evas_filter_context_async_get(Evas_Filter_Context *ctx)
78{
79 return ctx->async;
74} 80}
75 81
76/* Private function to reset the filter context. Used from parser.c */ 82/* Private function to reset the filter context. Used from parser.c */
@@ -1352,6 +1358,8 @@ evas_filter_font_draw(Evas_Filter_Context *ctx, void *draw_context, int bufid,
1352 void *surface = NULL; 1358 void *surface = NULL;
1353 1359
1354 fb = _filter_buffer_get(ctx, bufid); 1360 fb = _filter_buffer_get(ctx, bufid);
1361 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, EINA_FALSE);
1362
1355 surface = _evas_image_get(fb->buffer); 1363 surface = _evas_image_get(fb->buffer);
1356 if (!surface) return EINA_FALSE; 1364 if (!surface) return EINA_FALSE;
1357 1365
@@ -1364,7 +1372,6 @@ evas_filter_font_draw(Evas_Filter_Context *ctx, void *draw_context, int bufid,
1364 evas_common_font_glyphs_ref(text_props->glyphs); 1372 evas_common_font_glyphs_ref(text_props->glyphs);
1365 evas_unref_queue_glyph_put(ctx->evas, text_props->glyphs); 1373 evas_unref_queue_glyph_put(ctx->evas, text_props->glyphs);
1366 } 1374 }
1367 //evas_common_save_image_to_file(surface, "/tmp/input.png", 0, 100, 0 ,0);
1368 1375
1369 return EINA_TRUE; 1376 return EINA_TRUE;
1370} 1377}
diff --git a/src/lib/evas/filters/evas_filter_private.h b/src/lib/evas/filters/evas_filter_private.h
index 4c54c9615a..0eb2052b0c 100644
--- a/src/lib/evas/filters/evas_filter_private.h
+++ b/src/lib/evas/filters/evas_filter_private.h
@@ -116,7 +116,7 @@ struct _Evas_Filter_Context
116 Eina_List *buffers; // Evas_Filter_Buffer * 116 Eina_List *buffers; // Evas_Filter_Buffer *
117 int last_buffer_id; 117 int last_buffer_id;
118 int last_command_id; 118 int last_command_id;
119 int context_id; // used by textblock 119 void *user_data; // used by textblock
120 120
121 // Variables changing at each run 121 // Variables changing at each run
122 int w, h; // Dimensions of the input/output buffers 122 int w, h; // Dimensions of the input/output buffers
diff --git a/src/lib/evas/include/evas_filter.h b/src/lib/evas/include/evas_filter.h
index 0ee3f30e9d..c8962c434d 100644
--- a/src/lib/evas/include/evas_filter.h
+++ b/src/lib/evas/include/evas_filter.h
@@ -137,8 +137,9 @@ EAPI void evas_filter_program_source_set_all(Evas_Filter_Program
137void evas_filter_program_data_set_all(Evas_Filter_Program *pgm, Eina_Inlist *data); 137void evas_filter_program_data_set_all(Evas_Filter_Program *pgm, Eina_Inlist *data);
138 138
139/* Filter context (low level) */ 139/* Filter context (low level) */
140Evas_Filter_Context *evas_filter_context_new(Evas_Public_Data *evas, Eina_Bool async, int id); 140Evas_Filter_Context *evas_filter_context_new(Evas_Public_Data *evas, Eina_Bool async, void *user_data);
141int evas_filter_context_id_get(Evas_Filter_Context *ctx); 141void *evas_filter_context_data_get(Evas_Filter_Context *ctx);
142Eina_Bool evas_filter_context_async_get(Evas_Filter_Context *ctx);
142void evas_filter_context_destroy(Evas_Filter_Context *ctx); 143void evas_filter_context_destroy(Evas_Filter_Context *ctx);
143Eina_Bool evas_filter_context_program_use(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm); 144Eina_Bool evas_filter_context_program_use(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm);
144void evas_filter_context_proxy_render_all(Evas_Filter_Context *ctx, Eo *eo_obj, Eina_Bool do_async); 145void evas_filter_context_proxy_render_all(Evas_Filter_Context *ctx, Eo *eo_obj, Eina_Bool do_async);