From 9871b0c54448a488d1448f8d1f0534d081863835 Mon Sep 17 00:00:00 2001 From: Michal Maciola Date: Tue, 15 Dec 2020 18:37:57 +0100 Subject: [PATCH] evas vector: code integration fix Change-Id: Ic732a89eb92f028e64fed5ff3769b1c53678588b --- src/lib/evas/canvas/efl_canvas_vg_container.c | 2 +- src/lib/evas/canvas/efl_canvas_vg_object.c | 18 +++++++++++----- src/lib/evas/canvas/efl_canvas_vg_shape.c | 30 ++++++++------------------- src/lib/evas/canvas/evas_vg_private.h | 2 +- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg_container.c b/src/lib/evas/canvas/efl_canvas_vg_container.c index 524d688..6b3b041 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_container.c +++ b/src/lib/evas/canvas/efl_canvas_vg_container.c @@ -75,7 +75,7 @@ _efl_canvas_vg_container_render_pre_tvg(Evas_Object_Protected_Data *obj, { Efl_Canvas_Vg_Node_Data *cnd = efl_data_scope_get(child, EFL_CANVAS_VG_NODE_CLASS); if (cnd && cnd->render_pre_tvg) - cnd->render_pre_tvg(obj, child, cnd, cTransform, canvas, cd->scene, w, h); + cnd->render_pre_tvg(obj, child, cnd, cTransform, canvas, cd->scene); } } #endif diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c index 941e04a..b123457 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_object.c +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c @@ -447,7 +447,7 @@ _efl_canvas_vg_object_efl_object_finalize(Eo *obj, Efl_Canvas_Vg_Object_Data *pd #ifdef HAVE_THORVG static void _render_to_buffer_tvg(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd, - Efl_VG *root, int w, int h) + Efl_VG *root, int w EINA_UNUSED, int h EINA_UNUSED) { tvg_canvas_clear(pd->tvg_canvas, false); @@ -455,7 +455,7 @@ _render_to_buffer_tvg(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data { Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(root, EFL_CANVAS_VG_NODE_CLASS); if (nd && nd->render_pre_tvg && pd) - nd->render_pre_tvg(obj, root, nd, NULL, pd->tvg_canvas, NULL, w, h); + nd->render_pre_tvg(obj, root, nd, NULL, pd->tvg_canvas, NULL); } tvg_canvas_update(pd->tvg_canvas); @@ -918,14 +918,22 @@ _efl_canvas_vg_object_render(Evas_Object *eo_obj EINA_UNUSED, pd->changed = EINA_TRUE; } - if (pd->vg_entry) + Vg_Cache_Entry *vg_entry = pd->vg_entry; + if (vg_entry) { + if ((size.w != vg_entry->w) || (size.h != vg_entry->h)) + { + vg_entry = evas_cache_vg_entry_resize(vg_entry, size.w, size.h); + evas_cache_vg_entry_del(pd->vg_entry); + pd->vg_entry = vg_entry; + } + Efl_VG *root = evas_cache_vg_tree_get(pd->vg_entry, pd->frame_idx); if (!root) return; _render_to_buffer_tvg(obj, pd, root, - pd->vg_entry->w, - pd->vg_entry->h); + vg_entry->w, + vg_entry->h); } if (pd->user_entry && pd->user_entry->root) diff --git a/src/lib/evas/canvas/efl_canvas_vg_shape.c b/src/lib/evas/canvas/efl_canvas_vg_shape.c index eb8dd0f..e89074d 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_shape.c +++ b/src/lib/evas/canvas/efl_canvas_vg_shape.c @@ -724,7 +724,7 @@ _efl_canvas_vg_shape_render_pre_tvg(Evas_Object_Protected_Data *vg_pd, Efl_VG *obj, Efl_Canvas_Vg_Node_Data *nd, Eina_Matrix3 *pTransform, - void *canvas, void *scene, int w, int h) + void *canvas, void *scene) { Efl_Canvas_Vg_Shape_Data *sd = NULL; @@ -735,30 +735,12 @@ _efl_canvas_vg_shape_render_pre_tvg(Evas_Object_Protected_Data *vg_pd, double scale_x = 1.0; double scale_y = 1.0; - if (!nd || !nd->data || w == 0 || h == 0) return; + if (!nd || !nd->data) return; + nd->flags = EFL_GFX_CHANGE_FLAG_NONE; sd = nd->data; EFL_CANVAS_VG_COMPUTE_MATRIX(cTransform, pTransform, nd); - - if (vg_pd && vg_pd->cur) - { - if (w != vg_pd->cur->geometry.w || h != vg_pd->cur->geometry.h) - { - scale_x = vg_pd->cur->geometry.w / (double) w; - scale_y = vg_pd->cur->geometry.h / (double) h; - if (cTransform) eina_matrix3_scale(cTransform, scale_x, scale_y); - } - } - - nd->flags = EFL_GFX_CHANGE_FLAG_NONE; tvg_paint_translate(sd->shape, nd->x, nd->y); - - if (sd->fill == NULL) - { - efl_gfx_color_get(obj, &r, &g, &b, &a); - tvg_shape_set_fill_color(sd->shape, r, g, b, a); - } - if (cTransform) { _convert_eina_to_tvg_mat(cTransform, &trans_mat); @@ -767,6 +749,12 @@ _efl_canvas_vg_shape_render_pre_tvg(Evas_Object_Protected_Data *vg_pd, tvg_paint_transform(sd->shape, &trans_mat); } + if (sd->fill == NULL) + { + efl_gfx_color_get(obj, &r, &g, &b, &a); + tvg_shape_set_fill_color(sd->shape, r, g, b, a); + } + if (scene) tvg_scene_push(scene, sd->shape); else if (canvas) diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h index 013ac30..3902b64 100644 --- a/src/lib/evas/canvas/evas_vg_private.h +++ b/src/lib/evas/canvas/evas_vg_private.h @@ -87,7 +87,7 @@ struct _Efl_Canvas_Vg_Node_Data Eina_Matrix3 *ptransform, int opacity, Ector_Buffer *comp, Efl_Gfx_Vg_Composite_Method comp_method, void *data); #ifdef HAVE_THORVG - void (*render_pre_tvg)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node, Efl_Canvas_Vg_Node_Data *nd, Eina_Matrix3 *ptransform, void *canvas, void *scene, int w, int h); + void (*render_pre_tvg)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node, Efl_Canvas_Vg_Node_Data *nd, Eina_Matrix3 *ptransform, void *canvas, void *scene); void (*render_tvg)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node, Efl_Canvas_Vg_Node_Data *nd, void *canvas); #endif -- 2.7.4