summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-01-23 16:54:50 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-02-07 17:33:17 +0900
commit2e401c2e912c78d57a9b1805d9adf1bfac69d7e0 (patch)
tree97e048afc2ce7bfa2f0cd3a7b793bc9f68393d37 /src
parenteea049f988c3093c4859ff3a877e27b9e4aa0441 (diff)
Evas filters: Allocate buffer in the main loop (part 2)
Now the allocation is really done in the main loop. Rendering fails, only happens in case of redraw.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_text.c8
-rw-r--r--src/lib/evas/filters/evas_filter.c181
-rw-r--r--src/lib/evas/filters/evas_filter_blend.c1
-rw-r--r--src/lib/evas/filters/evas_filter_parser.c16
-rw-r--r--src/lib/evas/filters/evas_filter_private.h12
-rw-r--r--src/lib/evas/filters/evas_filter_utils.c6
-rw-r--r--src/lib/evas/include/evas_filter.h9
7 files changed, 164 insertions, 69 deletions
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index 087024032d..e6a9edb13c 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -2184,7 +2184,7 @@ evas_object_text_render(Evas_Object *eo_obj EINA_UNUSED,
2184 } 2184 }
2185 } 2185 }
2186 2186
2187 filter = evas_filter_context_new(obj->layer->evas); 2187 filter = evas_filter_context_new(obj->layer->evas, do_async);
2188 ok = evas_filter_context_program_use(filter, eo_obj, o->cur.filter.chain); 2188 ok = evas_filter_context_program_use(filter, eo_obj, o->cur.filter.chain);
2189 if (!filter || !ok) 2189 if (!filter || !ok)
2190 { 2190 {
@@ -2200,10 +2200,8 @@ evas_object_text_render(Evas_Object *eo_obj EINA_UNUSED,
2200 filter_ctx = ENFN->context_new(ENDT); 2200 filter_ctx = ENFN->context_new(ENDT);
2201 ENFN->context_color_set(ENDT, filter_ctx, 255, 255, 255, 255); 2201 ENFN->context_color_set(ENDT, filter_ctx, 255, 255, 255, 255);
2202 2202
2203 // Allocate main buffers now 2203 // Allocate all buffers now
2204 evas_filter_context_buffers_allocate_all(filter, W, H); 2204 evas_filter_context_buffers_allocate_all(filter, W, H);
2205 //evas_filter_buffer_data_set(filter, inbuf, NULL, W, H, EINA_TRUE);
2206 //evas_filter_buffer_data_set(filter, outbuf, NULL, W, H, EINA_FALSE);
2207 evas_filter_target_set(filter, context, surface, X + x, Y + y); 2205 evas_filter_target_set(filter, context, surface, X + x, Y + y);
2208 2206
2209 // Steal output and release previous 2207 // Steal output and release previous
@@ -2226,7 +2224,7 @@ evas_object_text_render(Evas_Object *eo_obj EINA_UNUSED,
2226 2224
2227 // Add post-run callback and run filter 2225 // Add post-run callback and run filter
2228 evas_filter_context_autodestroy(filter); 2226 evas_filter_context_autodestroy(filter);
2229 evas_filter_run(filter, do_async); 2227 evas_filter_run(filter);
2230 o->cur.filter.changed = EINA_FALSE; 2228 o->cur.filter.changed = EINA_FALSE;
2231 2229
2232 INF("Effect rendering done. Return."); 2230 INF("Effect rendering done. Return.");
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c
index 7374da0486..2f7fe8bdfe 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -43,7 +43,7 @@ struct _Evas_Filter_Thread_Command
43/* Main functions */ 43/* Main functions */
44 44
45Evas_Filter_Context * 45Evas_Filter_Context *
46evas_filter_context_new(Evas_Public_Data *evas) 46evas_filter_context_new(Evas_Public_Data *evas, Eina_Bool async)
47{ 47{
48 Evas_Filter_Context *ctx; 48 Evas_Filter_Context *ctx;
49 49
@@ -53,6 +53,7 @@ evas_filter_context_new(Evas_Public_Data *evas)
53 if (!ctx) return NULL; 53 if (!ctx) return NULL;
54 54
55 ctx->evas = evas; 55 ctx->evas = evas;
56 ctx->async = async;
56 ctx->gl_engine = !!strstr(evas->engine.module->definition->name, "gl"); 57 ctx->gl_engine = !!strstr(evas->engine.module->definition->name, "gl");
57 58
58 return ctx; 59 return ctx;
@@ -86,7 +87,10 @@ _backing_free(Evas_Filter_Context *ctx, Image_Entry *ie)
86 if (!ie) return; 87 if (!ie) return;
87 88
88 if (!ctx->gl_engine) 89 if (!ctx->gl_engine)
89 ENFN->image_free(ENDT, ie); 90 {
91 if (!ctx->async)
92 ENFN->image_free(ENDT, ie);
93 }
90 else 94 else
91 { 95 {
92 if (!evas_cserve2_use_get()) 96 if (!evas_cserve2_use_get())
@@ -119,7 +123,8 @@ _filter_buffer_backing_free(Evas_Filter_Buffer *fb)
119/** @hidden private bind proxy to context */ 123/** @hidden private bind proxy to context */
120void 124void
121evas_filter_context_proxy_bind(Evas_Filter_Context *ctx, Evas_Object *eo_proxy, 125evas_filter_context_proxy_bind(Evas_Filter_Context *ctx, Evas_Object *eo_proxy,
122 Evas_Object *eo_source, int bufid) 126 Evas_Object *eo_source, int bufid,
127 Eina_Stringshare *name)
123{ 128{
124 Evas_Object_Protected_Data *proxy = eo_data_scope_get(eo_proxy, EVAS_OBJ_CLASS); 129 Evas_Object_Protected_Data *proxy = eo_data_scope_get(eo_proxy, EVAS_OBJ_CLASS);
125 Evas_Object_Protected_Data *source = eo_data_scope_get(eo_source, EVAS_OBJ_CLASS); 130 Evas_Object_Protected_Data *source = eo_data_scope_get(eo_source, EVAS_OBJ_CLASS);
@@ -129,9 +134,11 @@ evas_filter_context_proxy_bind(Evas_Filter_Context *ctx, Evas_Object *eo_proxy,
129 EINA_SAFETY_ON_NULL_RETURN(fb); 134 EINA_SAFETY_ON_NULL_RETURN(fb);
130 135
131 if (fb->source == eo_source) return; 136 if (fb->source == eo_source) return;
132 if (fb->source) evas_object_unref(fb->source); 137 evas_object_unref(fb->source);
138 eina_stringshare_del(fb->source_name);
133 fb->source = eo_source; 139 fb->source = eo_source;
134 if (!fb->source) return; 140 if (!fb->source) return;
141 fb->source_name = eina_stringshare_ref(name);
135 142
136 evas_object_ref(eo_source); 143 evas_object_ref(eo_source);
137 144
@@ -271,6 +278,7 @@ evas_filter_context_proxy_render_all(Evas_Filter_Context *ctx, Eo *eo_obj,
271 fb->allocated = EINA_FALSE; 278 fb->allocated = EINA_FALSE;
272 fb->alpha_only = EINA_FALSE; 279 fb->alpha_only = EINA_FALSE;
273 } 280 }
281 DBG("Source has dimensions %dx%d (buffer %d)", fb->w, fb->h, fb->id);
274 } 282 }
275} 283}
276 284
@@ -436,46 +444,130 @@ evas_filter_buffer_alloc(Evas_Filter_Buffer *fb, int w, int h)
436*/ 444*/
437 445
438Eina_Bool 446Eina_Bool
439evas_filter_context_buffers_allocate_all(Evas_Filter_Context *ctx, unsigned w, unsigned h) 447evas_filter_context_buffers_allocate_all(Evas_Filter_Context *ctx,
448 unsigned w, unsigned h)
440{ 449{
450 Evas_Filter_Command *cmd;
441 Evas_Filter_Buffer *fb; 451 Evas_Filter_Buffer *fb;
442 Image_Entry *ie; 452 Image_Entry *ie;
443 Eina_List *li; 453 Eina_List *li;
444 454
445 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_FALSE); 455 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_FALSE);
446 EINA_LIST_FOREACH(ctx->buffers, li, fb) 456 ctx->w = w;
457 ctx->h = h;
458
459 //DBG("Allocating all buffers based on output size %ux%u", w, h);
460
461 EINA_INLIST_FOREACH(ctx->commands, cmd)
447 { 462 {
448 if (fb->source) continue; 463 Evas_Filter_Fill_Mode fillmode = cmd->draw.fillmode;
464 Evas_Filter_Buffer *in, *fb, *out;
465
466 in = cmd->input;
467 if (!in->w && !in->h)
468 {
469 in->w = w;
470 in->h = h;
471 }
472
473 if (fillmode & EVAS_FILTER_FILL_MODE_STRETCH_XY)
474 {
475 unsigned sw = w, sh = h;
476
477 switch (cmd->mode)
478 {
479 case EVAS_FILTER_MODE_BLEND:
480 in = cmd->input;
481 break;
482 case EVAS_FILTER_MODE_BUMP:
483 case EVAS_FILTER_MODE_DISPLACE:
484 case EVAS_FILTER_MODE_MASK:
485 in = cmd->mask;
486 break;
487 default:
488 CRI("Invalid fillmode set for command %d", cmd->mode);
489 return EINA_FALSE;
490 }
449 491
492 if (in->w) sw = in->w;
493 if (in->h) sh = in->h;
494
495 if ((sw != w) || (sh != h))
496 {
497 if (fillmode & EVAS_FILTER_FILL_MODE_STRETCH_X)
498 sw = w;
499 if (fillmode & EVAS_FILTER_FILL_MODE_STRETCH_Y)
500 sh = h;
501
502 //DBG("Allocating temporary buffer of size %ux%u", sw, sh);
503 fb = evas_filter_buffer_alloc_new(ctx, sw, sh, in->alpha_only);
504 fb->transient = EINA_TRUE;
505 }
506 }
507
508 if (cmd->draw.need_temp_buffer)
509 {
510 Evas_Filter_Buffer *in;
511 unsigned sw = w, sh = h;
512
513 in = cmd->input;
514 if (in->w) sw = in->w;
515 if (in->h) sh = in->h;
516
517 //DBG("Allocating temporary buffer of size %ux%u", sw, sh);
518 fb = evas_filter_buffer_alloc_new(ctx, sw, sh, in->alpha_only);
519 fb->transient = EINA_TRUE;
520 }
521
522 out = cmd->output;
523 if (!out->w && !out->h)
524 {
525 out->w = w;
526 out->h = h;
527 }
528 }
529
530 EINA_LIST_FOREACH(ctx->buffers, li, fb)
531 {
450 ie = fb->backing; 532 ie = fb->backing;
451 if (ie) 533 if (ie)
452 { 534 {
453 if ((ie->w != w) || (ie->h != h)) 535 if (ctx->async)
454 { 536 {
455 CRI("Inconsistent buffer size!"); 537 ie->references++;
456 continue; 538 evas_unref_queue_image_put(ctx->evas, ie);
457 } 539 }
458 ie->references++;
459 continue; 540 continue;
460 } 541 }
461 542
543 if (fb->source)
544 continue;
545
546 if (fb->glimage)
547 continue;
548
462 if (!fb->w && !fb->h) 549 if (!fb->w && !fb->h)
463 { 550 {
464 fb->w = w; 551 ERR("Size should be known at this point. Is this a dangling buffer?");
465 fb->h = h; 552 continue;
466 } 553 }
554
555 //DBG("Allocating buffer of size %ux%u", fb->w, fb->h);
467 ie = (Image_Entry *) _rgba_image_alloc(fb, NULL); 556 ie = (Image_Entry *) _rgba_image_alloc(fb, NULL);
468 if (!ie) 557 if (!ie)
469 { 558 {
470 ERR("Buffer %d allocation failed!", fb->id); 559 ERR("Buffer %d allocation failed!", fb->id);
471 continue; 560 return EINA_FALSE;
472 } 561 }
473 562
474 fb->backing = ie; 563 fb->backing = ie;
564 if (ctx->async)
565 {
566 ie->references++;
567 evas_unref_queue_image_put(ctx->evas, ie);
568 }
475 } 569 }
476 570
477 // To unref: evas_unref_queue_image_put
478
479 return EINA_TRUE; 571 return EINA_TRUE;
480} 572}
481 573
@@ -495,8 +587,8 @@ evas_filter_buffer_empty_new(Evas_Filter_Context *ctx, Eina_Bool alpha_only)
495} 587}
496 588
497Eina_Bool 589Eina_Bool
498evas_filter_buffer_data_set(Evas_Filter_Context *ctx, int bufid, void *data, 590_filter_buffer_data_set(Evas_Filter_Context *ctx, int bufid, void *data,
499 int w, int h, Eina_Bool alpha_only) 591 int w, int h, Eina_Bool alpha_only)
500{ 592{
501 Evas_Filter_Buffer *fb; 593 Evas_Filter_Buffer *fb;
502 594
@@ -542,33 +634,31 @@ evas_filter_buffer_image_new(Evas_Filter_Context *ctx, RGBA_Image *image)
542 return fb->id; 634 return fb->id;
543} 635}
544 636
545/* 637Evas_Filter_Buffer *
546int 638_filter_buffer_data_new(Evas_Filter_Context *ctx, void *data, int w, int h,
547evas_filter_buffer_data_new(Evas_Filter_Context *ctx, void *data, int w, int h, 639 Eina_Bool alpha_only)
548 Eina_Bool alpha_only)
549{ 640{
550 Evas_Filter_Buffer *fb; 641 Evas_Filter_Buffer *fb;
551 642
552 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, -1); 643 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL);
553 EINA_SAFETY_ON_FALSE_RETURN_VAL(w > 0 && h > 0, -1); 644 EINA_SAFETY_ON_FALSE_RETURN_VAL(w > 0 && h > 0, NULL);
554 645
555 fb = calloc(1, sizeof(Evas_Filter_Buffer)); 646 fb = calloc(1, sizeof(Evas_Filter_Buffer));
556 if (!fb) return -1; 647 if (!fb) return NULL;
557 648
558 fb->id = ++(ctx->last_buffer_id); 649 fb->id = ++(ctx->last_buffer_id);
559 fb->ctx = ctx; 650 fb->ctx = ctx;
560 ctx->buffers = eina_list_append(ctx->buffers, fb); 651 ctx->buffers = eina_list_append(ctx->buffers, fb);
561 652
562 if (!evas_filter_buffer_data_set(ctx, fb->id, data, w, h, alpha_only)) 653 if (!_filter_buffer_data_set(ctx, fb->id, data, w, h, alpha_only))
563 { 654 {
564 ctx->buffers = eina_list_remove(ctx->buffers, fb); 655 ctx->buffers = eina_list_remove(ctx->buffers, fb);
565 free(fb); 656 free(fb);
566 return -1; 657 return NULL;
567 } 658 }
568 659
569 return fb->id; 660 return fb;
570} 661}
571*/
572 662
573static void 663static void
574_buffer_free(Evas_Filter_Buffer *fb) 664_buffer_free(Evas_Filter_Buffer *fb)
@@ -682,8 +772,8 @@ _command_del(Evas_Filter_Context *ctx, Evas_Filter_Command *cmd)
682 free(cmd); 772 free(cmd);
683} 773}
684 774
685static Evas_Filter_Command * 775Evas_Filter_Command *
686_command_get(Evas_Filter_Context *ctx, int cmdid) 776_evas_filter_command_get(Evas_Filter_Context *ctx, int cmdid)
687{ 777{
688 Evas_Filter_Command *cmd; 778 Evas_Filter_Command *cmd;
689 779
@@ -982,6 +1072,10 @@ evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *drawctx,
982 &cmd->draw.clip.x, &cmd->draw.clip.y, 1072 &cmd->draw.clip.x, &cmd->draw.clip.y,
983 &cmd->draw.clip.w, &cmd->draw.clip.h); 1073 &cmd->draw.clip.w, &cmd->draw.clip.h);
984 1074
1075 if (cmd->draw.clip_use)
1076 DBG("Draw clip: %d,%d,%d,%d", cmd->draw.clip.x, cmd->draw.clip.y,
1077 cmd->draw.clip.w, cmd->draw.clip.h);
1078
985 return cmd->id; 1079 return cmd->id;
986} 1080}
987 1081
@@ -1027,7 +1121,7 @@ evas_filter_command_grow_add(Evas_Filter_Context *ctx, void *draw_context,
1027 curve, EVAS_FILTER_CHANNEL_ALPHA); 1121 curve, EVAS_FILTER_CHANNEL_ALPHA);
1028 if (threshcmd < 0) 1122 if (threshcmd < 0)
1029 { 1123 {
1030 _command_del(ctx, _command_get(ctx, blurcmd)); 1124 _command_del(ctx, _evas_filter_command_get(ctx, blurcmd));
1031 return -1; 1125 return -1;
1032 } 1126 }
1033 1127
@@ -1129,7 +1223,7 @@ evas_filter_command_displacement_map_add(Evas_Filter_Context *ctx,
1129 out->id, 0, 0, 1223 out->id, 0, 0,
1130 EVAS_FILTER_FILL_MODE_NONE) < 0) 1224 EVAS_FILTER_FILL_MODE_NONE) < 0)
1131 { 1225 {
1132 _command_del(ctx, _command_get(ctx, cmdid)); 1226 _command_del(ctx, _evas_filter_command_get(ctx, cmdid));
1133 cmdid = -1; 1227 cmdid = -1;
1134 } 1228 }
1135 } 1229 }
@@ -1336,12 +1430,9 @@ evas_filter_target_set(Evas_Filter_Context *ctx, void *draw_context,
1336{ 1430{
1337 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_FALSE); 1431 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_FALSE);
1338 1432
1339 ctx->target.bufid = evas_filter_buffer_image_new(ctx, surface);
1340 if (!ctx->gl_engine) 1433 if (!ctx->gl_engine)
1341 { 1434 {
1342 /* FIXME: This extraneous blend could be avoided if all filters 1435 ctx->target.bufid = evas_filter_buffer_image_new(ctx, surface);
1343 * drawing to output (buffer #2) support proper colors and offsets.
1344 */
1345 evas_filter_command_blend_add(ctx, draw_context, 2, ctx->target.bufid, 1436 evas_filter_command_blend_add(ctx, draw_context, 2, ctx->target.bufid,
1346 x, y, EVAS_FILTER_FILL_MODE_NONE); 1437 x, y, EVAS_FILTER_FILL_MODE_NONE);
1347 } 1438 }
@@ -1351,6 +1442,7 @@ evas_filter_target_set(Evas_Filter_Context *ctx, void *draw_context,
1351 Evas_Filter_Buffer *target, *image; 1442 Evas_Filter_Buffer *target, *image;
1352 RGBA_Image *im; 1443 RGBA_Image *im;
1353 1444
1445 ctx->target.bufid = evas_filter_buffer_image_new(ctx, surface);
1354 ctx->target.context = draw_context; 1446 ctx->target.context = draw_context;
1355 ctx->target.x = x; 1447 ctx->target.x = x;
1356 ctx->target.y = y; 1448 ctx->target.y = y;
@@ -1513,7 +1605,6 @@ static Eina_Bool
1513_filter_command_run(Evas_Filter_Command *cmd) 1605_filter_command_run(Evas_Filter_Command *cmd)
1514{ 1606{
1515 Evas_Filter_Apply_Func func = NULL; 1607 Evas_Filter_Apply_Func func = NULL;
1516 Eina_Bool ok;
1517 1608
1518 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd->output, EINA_FALSE); 1609 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd->output, EINA_FALSE);
1519 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd->input, EINA_FALSE); 1610 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd->input, EINA_FALSE);
@@ -1577,8 +1668,7 @@ _filter_command_run(Evas_Filter_Command *cmd)
1577 return EINA_FALSE; 1668 return EINA_FALSE;
1578 } 1669 }
1579 1670
1580 func(cmd); 1671 return func(cmd);
1581 return ok;
1582} 1672}
1583 1673
1584static Eina_Bool 1674static Eina_Bool
@@ -1586,13 +1676,6 @@ _filter_chain_run(Evas_Filter_Context *ctx)
1586{ 1676{
1587 Evas_Filter_Command *cmd; 1677 Evas_Filter_Command *cmd;
1588 Eina_Bool ok = EINA_TRUE; 1678 Eina_Bool ok = EINA_TRUE;
1589 Evas_Filter_Buffer *in;
1590
1591 in = _filter_buffer_get(ctx, 1);
1592 EINA_SAFETY_ON_NULL_RETURN_VAL(in, EINA_FALSE);
1593
1594 ctx->w = in->w;
1595 ctx->h = in->h;
1596 1679
1597 EINA_INLIST_FOREACH(ctx->commands, cmd) 1680 EINA_INLIST_FOREACH(ctx->commands, cmd)
1598 { 1681 {
@@ -1619,7 +1702,7 @@ _filter_thread_run_cb(void *data)
1619} 1702}
1620 1703
1621Eina_Bool 1704Eina_Bool
1622evas_filter_run(Evas_Filter_Context *ctx, Eina_Bool do_async) 1705evas_filter_run(Evas_Filter_Context *ctx)
1623{ 1706{
1624 Eina_Bool ret; 1707 Eina_Bool ret;
1625 1708
@@ -1631,7 +1714,7 @@ evas_filter_run(Evas_Filter_Context *ctx, Eina_Bool do_async)
1631 if (ctx->gl_engine) 1714 if (ctx->gl_engine)
1632 WRN("EXPERIMENTAL OpenGL support! Might very well crash or not render anything."); 1715 WRN("EXPERIMENTAL OpenGL support! Might very well crash or not render anything.");
1633 1716
1634 if (do_async) 1717 if (ctx->async)
1635 { 1718 {
1636 evas_thread_cmd_enqueue(_filter_thread_run_cb, ctx); 1719 evas_thread_cmd_enqueue(_filter_thread_run_cb, ctx);
1637 return EINA_TRUE; 1720 return EINA_TRUE;
diff --git a/src/lib/evas/filters/evas_filter_blend.c b/src/lib/evas/filters/evas_filter_blend.c
index ac35e03c1a..09b0d1f421 100644
--- a/src/lib/evas/filters/evas_filter_blend.c
+++ b/src/lib/evas/filters/evas_filter_blend.c
@@ -442,7 +442,6 @@ _filter_blend_cpu_rgba2alpha(Evas_Filter_Command *cmd)
442 return EINA_TRUE; 442 return EINA_TRUE;
443 443
444 // Stretch if necessary. 444 // Stretch if necessary.
445#warning FIXME Must be in the main loop because of buffer allocation
446 if ((sw != dw || sh != dh) && (cmd->draw.fillmode & EVAS_FILTER_FILL_MODE_STRETCH_XY)) 445 if ((sw != dw || sh != dh) && (cmd->draw.fillmode & EVAS_FILTER_FILL_MODE_STRETCH_XY))
447 { 446 {
448 Evas_Filter_Buffer *fb; 447 Evas_Filter_Buffer *fb;
diff --git a/src/lib/evas/filters/evas_filter_parser.c b/src/lib/evas/filters/evas_filter_parser.c
index 90175c0690..6033f43cad 100644
--- a/src/lib/evas/filters/evas_filter_parser.c
+++ b/src/lib/evas/filters/evas_filter_parser.c
@@ -45,8 +45,8 @@ static struct
45 { "repeat_y", EVAS_FILTER_FILL_MODE_REPEAT_Y }, 45 { "repeat_y", EVAS_FILTER_FILL_MODE_REPEAT_Y },
46 { "repeat_x_stretch_y", EVAS_FILTER_FILL_MODE_REPEAT_X_STRETCH_Y }, 46 { "repeat_x_stretch_y", EVAS_FILTER_FILL_MODE_REPEAT_X_STRETCH_Y },
47 { "repeat_y_stretch_x", EVAS_FILTER_FILL_MODE_REPEAT_Y_STRETCH_X }, 47 { "repeat_y_stretch_x", EVAS_FILTER_FILL_MODE_REPEAT_Y_STRETCH_X },
48 { "stretch_y_repeat_x", EVAS_FILTER_FILL_MODE_REPEAT_X_STRETCH_Y }, 48 { "stretch_y_repeat_x", EVAS_FILTER_FILL_MODE_REPEAT_X_STRETCH_Y }, // alias
49 { "stretch_x_repeat_y", EVAS_FILTER_FILL_MODE_REPEAT_Y_STRETCH_X }, 49 { "stretch_x_repeat_y", EVAS_FILTER_FILL_MODE_REPEAT_Y_STRETCH_X }, // alias
50 { "repeat", EVAS_FILTER_FILL_MODE_REPEAT_XY }, // alias 50 { "repeat", EVAS_FILTER_FILL_MODE_REPEAT_XY }, // alias
51 { "repeat_xy", EVAS_FILTER_FILL_MODE_REPEAT_XY }, 51 { "repeat_xy", EVAS_FILTER_FILL_MODE_REPEAT_XY },
52 { "stretch", EVAS_FILTER_FILL_MODE_STRETCH_XY }, // alias 52 { "stretch", EVAS_FILTER_FILL_MODE_STRETCH_XY }, // alias
@@ -1460,6 +1460,7 @@ _instr2cmd_blend(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm,
1460 cmdid = evas_filter_command_blend_add(ctx, dc, in->cid, out->cid, ox, oy, 1460 cmdid = evas_filter_command_blend_add(ctx, dc, in->cid, out->cid, ox, oy,
1461 fillmode); 1461 fillmode);
1462 if (isset) RESETCOLOR(); 1462 if (isset) RESETCOLOR();
1463 if (cmdid < 0) return cmdid;
1463 1464
1464 return cmdid; 1465 return cmdid;
1465} 1466}
@@ -1654,6 +1655,15 @@ _instr2cmd_mask(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm,
1654 SETCOLOR(color); 1655 SETCOLOR(color);
1655 cmdid = evas_filter_command_mask_add(ctx, dc, in->cid, mask->cid, out->cid, fillmode); 1656 cmdid = evas_filter_command_mask_add(ctx, dc, in->cid, mask->cid, out->cid, fillmode);
1656 RESETCOLOR(); 1657 RESETCOLOR();
1658 if (cmdid < 0) return cmdid;
1659
1660 if (!in->alpha && !mask->alpha && !out->alpha)
1661 {
1662 Evas_Filter_Command *cmd;
1663
1664 cmd = _evas_filter_command_get(ctx, cmdid);
1665 cmd->draw.need_temp_buffer = EINA_TRUE;
1666 }
1657 1667
1658 return cmdid; 1668 return cmdid;
1659} 1669}
@@ -1834,7 +1844,7 @@ evas_filter_context_program_use(Evas_Filter_Context *ctx, Evas_Object *eo_obj,
1834 if (buf->proxy) 1844 if (buf->proxy)
1835 { 1845 {
1836 Eo *eo_source = evas_filter_program_proxy_source_get(pgm, buf->proxy); 1846 Eo *eo_source = evas_filter_program_proxy_source_get(pgm, buf->proxy);
1837 evas_filter_context_proxy_bind(ctx, eo_obj, eo_source, buf->cid); 1847 evas_filter_context_proxy_bind(ctx, eo_obj, eo_source, buf->cid, buf->proxy);
1838 } 1848 }
1839 } 1849 }
1840 1850
diff --git a/src/lib/evas/filters/evas_filter_private.h b/src/lib/evas/filters/evas_filter_private.h
index 939f556513..a91cbcb7d1 100644
--- a/src/lib/evas/filters/evas_filter_private.h
+++ b/src/lib/evas/filters/evas_filter_private.h
@@ -59,12 +59,12 @@ struct _Evas_Filter_Context
59 59
60 struct 60 struct
61 { 61 {
62 // Only used with the GL engine.
63 int bufid; 62 int bufid;
64 void *context; 63 void *context;
65 int x, y; 64 int x, y;
66 } target; 65 } target;
67 66
67 Eina_Bool async : 1;
68 Eina_Bool gl_engine : 1; 68 Eina_Bool gl_engine : 1;
69}; 69};
70 70
@@ -135,6 +135,7 @@ struct _Evas_Filter_Command
135 Evas_Filter_Fill_Mode fillmode; 135 Evas_Filter_Fill_Mode fillmode;
136 Eina_Bool clip_use : 1; 136 Eina_Bool clip_use : 1;
137 Eina_Bool clip_mode_lrtb : 1; 137 Eina_Bool clip_mode_lrtb : 1;
138 Eina_Bool need_temp_buffer : 1;
138 } draw; 139 } draw;
139}; 140};
140 141
@@ -146,6 +147,7 @@ struct _Evas_Filter_Buffer
146 Evas_Filter_Context *ctx; 147 Evas_Filter_Context *ctx;
147 148
148 Evas_Object *source; 149 Evas_Object *source;
150 Eina_Stringshare *source_name;
149 void *backing; 151 void *backing;
150 void *glimage; 152 void *glimage;
151 int w, h; 153 int w, h;
@@ -166,7 +168,7 @@ enum _Evas_Filter_Interpolation_Mode
166}; 168};
167 169
168void evas_filter_context_clear(Evas_Filter_Context *ctx); 170void evas_filter_context_clear(Evas_Filter_Context *ctx);
169void evas_filter_context_proxy_bind(Evas_Filter_Context *ctx, Evas_Object *eo_proxy, Evas_Object *eo_source, int bufid); 171void evas_filter_context_proxy_bind(Evas_Filter_Context *ctx, Evas_Object *eo_proxy, Evas_Object *eo_source, int bufid, Eina_Stringshare *name);
170 172
171/* FIXME: CPU filters entry points. Move these to the Evas Engine itself. */ 173/* FIXME: CPU filters entry points. Move these to the Evas Engine itself. */
172Evas_Filter_Apply_Func evas_filter_blend_cpu_func_get(Evas_Filter_Command *cmd); 174Evas_Filter_Apply_Func evas_filter_blend_cpu_func_get(Evas_Filter_Command *cmd);
@@ -182,8 +184,12 @@ Evas_Filter_Apply_Func evas_filter_transform_cpu_func_get(Evas_Filter_Command
182void _clip_to_target(int *sx, int *sy, int sw, int sh, int ox, int oy, int dw, int dh, int *dx, int *dy, int *rows, int *cols); 184void _clip_to_target(int *sx, int *sy, int sw, int sh, int ox, int oy, int dw, int dh, int *dx, int *dy, int *rows, int *cols);
183Eina_Bool evas_filter_buffer_alloc(Evas_Filter_Buffer *fb, int w, int h); 185Eina_Bool evas_filter_buffer_alloc(Evas_Filter_Buffer *fb, int w, int h);
184Evas_Filter_Buffer *_filter_buffer_get(Evas_Filter_Context *ctx, int bufid); 186Evas_Filter_Buffer *_filter_buffer_get(Evas_Filter_Context *ctx, int bufid);
187Eina_Bool _filter_buffer_data_set(Evas_Filter_Context *ctx, int bufid, void *data, int w, int h, Eina_Bool alpha_only);
188Evas_Filter_Buffer *_filter_buffer_data_new(Evas_Filter_Context *ctx, void *data, int w, int h, Eina_Bool alpha_only);
189#define evas_filter_buffer_alloc_new(ctx, w, h, a) _filter_buffer_data_new(ctx, NULL, w, h, a)
185Evas_Filter_Buffer *evas_filter_temporary_buffer_get(Evas_Filter_Context *ctx, int w, int h, Eina_Bool alpha_only); 190Evas_Filter_Buffer *evas_filter_temporary_buffer_get(Evas_Filter_Context *ctx, int w, int h, Eina_Bool alpha_only);
186Evas_Filter_Buffer *evas_filter_buffer_scaled_get(Evas_Filter_Context *ctx, Evas_Filter_Buffer *src, int w, int h); 191Evas_Filter_Buffer *evas_filter_buffer_scaled_get(Evas_Filter_Context *ctx, Evas_Filter_Buffer *src, unsigned w, unsigned h);
187Eina_Bool evas_filter_interpolate(DATA8* output /* 256 values */, DATA8* points /* pairs x + y */, int point_count, Evas_Filter_Interpolation_Mode mode); 192Eina_Bool evas_filter_interpolate(DATA8* output /* 256 values */, DATA8* points /* pairs x + y */, int point_count, Evas_Filter_Interpolation_Mode mode);
193Evas_Filter_Command *_evas_filter_command_get(Evas_Filter_Context *ctx, int cmdid);
188 194
189#endif // EVAS_FILTER_PRIVATE_H 195#endif // EVAS_FILTER_PRIVATE_H
diff --git a/src/lib/evas/filters/evas_filter_utils.c b/src/lib/evas/filters/evas_filter_utils.c
index 5c8d7f805b..5e80481d35 100644
--- a/src/lib/evas/filters/evas_filter_utils.c
+++ b/src/lib/evas/filters/evas_filter_utils.c
@@ -7,7 +7,7 @@
7Evas_Filter_Buffer * 7Evas_Filter_Buffer *
8evas_filter_buffer_scaled_get(Evas_Filter_Context *ctx, 8evas_filter_buffer_scaled_get(Evas_Filter_Context *ctx,
9 Evas_Filter_Buffer *src, 9 Evas_Filter_Buffer *src,
10 int w, int h) 10 unsigned w, unsigned h)
11{ 11{
12 Evas_Filter_Buffer *fb; 12 Evas_Filter_Buffer *fb;
13 Image_Entry *dstdata = NULL; 13 Image_Entry *dstdata = NULL;
@@ -34,6 +34,10 @@ evas_filter_buffer_scaled_get(Evas_Filter_Context *ctx,
34 return NULL; 34 return NULL;
35 } 35 }
36 36
37 // FIXME: Not supported on GL engine. HAHAHAHAHA
38 if (ctx->gl_engine)
39 CRI("Support not implemened yet. lol yeah");
40
37 if (!src->alpha_only) 41 if (!src->alpha_only)
38 { 42 {
39 drawctx = ENFN->context_new(ENDT); 43 drawctx = ENFN->context_new(ENDT);
diff --git a/src/lib/evas/include/evas_filter.h b/src/lib/evas/include/evas_filter.h
index 7163d770fe..9de6532865 100644
--- a/src/lib/evas/include/evas_filter.h
+++ b/src/lib/evas/include/evas_filter.h
@@ -97,7 +97,7 @@ Evas_Object *evas_filter_program_proxy_source_get(Evas_Filter_Progra
97void evas_filter_context_proxy_render_all(Evas_Filter_Context *ctx, Eo *eo_obj, Eina_Bool do_async); 97void evas_filter_context_proxy_render_all(Evas_Filter_Context *ctx, Eo *eo_obj, Eina_Bool do_async);
98 98
99/* Filter context (low level) */ 99/* Filter context (low level) */
100Evas_Filter_Context *evas_filter_context_new(Evas_Public_Data *evas); 100Evas_Filter_Context *evas_filter_context_new(Evas_Public_Data *evas, Eina_Bool async);
101void evas_filter_context_destroy(Evas_Filter_Context *ctx); 101void evas_filter_context_destroy(Evas_Filter_Context *ctx);
102void evas_filter_context_post_run_callback_set(Evas_Filter_Context *ctx, Evas_Filter_Cb cb, void *data); 102void evas_filter_context_post_run_callback_set(Evas_Filter_Context *ctx, Evas_Filter_Cb cb, void *data);
103#define evas_filter_context_autodestroy(ctx) evas_filter_context_post_run_callback_set(ctx, ((Evas_Filter_Cb) evas_filter_context_destroy), ctx) 103#define evas_filter_context_autodestroy(ctx) evas_filter_context_post_run_callback_set(ctx, ((Evas_Filter_Cb) evas_filter_context_destroy), ctx)
@@ -105,16 +105,11 @@ Eina_Bool evas_filter_context_buffers_allocate_all(Evas_Filter_Co
105 105
106int evas_filter_buffer_empty_new(Evas_Filter_Context *ctx, Eina_Bool alpha_only); 106int evas_filter_buffer_empty_new(Evas_Filter_Context *ctx, Eina_Bool alpha_only);
107int evas_filter_buffer_image_new(Evas_Filter_Context *ctx, RGBA_Image *image); 107int evas_filter_buffer_image_new(Evas_Filter_Context *ctx, RGBA_Image *image);
108//int evas_filter_buffer_data_new(Evas_Filter_Context *ctx, void *data, int w, int h, Eina_Bool alpha_only);
109#define evas_filter_buffer_alloc_new(ctx, w, h, a) evas_filter_buffer_data_new(ctx, NULL, w, h, a)
110void *evas_filter_buffer_backing_get(Evas_Filter_Context *ctx, int bufid); 108void *evas_filter_buffer_backing_get(Evas_Filter_Context *ctx, int bufid);
111void *evas_filter_buffer_backing_steal(Evas_Filter_Context *ctx, int bufid); 109void *evas_filter_buffer_backing_steal(Evas_Filter_Context *ctx, int bufid);
112Eina_Bool evas_filter_buffer_backing_release(Evas_Filter_Context *ctx, void *stolen_buffer); 110Eina_Bool evas_filter_buffer_backing_release(Evas_Filter_Context *ctx, void *stolen_buffer);
113 111
114// Do not use 112Eina_Bool evas_filter_run(Evas_Filter_Context *ctx);
115EINA_DEPRECATED Eina_Bool evas_filter_buffer_data_set(Evas_Filter_Context *ctx, int bufid, void *data, int w, int h, Eina_Bool alpha_only);
116
117Eina_Bool evas_filter_run(Evas_Filter_Context *ctx, Eina_Bool do_async);
118 113
119Eina_Bool evas_filter_font_draw(Evas_Filter_Context *ctx, void *draw_context, int bufid, Evas_Font_Set *font, int x, int y, Evas_Text_Props *text_props, Eina_Bool do_async); 114Eina_Bool evas_filter_font_draw(Evas_Filter_Context *ctx, void *draw_context, int bufid, Evas_Font_Set *font, int x, int y, Evas_Text_Props *text_props, Eina_Bool do_async);
120Eina_Bool evas_filter_target_set(Evas_Filter_Context *ctx, void *draw_context, void *surface, int x, int y); 115Eina_Bool evas_filter_target_set(Evas_Filter_Context *ctx, void *draw_context, void *surface, int x, int y);