evas vg: optimize gradient sequences.

Summary:
1. Pointed out gradient prepare step triggered duplicatedly,
because they are immediate children of container.
But gradients is desigend to fill shape,
shape could get ready of the gradients which are applied to.
So, container doesn't need to prepare gradient children.

2. Ector shape does prepare its gradient renderer in it's prepare time,
each gradients objects doesn't need to prepare renderer separately.

Here code skip duplication of sequences of gradients preparation step.
by cleaning up logic.

Reviewers: #committers

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7269
devs/q66/eolian_inherit_api
Hermet Park 5 years ago
parent 09da85807a
commit e2cd8eea55
  1. 6
      src/lib/evas/canvas/evas_vg_container.c
  2. 4
      src/lib/evas/canvas/evas_vg_gradient_linear.c
  3. 6
      src/lib/evas/canvas/evas_vg_gradient_radial.c
  4. 10
      src/lib/evas/canvas/evas_vg_private.h
  5. 2
      src/lib/evas/canvas/evas_vg_shape.c

@ -35,7 +35,7 @@ _efl_canvas_vg_container_render_pre(Eo *obj EINA_UNUSED,
Efl_Canvas_Vg_Node_Data *child_nd;
Efl_Gfx_Change_Flag flag;
if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return ;
if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return;
flag = nd->flags;
nd->flags = EFL_GFX_CHANGE_FLAG_NONE;
@ -44,6 +44,10 @@ _efl_canvas_vg_container_render_pre(Eo *obj EINA_UNUSED,
EINA_LIST_FOREACH(pd->children, l, child)
{
//Skip Gradients. they will be updated by Shape.
if (efl_isa(child, EFL_CANVAS_VG_GRADIENT_CLASS))
continue;
if (flag & EFL_GFX_CHANGE_FLAG_MATRIX)
{
child_nd = efl_data_scope_get(child, EFL_CANVAS_VG_NODE_CLASS);

@ -87,7 +87,9 @@ _efl_canvas_vg_gradient_linear_render_pre(Eo *obj,
efl_gfx_gradient_spread_set(nd->renderer, gd->s);
efl_gfx_gradient_linear_start_set(nd->renderer, pd->start.x, pd->start.y);
efl_gfx_gradient_linear_end_set(nd->renderer, pd->end.x, pd->end.y);
ector_renderer_prepare(nd->renderer);
//Prepare renderer triggered by ector shape this gradient applied to.
//ector_renderer_prepare(nd->renderer);
}
static Eo *

@ -81,7 +81,7 @@ _efl_canvas_vg_gradient_radial_render_pre(Eo *obj,
Efl_Canvas_Vg_Gradient_Radial_Data *pd = data;
Efl_Canvas_Vg_Gradient_Data *gd;
if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return ;
if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return;
nd->flags = EFL_GFX_CHANGE_FLAG_NONE;
@ -104,7 +104,9 @@ _efl_canvas_vg_gradient_radial_render_pre(Eo *obj,
efl_gfx_gradient_radial_center_set(nd->renderer, pd->center.x, pd->center.y);
efl_gfx_gradient_radial_focal_set(nd->renderer, pd->focal.x, pd->focal.y);
efl_gfx_gradient_radial_radius_set(nd->renderer, pd->radius);
ector_renderer_prepare(nd->renderer);
//Prepare renderer triggered by ector shape this gradient applied to.
//ector_renderer_prepare(nd->renderer);
}
static Eo *

@ -116,14 +116,10 @@ void efl_canvas_vg_node_root_set(Efl_VG *node, Efl_VG *vg
static inline Efl_Canvas_Vg_Node_Data *
_evas_vg_render_pre(Efl_VG *child, Ector_Surface *s, Eina_Matrix3 *m)
{
Efl_Canvas_Vg_Node_Data *child_nd = NULL;
// FIXME: Prevent infinite loop
if (child)
child_nd = efl_data_scope_get(child, EFL_CANVAS_VG_NODE_CLASS);
if (child_nd)
child_nd->render_pre(child, m, s, child_nd->data, child_nd);
if (!child) return NULL;
Efl_Canvas_Vg_Node_Data *child_nd = efl_data_scope_get(child, EFL_CANVAS_VG_NODE_CLASS);
if (child_nd) child_nd->render_pre(child, m, s, child_nd->data, child_nd);
return child_nd;
}

@ -87,7 +87,7 @@ _efl_canvas_vg_shape_render_pre(Eo *obj EINA_UNUSED,
Efl_Canvas_Vg_Shape_Data *pd = data;
Efl_Canvas_Vg_Node_Data *fill, *stroke_fill, *stroke_marker, *mask;
if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return ;
if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return;
nd->flags = EFL_GFX_CHANGE_FLAG_NONE;

Loading…
Cancel
Save