From 01c89cb4a45220b0f9afe844cbf2cc8eb98655b1 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 7 Oct 2014 14:34:36 +0900 Subject: [PATCH] evas - render2 renders conecnt for the first time... wow... this is an unused code path UNLESS you: export EVAS_RENDER2=1 so this will affect nothing unless you enable this and test it. it's designe dto be done this way so we can slowly bring it in and bring it up to speed and peolpe can easily test it and so on. so now - content is rendered. most content is actually. only thing that breaks that i can see so far is mapped smart objects. --- src/lib/evas/canvas/evas_render2.c | 109 +++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 20 deletions(-) diff --git a/src/lib/evas/canvas/evas_render2.c b/src/lib/evas/canvas/evas_render2.c index 59d1e63369..0c0b29a132 100644 --- a/src/lib/evas/canvas/evas_render2.c +++ b/src/lib/evas/canvas/evas_render2.c @@ -23,6 +23,15 @@ struct _Update void *surface; }; +typedef struct _Update_Info Update_Info; + +struct _Update_Info +{ + void *surface; + int ux, uy, uw, uh; + int cx, cy, cw, ch; +}; + // funcs ////////////////////////////////////////////////////////////////////////////// Eina_Bool _evas_render2_begin(Eo *eo_e, Eina_Bool make_updates, Eina_Bool do_draw, Eina_Bool do_async); @@ -217,40 +226,100 @@ _evas_render2_stage_main_render_prepare(Evas_Public_Data *e) printf("_evas_render2_stage_main_render_prepare %p\n", e); } +static void +_evas_render2_object_render(Evas_Public_Data *e, Evas_Object_Protected_Data *obj, Update_Info *uinf, int l) +{ + Evas_Object_Protected_Data *obj2; + Evas_Object *eo_obj = obj->object; + const Eina_Inlist *il; + + if ((!evas_object_is_visible(eo_obj, obj)) || + (obj->clip.clipees) || (obj->cur->have_clipees)) return; + il = evas_object_smart_members_get_direct(eo_obj); + if (il) + { + EINA_INLIST_FOREACH(il, obj2) + _evas_render2_object_render(e, obj2, uinf, l + 1); + } + else + { + void *ctx = e->engine.func->context_new(e->engine.data.output); + if (ctx) + { + int offx = uinf->cx - uinf->ux; + int offy = uinf->cy - uinf->uy; + int x, y, w, h; + + x = obj->cur->cache.clip.x; + y = obj->cur->cache.clip.y; + w = obj->cur->cache.clip.w; + h = obj->cur->cache.clip.h; + e->engine.func->context_clip_set(e->engine.data.output, + ctx, x + offx, y + offy, w, h); + obj->func->render(eo_obj, obj, obj->private_data, + e->engine.data.output, + ctx, uinf->surface, + offx, offy, + EINA_FALSE); + e->engine.func->context_free(e->engine.data.output, ctx); + } + } +} + static void _evas_render2_stage_render_do(Evas_Public_Data *e, Eina_Bool do_async EINA_UNUSED) { - void *surface; - int ux, uy, uw, uh; - int cx, cy, cw, ch; + Update_Info uinf; + Eina_Bool alpha; // XXX: actually render now (either in thread or in mainloop) // XXX: printf(" _evas_render2_stage_render_do %p\n", e); - while ((surface = + alpha = e->engine.func->canvas_alpha_get(e->engine.data.output, + e->engine.data.context); + while ((uinf.surface = e->engine.func->output_redraws_next_update_get (e->engine.data.output, - &ux, &uy, &uw, &uh, - &cx, &cy, &cw, &ch))) + &uinf.ux, &uinf.uy, &uinf.uw, &uinf.uh, + &uinf.cx, &uinf.cy, &uinf.cw, &uinf.ch))) { Update *ru = NULL; - void *ctx; + Evas_Layer *lay; + Evas_Object_Protected_Data *obj; + + // if the canvas has an alpha channel, we must fill the region with + // empty (0 value argb) + if (alpha) + { + void *ctx = e->engine.func->context_new(e->engine.data.output); + + if (ctx) + { + e->engine.func->context_render_op_set + (e->engine.data.output, ctx, EVAS_RENDER_COPY); + e->engine.func->context_color_set + (e->engine.data.output, ctx, 0, 0, 0, 0); + e->engine.func->rectangle_draw(e->engine.data.output, + ctx, uinf.surface, + uinf.cx, uinf.cy, + uinf.cw, uinf.ch, + EINA_FALSE); + e->engine.func->context_free(e->engine.data.output, ctx); + } + } + EINA_INLIST_FOREACH(e->layers, lay) + { + EINA_INLIST_FOREACH(lay->objects, obj) + { + _evas_render2_object_render(e, obj, &uinf, 0); + } + } - ctx = e->engine.func->context_new(e->engine.data.output); - e->engine.func->context_color_set - (e->engine.data.output, ctx, - rand() & 0xff, rand() & 0xff, rand() & 0xff, 0xff); - printf(" %i %i %i %i\n", cx, cy, cw, ch); - e->engine.func->rectangle_draw(e->engine.data.output, - ctx, surface, - cx, cy, cw, ch, - EINA_FALSE); - e->engine.func->context_free(e->engine.data.output, ctx); ru = malloc(sizeof(*ru)); - ru->surface = surface; - NEW_RECT(ru->area, ux, uy, uw, uh); + ru->surface = uinf.surface; + NEW_RECT(ru->area, uinf.ux, uinf.uy, uinf.uw, uinf.uh); e->render.updates = eina_list_append(e->render.updates, ru); - evas_cache_image_ref(surface); + evas_cache_image_ref(uinf.surface); } e->engine.func->output_redraws_clear(e->engine.data.output); }