summaryrefslogtreecommitdiff
path: root/src/lib/evas
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-12-07 15:37:02 +0900
committerHermet Park <hermetpark@gmail.com>2018-12-07 15:37:02 +0900
commitca3ddc21e432ebbd36b595732fc269b98395c9c6 (patch)
tree8b0c41ef0c83112f370ab66e991b25fafb8d06ac /src/lib/evas
parentdc5db854707d966d4871b21446ba5188621745d5 (diff)
evas vg: code refactoring.
make code clean and neat, no logic changes. use macro to reduce lines. rename ambiguous internal variables. remove unused variables.
Diffstat (limited to 'src/lib/evas')
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient.c8
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c2
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c2
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.c57
-rw-r--r--src/lib/evas/canvas/evas_vg_private.h3
5 files changed, 32 insertions, 40 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient.c b/src/lib/evas/canvas/efl_canvas_vg_gradient.c
index 888c478582..313753eedb 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_gradient.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_gradient.c
@@ -39,9 +39,9 @@ _efl_canvas_vg_gradient_efl_gfx_gradient_stop_get(const Eo *obj EINA_UNUSED,
39static void 39static void
40_efl_canvas_vg_gradient_efl_gfx_gradient_spread_set(Eo *obj EINA_UNUSED, 40_efl_canvas_vg_gradient_efl_gfx_gradient_spread_set(Eo *obj EINA_UNUSED,
41 Efl_Canvas_Vg_Gradient_Data *pd, 41 Efl_Canvas_Vg_Gradient_Data *pd,
42 Efl_Gfx_Gradient_Spread s) 42 Efl_Gfx_Gradient_Spread spread)
43{ 43{
44 pd->s = s; 44 pd->spread = spread;
45 45
46 _efl_canvas_vg_node_changed(obj); 46 _efl_canvas_vg_node_changed(obj);
47} 47}
@@ -50,7 +50,7 @@ static Efl_Gfx_Gradient_Spread
50_efl_canvas_vg_gradient_efl_gfx_gradient_spread_get(const Eo *obj EINA_UNUSED, 50_efl_canvas_vg_gradient_efl_gfx_gradient_spread_get(const Eo *obj EINA_UNUSED,
51 Efl_Canvas_Vg_Gradient_Data *pd) 51 Efl_Canvas_Vg_Gradient_Data *pd)
52{ 52{
53 return pd->s; 53 return pd->spread;
54} 54}
55 55
56static Eina_Bool 56static Eina_Bool
@@ -113,7 +113,7 @@ _efl_canvas_vg_gradient_efl_duplicate_duplicate(const Eo *obj, Efl_Canvas_Vg_Gra
113 113
114 cn = efl_duplicate(efl_super(obj, MY_CLASS)); 114 cn = efl_duplicate(efl_super(obj, MY_CLASS));
115 efl_gfx_gradient_stop_set(cn, pd->colors, pd->colors_count); 115 efl_gfx_gradient_stop_set(cn, pd->colors, pd->colors_count);
116 efl_gfx_gradient_spread_set(cn, pd->s); 116 efl_gfx_gradient_spread_set(cn, pd->spread);
117 return cn; 117 return cn;
118} 118}
119 119
diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c b/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c
index b8896f16e6..391f9c81b5 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c
@@ -84,7 +84,7 @@ _efl_canvas_vg_gradient_linear_render_pre(Eo *obj,
84 ector_renderer_color_set(nd->renderer, nd->r, nd->g, nd->b, nd->a); 84 ector_renderer_color_set(nd->renderer, nd->r, nd->g, nd->b, nd->a);
85 ector_renderer_visibility_set(nd->renderer, nd->visibility); 85 ector_renderer_visibility_set(nd->renderer, nd->visibility);
86 efl_gfx_gradient_stop_set(nd->renderer, gd->colors, gd->colors_count); 86 efl_gfx_gradient_stop_set(nd->renderer, gd->colors, gd->colors_count);
87 efl_gfx_gradient_spread_set(nd->renderer, gd->s); 87 efl_gfx_gradient_spread_set(nd->renderer, gd->spread);
88 efl_gfx_gradient_linear_start_set(nd->renderer, pd->start.x, pd->start.y); 88 efl_gfx_gradient_linear_start_set(nd->renderer, pd->start.x, pd->start.y);
89 efl_gfx_gradient_linear_end_set(nd->renderer, pd->end.x, pd->end.y); 89 efl_gfx_gradient_linear_end_set(nd->renderer, pd->end.x, pd->end.y);
90 90
diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c b/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c
index d452b51aab..6a72b7e4da 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c
@@ -100,7 +100,7 @@ _efl_canvas_vg_gradient_radial_render_pre(Eo *obj,
100 ector_renderer_color_set(nd->renderer, nd->r, nd->g, nd->b, nd->a); 100 ector_renderer_color_set(nd->renderer, nd->r, nd->g, nd->b, nd->a);
101 ector_renderer_visibility_set(nd->renderer, nd->visibility); 101 ector_renderer_visibility_set(nd->renderer, nd->visibility);
102 efl_gfx_gradient_stop_set(nd->renderer, gd->colors, gd->colors_count); 102 efl_gfx_gradient_stop_set(nd->renderer, gd->colors, gd->colors_count);
103 efl_gfx_gradient_spread_set(nd->renderer, gd->s); 103 efl_gfx_gradient_spread_set(nd->renderer, gd->spread);
104 efl_gfx_gradient_radial_center_set(nd->renderer, pd->center.x, pd->center.y); 104 efl_gfx_gradient_radial_center_set(nd->renderer, pd->center.x, pd->center.y);
105 efl_gfx_gradient_radial_focal_set(nd->renderer, pd->focal.x, pd->focal.y); 105 efl_gfx_gradient_radial_focal_set(nd->renderer, pd->focal.x, pd->focal.y);
106 efl_gfx_gradient_radial_radius_set(nd->renderer, pd->radius); 106 efl_gfx_gradient_radial_radius_set(nd->renderer, pd->radius);
diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c
index 81e047f2cf..0824aba1e1 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_object.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
@@ -139,12 +139,14 @@ _efl_canvas_vg_object_root_node_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Obj
139} 139}
140 140
141EOLIAN static void 141EOLIAN static void
142_efl_canvas_vg_object_root_node_set(Eo *obj, Efl_Canvas_Vg_Object_Data *pd, Efl_VG *root_node) 142_efl_canvas_vg_object_root_node_set(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd, Efl_VG *root_node)
143{ 143{
144 // if the same root is already set 144 // if the same root is already set
145 if (pd->user_entry && pd->user_entry->root == root_node) 145 if (pd->user_entry && pd->user_entry->root == root_node)
146 return; 146 return;
147 147
148 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
149
148 // check if a file has been already set 150 // check if a file has been already set
149 if (pd->vg_entry) 151 if (pd->vg_entry)
150 { 152 {
@@ -173,21 +175,19 @@ _efl_canvas_vg_object_root_node_set(Eo *obj, Efl_Canvas_Vg_Object_Data *pd, Efl_
173 // set the parent so that vg canvas can render it. 175 // set the parent so that vg canvas can render it.
174 efl_parent_set(pd->user_entry->root, pd->root); 176 efl_parent_set(pd->user_entry->root, pd->root);
175 177
176 efl_canvas_vg_node_root_set(root_node, obj); 178 efl_canvas_vg_node_root_set(root_node, eo_obj);
177 } 179 }
178 else if (pd->user_entry) 180 else if (pd->user_entry)
179 { 181 {
180 // drop any surface cache attached to it. 182 // drop any surface cache attached to it.
181 Evas_Object_Protected_Data *eobj = efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS); 183 ENFN->ector_surface_cache_drop(_evas_engine_context(obj->layer->evas), pd->user_entry->root);
182 eobj->layer->evas->engine.func->ector_surface_cache_drop(_evas_engine_context(eobj->layer->evas),
183 pd->user_entry);
184 free(pd->user_entry); 184 free(pd->user_entry);
185 pd->user_entry = NULL; 185 pd->user_entry = NULL;
186 } 186 }
187 187
188 // force a redraw 188 // force a redraw
189 pd->changed = EINA_TRUE; 189 pd->changed = EINA_TRUE;
190 evas_object_change(obj, efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS)); 190 evas_object_change(eo_obj, obj);
191} 191}
192 192
193EOLIAN static void 193EOLIAN static void
@@ -415,11 +415,8 @@ _render_to_buffer(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd
415 //create a buffer 415 //create a buffer
416 if (!buffer) 416 if (!buffer)
417 { 417 {
418 buffer = obj->layer->evas->engine.func->ector_surface_create(engine, 418 buffer = ENFN->ector_surface_create(engine, w, h, &error);
419 w, h, 419 if (error) return NULL;
420 &error);
421 if (error)
422 return NULL; // surface creation error
423 buffer_created = EINA_TRUE; 420 buffer_created = EINA_TRUE;
424 } 421 }
425 422
@@ -449,7 +446,7 @@ _render_to_buffer(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd
449 evas_common_draw_context_free(context); 446 evas_common_draw_context_free(context);
450 447
451 if (buffer_created) 448 if (buffer_created)
452 obj->layer->evas->engine.func->ector_surface_cache_set(engine, key, buffer); 449 ENFN->ector_surface_cache_set(engine, key, buffer);
453 450
454 return buffer; 451 return buffer;
455} 452}
@@ -464,7 +461,7 @@ _render_buffer_to_screen(Evas_Object_Protected_Data *obj,
464 Eina_Bool async_unref; 461 Eina_Bool async_unref;
465 462
466 //Draw the buffer as image to canvas 463 //Draw the buffer as image to canvas
467 async_unref = obj->layer->evas->engine.func->image_draw(engine, output, context, surface, 464 async_unref = ENFN->image_draw(engine, output, context, surface,
468 buffer, 465 buffer,
469 0, 0, w, h, 466 0, 0, w, h,
470 x, y, w, h, 467 x, y, w, h,
@@ -499,7 +496,7 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj,
499 root = evas_cache_vg_tree_get(vg_entry); 496 root = evas_cache_vg_tree_get(vg_entry);
500 if (!root) return; 497 if (!root) return;
501 498
502 void *buffer = obj->layer->evas->engine.func->ector_surface_cache_get(engine, root); 499 void *buffer = ENFN->ector_surface_cache_get(engine, root);
503 500
504 if (!buffer) 501 if (!buffer)
505 { 502 {
@@ -515,9 +512,8 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj,
515 efl_unref(dupe_root); 512 efl_unref(dupe_root);
516 } 513 }
517 else 514 else
518 { 515 //cache reference was increased when we get the cache.
519 obj->layer->evas->engine.func->ector_surface_cache_drop(engine, root); 516 ENFN->ector_surface_cache_drop(engine, root);
520 }
521 517
522 _render_buffer_to_screen(obj, 518 _render_buffer_to_screen(obj,
523 engine, output, context, surface, 519 engine, output, context, surface,
@@ -538,13 +534,13 @@ _user_vg_entry_render(Evas_Object_Protected_Data *obj,
538 if ((user_entry->w != w ) || 534 if ((user_entry->w != w ) ||
539 (user_entry->h != h)) 535 (user_entry->h != h))
540 { 536 {
541 obj->layer->evas->engine.func->ector_surface_cache_drop(engine, user_entry); 537 ENFN->ector_surface_cache_drop(engine, user_entry);
542 user_entry->w = w; 538 user_entry->w = w;
543 user_entry->h = h; 539 user_entry->h = h;
544 pd->user_entry = user_entry; 540 pd->user_entry = user_entry;
545 } 541 }
546 //if the buffer is not created yet 542 //if the buffer is not created yet
547 void *buffer = obj->layer->evas->engine.func->ector_surface_cache_get(engine, user_entry); 543 void *buffer = ENFN->ector_surface_cache_get(engine, user_entry);
548 if (!buffer) 544 if (!buffer)
549 { 545 {
550 // render to the buffer 546 // render to the buffer
@@ -567,7 +563,7 @@ _user_vg_entry_render(Evas_Object_Protected_Data *obj,
567 user_entry, 563 user_entry,
568 buffer, 564 buffer,
569 do_async); 565 do_async);
570 obj->layer->evas->engine.func->ector_surface_cache_drop(engine, user_entry); 566 ENFN->ector_surface_cache_drop(engine, user_entry);
571 } 567 }
572 568
573 _render_buffer_to_screen(obj, 569 _render_buffer_to_screen(obj,
@@ -587,18 +583,15 @@ _efl_canvas_vg_object_render(Evas_Object *eo_obj EINA_UNUSED,
587 Efl_Canvas_Vg_Object_Data *pd = type_private_data; 583 Efl_Canvas_Vg_Object_Data *pd = type_private_data;
588 584
589 /* render object to surface with context, and offxet by x,y */ 585 /* render object to surface with context, and offxet by x,y */
590 obj->layer->evas->engine.func->context_color_set(engine, context, 586 ENFN->context_color_set(engine, context, 255, 255, 255, 255);
591 255, 255, 255, 255); 587 ENFN->context_multiplier_set(engine, context,
592 obj->layer->evas->engine.func->context_multiplier_set(engine, 588 obj->cur->cache.clip.r,
593 context, 589 obj->cur->cache.clip.g,
594 obj->cur->cache.clip.r, 590 obj->cur->cache.clip.b,
595 obj->cur->cache.clip.g, 591 obj->cur->cache.clip.a);
596 obj->cur->cache.clip.b, 592 ENFN->context_anti_alias_set(engine, context, obj->cur->anti_alias);
597 obj->cur->cache.clip.a); 593 ENFN->context_render_op_set(engine, context, obj->cur->render_op);
598 obj->layer->evas->engine.func->context_anti_alias_set(engine, context, 594
599 obj->cur->anti_alias);
600 obj->layer->evas->engine.func->context_render_op_set(engine, context,
601 obj->cur->render_op);
602 if (pd->vg_entry) 595 if (pd->vg_entry)
603 { 596 {
604 _cache_vg_entry_render(obj, pd, 597 _cache_vg_entry_render(obj, pd,
diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h
index bfba6ab34d..95010c5c86 100644
--- a/src/lib/evas/canvas/evas_vg_private.h
+++ b/src/lib/evas/canvas/evas_vg_private.h
@@ -39,7 +39,6 @@ typedef struct _User_Vg_Entry
39 39
40struct _Efl_Canvas_Vg_Object_Data 40struct _Efl_Canvas_Vg_Object_Data
41{ 41{
42 void *engine_data;
43 Efl_VG *root; 42 Efl_VG *root;
44 Evas_Cache_Vg_Entry *vg_entry; 43 Evas_Cache_Vg_Entry *vg_entry;
45 User_Vg_Entry *user_entry; // holds the user set vg tree 44 User_Vg_Entry *user_entry; // holds the user set vg tree
@@ -87,7 +86,7 @@ struct _Efl_Canvas_Vg_Gradient_Data
87 Efl_Gfx_Gradient_Stop *colors; 86 Efl_Gfx_Gradient_Stop *colors;
88 unsigned int colors_count; 87 unsigned int colors_count;
89 88
90 Efl_Gfx_Gradient_Spread s; 89 Efl_Gfx_Gradient_Spread spread;
91}; 90};
92 91
93struct _Efl_Canvas_Vg_Interpolation 92struct _Efl_Canvas_Vg_Interpolation