summaryrefslogtreecommitdiff
path: root/src/lib/ector
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-12-24 14:31:05 +0900
committerHermet Park <hermetpark@gmail.com>2018-12-26 19:29:10 +0900
commit7c38c0c9154b0971ccb8ecf5ea8f15467cfb6662 (patch)
treea23fd02569b1066071fa7500b83af51d1fe1a94d /src/lib/ector
parent033d3031e69e473f6148f6770ef44e1d00268ba4 (diff)
efl gfx_path: remove EFL_GFX_PATH_EVENT_CHANGED
Summary: Here is an additional optmization patch for removing unnecessary updation of path, For instance, let's assume this scenario: If one vg object has 20 path nodes(shapes), and every single nodes would have 50 path changes. (like, append_cubic, append_rect, append_xxx ...); There would 1000 events triggering. Furthermore, if there are 20 vector objects in one view, hese events would be triggered 20000 in one frame. It's insane, actually I could figured out that happens. and it took a lot of cpu consumption in some vector usages. efl_gfx_path_commit() is my idea to avoid this. When path is ready, the path need to get this api call in the last to make object changed properly. @feature Reviewers: #committers, cedric Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7494
Diffstat (limited to 'src/lib/ector')
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_shape.c24
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_shape.eo1
-rw-r--r--src/lib/ector/gl/ector_renderer_gl_shape.c21
-rw-r--r--src/lib/ector/gl/ector_renderer_gl_shape.eo1
-rw-r--r--src/lib/ector/software/ector_renderer_software_shape.c43
-rw-r--r--src/lib/ector/software/ector_renderer_software_shape.eo2
6 files changed, 33 insertions, 59 deletions
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
index 2605623..87fe2a0 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
@@ -75,19 +75,15 @@ struct _Ector_Renderer_Cairo_Shape_Data
75 cairo_path_t *path; 75 cairo_path_t *path;
76}; 76};
77 77
78static void 78EOLIAN static void
79_ector_renderer_cairo_shape_path_changed(void *data, const Efl_Event *event) 79_ector_renderer_cairo_shape_efl_gfx_path_commit(Eo *obj EINA_UNUSED,
80 Ector_Renderer_Cairo_Shape_Data *pd)
80{ 81{
81 Ector_Renderer_Cairo_Shape_Data *pd = data; 82 if (pd->path)
82 Efl_Gfx_Path_Change_Event *ev = event->info; 83 {
83 84 cairo_path_destroy(pd->path);
84 if (!pd->path) return; 85 pd->path = NULL;
85 if (ev && !((ev->what & EFL_GFX_CHANGE_FLAG_MATRIX) || 86 }
86 (ev->what & EFL_GFX_CHANGE_FLAG_PATH)))
87 return;
88
89 cairo_path_destroy(pd->path);
90 pd->path = NULL;
91} 87}
92 88
93static Eina_Bool 89static Eina_Bool
@@ -255,9 +251,7 @@ _ector_renderer_cairo_shape_efl_object_constructor(Eo *obj, Ector_Renderer_Cairo
255 pd->shape = efl_data_xref(obj, ECTOR_RENDERER_SHAPE_MIXIN, obj); 251 pd->shape = efl_data_xref(obj, ECTOR_RENDERER_SHAPE_MIXIN, obj);
256 pd->base = efl_data_xref(obj, ECTOR_RENDERER_CLASS, obj); 252 pd->base = efl_data_xref(obj, ECTOR_RENDERER_CLASS, obj);
257 253
258 efl_event_callback_add(obj, EFL_GFX_PATH_EVENT_CHANGED, _ector_renderer_cairo_shape_path_changed, pd); 254 return obj;
259
260 return obj;
261} 255}
262 256
263static Efl_Object * 257static Efl_Object *
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.eo b/src/lib/ector/cairo/ector_renderer_cairo_shape.eo
index b76dd29..7c95844 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_shape.eo
+++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.eo
@@ -6,6 +6,7 @@ class Ector.Renderer.Cairo.Shape (Ector.Renderer.Cairo, Ector.Renderer.Shape, Ef
6 Ector.Renderer.prepare; 6 Ector.Renderer.prepare;
7 Ector.Renderer.draw; 7 Ector.Renderer.draw;
8 Efl.Gfx.Path.bounds_get; 8 Efl.Gfx.Path.bounds_get;
9 Efl.Gfx.Path.commit;
9 Ector.Renderer.crc { get; } 10 Ector.Renderer.crc { get; }
10 Ector.Renderer.Cairo.op_fill; 11 Ector.Renderer.Cairo.op_fill;
11 Efl.Object.constructor; 12 Efl.Object.constructor;
diff --git a/src/lib/ector/gl/ector_renderer_gl_shape.c b/src/lib/ector/gl/ector_renderer_gl_shape.c
index 79e029d..cf2266d 100644
--- a/src/lib/ector/gl/ector_renderer_gl_shape.c
+++ b/src/lib/ector/gl/ector_renderer_gl_shape.c
@@ -20,18 +20,15 @@ struct _Ector_Renderer_GL_Shape_Data
20 GLshort *vertex; 20 GLshort *vertex;
21}; 21};
22 22
23static void 23EOLIAN static void
24_ector_renderer_gl_shape_path_changed(void *data, const Efl_Event *event EINA_UNUSED) 24_ector_renderer_gl_shape_efl_gfx_path_commit(Eo *obj EINA_UNUSED,
25 Ector_Renderer_GL_Shape_Data *pd)
25{ 26{
26 Ector_Renderer_GL_Shape_Data *pd = data; 27 if (pd->vertex)
27 Efl_Gfx_Path_Change_Event *ev = event->info; 28 {
28 29 free(pd->vertex);
29 if (ev && !((ev->what & EFL_GFX_CHANGE_FLAG_MATRIX) || 30 pd->vertex = NULL;
30 (ev->what & EFL_GFX_CHANGE_FLAG_PATH))) 31 }
31 return;
32
33 free(pd->vertex);
34 pd->vertex = NULL;
35} 32}
36 33
37static Eina_Bool 34static Eina_Bool
@@ -154,8 +151,6 @@ _ector_renderer_gl_shape_efl_object_constructor(Eo *obj, Ector_Renderer_GL_Shape
154 pd->shape = efl_data_xref(obj, ECTOR_RENDERER_SHAPE_MIXIN, obj); 151 pd->shape = efl_data_xref(obj, ECTOR_RENDERER_SHAPE_MIXIN, obj);
155 pd->base = efl_data_xref(obj, ECTOR_RENDERER_CLASS, obj); 152 pd->base = efl_data_xref(obj, ECTOR_RENDERER_CLASS, obj);
156 153
157 efl_event_callback_add(obj, EFL_GFX_PATH_EVENT_CHANGED, _ector_renderer_gl_shape_path_changed, pd);
158
159 return obj; 154 return obj;
160} 155}
161 156
diff --git a/src/lib/ector/gl/ector_renderer_gl_shape.eo b/src/lib/ector/gl/ector_renderer_gl_shape.eo
index 21ef655..6323ef6 100644
--- a/src/lib/ector/gl/ector_renderer_gl_shape.eo
+++ b/src/lib/ector/gl/ector_renderer_gl_shape.eo
@@ -8,6 +8,7 @@ class Ector.Renderer.GL.Shape (Ector.Renderer.GL, Ector.Renderer.Shape, Efl.Gfx.
8 Ector.Renderer.crc { get; } 8 Ector.Renderer.crc { get; }
9 Ector.Renderer.GL.op_fill; 9 Ector.Renderer.GL.op_fill;
10 Efl.Gfx.Path.bounds_get; 10 Efl.Gfx.Path.bounds_get;
11 Efl.Gfx.Path.commit;
11 Efl.Object.constructor; 12 Efl.Object.constructor;
12 Efl.Object.destructor; 13 Efl.Object.destructor;
13 } 14 }
diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c
index 396e472..b9cf1fa 100644
--- a/src/lib/ector/software/ector_renderer_software_shape.c
+++ b/src/lib/ector/software/ector_renderer_software_shape.c
@@ -734,36 +734,20 @@ _ector_renderer_software_shape_ector_renderer_software_op_fill(Eo *obj EINA_UNUS
734 return EINA_FALSE; 734 return EINA_FALSE;
735} 735}
736 736
737static void 737EOLIAN static void
738_ector_renderer_software_shape_efl_gfx_path_path_set(Eo *obj, 738_ector_renderer_software_shape_efl_gfx_path_commit(Eo *obj EINA_UNUSED,
739 Ector_Renderer_Software_Shape_Data *pd, 739 Ector_Renderer_Software_Shape_Data *pd)
740 const Efl_Gfx_Path_Command *op,
741 const double *points)
742{
743 if (pd->shape_data) ector_software_rasterizer_destroy_rle_data(pd->shape_data);
744 if (pd->outline_data) ector_software_rasterizer_destroy_rle_data(pd->outline_data);
745 pd->shape_data = NULL;
746 pd->outline_data = NULL;
747
748 efl_gfx_path_set(efl_super(obj, MY_CLASS), op, points);
749}
750
751
752static void
753_ector_renderer_software_shape_path_changed(void *data, const Efl_Event *event EINA_UNUSED)
754{ 740{
755 Ector_Renderer_Software_Shape_Data *pd = data; 741 if (pd->shape_data)
756 Efl_Gfx_Path_Change_Event *ev = event->info; 742 {
757 743 ector_software_rasterizer_destroy_rle_data(pd->shape_data);
758 if (ev && !((ev->what & EFL_GFX_CHANGE_FLAG_MATRIX) || 744 pd->shape_data = NULL;
759 (ev->what & EFL_GFX_CHANGE_FLAG_PATH))) 745 }
760 return; 746 if (pd->outline_data)
761 747 {
762 if (pd->shape_data) ector_software_rasterizer_destroy_rle_data(pd->shape_data); 748 ector_software_rasterizer_destroy_rle_data(pd->outline_data);
763 if (pd->outline_data) ector_software_rasterizer_destroy_rle_data(pd->outline_data); 749 pd->outline_data = NULL;
764 750 }
765 pd->shape_data = NULL;
766 pd->outline_data = NULL;
767} 751}
768 752
769static Eo * 753static Eo *
@@ -777,7 +761,6 @@ _ector_renderer_software_shape_efl_object_constructor(Eo *obj, Ector_Renderer_So
777 pd->public_shape = efl_data_xref(obj, EFL_GFX_SHAPE_MIXIN, obj); 761 pd->public_shape = efl_data_xref(obj, EFL_GFX_SHAPE_MIXIN, obj);
778 pd->shape = efl_data_xref(obj, ECTOR_RENDERER_SHAPE_MIXIN, obj); 762 pd->shape = efl_data_xref(obj, ECTOR_RENDERER_SHAPE_MIXIN, obj);
779 pd->base = efl_data_xref(obj, ECTOR_RENDERER_CLASS, obj); 763 pd->base = efl_data_xref(obj, ECTOR_RENDERER_CLASS, obj);
780 efl_event_callback_add(obj, EFL_GFX_PATH_EVENT_CHANGED, _ector_renderer_software_shape_path_changed, pd);
781 764
782 return obj; 765 return obj;
783} 766}
diff --git a/src/lib/ector/software/ector_renderer_software_shape.eo b/src/lib/ector/software/ector_renderer_software_shape.eo
index abe8344..04f19ba 100644
--- a/src/lib/ector/software/ector_renderer_software_shape.eo
+++ b/src/lib/ector/software/ector_renderer_software_shape.eo
@@ -8,7 +8,7 @@ class Ector.Renderer.Software.Shape (Ector.Renderer.Software, Ector.Renderer.Sha
8 Ector.Renderer.Software.op_fill; 8 Ector.Renderer.Software.op_fill;
9 Ector.Renderer.mask { set; } 9 Ector.Renderer.mask { set; }
10 Ector.Renderer.crc { get; } 10 Ector.Renderer.crc { get; }
11 Efl.Gfx.Path.path { set; } 11 Efl.Gfx.Path.commit;
12 Efl.Object.constructor; 12 Efl.Object.constructor;
13 Efl.Object.destructor; 13 Efl.Object.destructor;
14 } 14 }