Node geometry get bounds fix 26/250626/9
authorMichal Maciola <m.maciola@samsung.com>
Wed, 30 Dec 2020 09:10:25 +0000 (10:10 +0100)
committerHermet Park <chuneon.park@samsung.com>
Wed, 20 Jan 2021 09:38:21 +0000 (09:38 +0000)
This is a fix for evas_vg_node_geometry_get() function.
tvg_paint_get_bounds() was added to thorvg.

Commit was rebuilded on patch set 7.
Efl.Gfx.Path.bounds_get override was added into efl_canvas_vg_shape.eo.
For thorvg tvg_paint_get_bounds(), for efl super is called.

Change-Id: If6ecef780ade2deeec70129f75660c57544c5d68

src/lib/evas/canvas/efl_canvas_vg_shape.c
src/lib/evas/canvas/efl_canvas_vg_shape.eo

index 3ccfe68..3150f14 100644 (file)
@@ -752,9 +752,6 @@ _efl_canvas_vg_shape_render_pre_tvg(EINA_UNUSED Evas_Object_Protected_Data *vg_p
 
    int r = 0, g = 0, b = 0, a = 0;
 
-   double scale_x = 1.0;
-   double scale_y = 1.0;
-
    if (!nd || !nd->data)  return;
    nd->flags = EFL_GFX_CHANGE_FLAG_NONE;
    sd = nd->data;
@@ -785,6 +782,23 @@ _efl_canvas_vg_shape_render_pre_tvg(EINA_UNUSED Evas_Object_Protected_Data *vg_p
 }
 #endif
 
+static void
+_efl_canvas_vg_shape_efl_gfx_path_bounds_get(const Eo *obj EINA_UNUSED,
+                                                 Efl_Canvas_Vg_Shape_Data *sd,
+                                                 Eina_Rect *r)
+{
+#ifndef HAVE_THORVG
+   efl_gfx_path_bounds_get(efl_super(obj, MY_CLASS), r);
+#else
+   float px, py, pw, ph;
+   tvg_paint_get_bounds(sd->shape, &px, &py, &pw, &ph);
+   r->x = (int)px;
+   r->y = (int)py;
+   r->w = (int)pw;
+   r->h = (int)ph;
+#endif
+}
+
 static Eo *
 _efl_canvas_vg_shape_efl_object_constructor(Eo *obj, Efl_Canvas_Vg_Shape_Data *pd)
 {
index 35991e6..50422ce 100644 (file)
@@ -34,6 +34,7 @@ class @beta Efl.Canvas.Vg.Shape extends Efl.Canvas.Vg.Node implements Efl.Gfx.Sh
       }
    }
    implements {
+      Efl.Gfx.Path.bounds_get;
       Efl.Gfx.Path.interpolate;
       Efl.Gfx.Path.commit;
       Efl.Duplicate.duplicate;