summaryrefslogtreecommitdiff
path: root/src/static_libs
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@free.fr>2018-05-17 14:48:26 -0700
committerCedric BAIL <cedric@osg.samsung.com>2018-05-24 16:02:20 -0700
commitb671a2c34fcd2b137a2120f4bcfbd85bd5ed2bff (patch)
treef24b683474f6daf222baedf4756cce35fb56c496 /src/static_libs
parent301340baf688e297fbe57e880f9f75e7d85ea577 (diff)
evas: actually we expect gradient to live as long as the part that is using them.
Diffstat (limited to 'src/static_libs')
-rw-r--r--src/static_libs/vg_common/vg_common.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/static_libs/vg_common/vg_common.c b/src/static_libs/vg_common/vg_common.c
index b6be729..eb8a293 100644
--- a/src/static_libs/vg_common/vg_common.c
+++ b/src/static_libs/vg_common/vg_common.c
@@ -547,7 +547,7 @@ vg_common_svg_node_free(Svg_Node *node)
547} 547}
548 548
549static Efl_VG * 549static Efl_VG *
550_apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Vg_File_Data *vg_data) 550_apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_data)
551{ 551{
552 Efl_VG *grad_obj = NULL; 552 Efl_VG *grad_obj = NULL;
553 Efl_Gfx_Gradient_Stop *stops, *stop; 553 Efl_Gfx_Gradient_Stop *stops, *stop;
@@ -570,7 +570,7 @@ _apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Vg_File_Data *vg_dat
570 570
571 if (g->type == SVG_LINEAR_GRADIENT) 571 if (g->type == SVG_LINEAR_GRADIENT)
572 { 572 {
573 grad_obj = evas_vg_gradient_linear_add(NULL); 573 grad_obj = evas_vg_gradient_linear_add(parent);
574 evas_vg_gradient_linear_start_set(grad_obj, g->linear->x1 * r.w + r.x, g->linear->y1 * r.h + r.y); 574 evas_vg_gradient_linear_start_set(grad_obj, g->linear->x1 * r.w + r.x, g->linear->y1 * r.h + r.y);
575 evas_vg_gradient_linear_end_set(grad_obj, g->linear->x2 * r.w + r.x, g->linear->y2 * r.h + r.y); 575 evas_vg_gradient_linear_end_set(grad_obj, g->linear->x2 * r.w + r.x, g->linear->y2 * r.h + r.y);
576 } 576 }
@@ -587,7 +587,7 @@ _apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Vg_File_Data *vg_dat
587 int min = (r.h > r.w) ? r.w : r.h; 587 int min = (r.h > r.w) ? r.w : r.h;
588 radius = sqrt(pow(min, 2) + pow(min, 2)) / sqrt(2.0); 588 radius = sqrt(pow(min, 2) + pow(min, 2)) / sqrt(2.0);
589 } 589 }
590 grad_obj = evas_vg_gradient_radial_add(NULL); 590 grad_obj = evas_vg_gradient_radial_add(parent);
591 evas_vg_gradient_radial_center_set(grad_obj, g->radial->cx * r.w + r.x, g->radial->cy * r.h + r.y); 591 evas_vg_gradient_radial_center_set(grad_obj, g->radial->cx * r.w + r.x, g->radial->cy * r.h + r.y);
592 evas_vg_gradient_radial_radius_set(grad_obj, g->radial->r * radius); 592 evas_vg_gradient_radial_radius_set(grad_obj, g->radial->r * radius);
593 evas_vg_gradient_radial_focal_set(grad_obj, g->radial->fx * r.w + r.x, g->radial->fy * r.h + r.y); 593 evas_vg_gradient_radial_focal_set(grad_obj, g->radial->fx * r.w + r.x, g->radial->fy * r.h + r.y);
@@ -663,7 +663,7 @@ _apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Vg_File_Data *vg_dat
663 663
664// vg tree creation 664// vg tree creation
665static void 665static void
666_apply_vg_property(Svg_Node *node, Efl_VG *vg, Vg_File_Data *vg_data) 666_apply_vg_property(Svg_Node *node, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_data)
667{ 667{
668 Svg_Style_Property *style = node->style; 668 Svg_Style_Property *style = node->style;
669 669
@@ -687,7 +687,7 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Vg_File_Data *vg_data)
687 else if (style->fill.paint.gradient) 687 else if (style->fill.paint.gradient)
688 { 688 {
689 // if the fill has gradient then apply. 689 // if the fill has gradient then apply.
690 evas_vg_shape_fill_set(vg, _apply_gradient_property(style->fill.paint.gradient, vg, vg_data)); 690 evas_vg_shape_fill_set(vg, _apply_gradient_property(style->fill.paint.gradient, vg, parent, vg_data));
691 } 691 }
692 else if (style->fill.paint.cur_color) 692 else if (style->fill.paint.cur_color)
693 { 693 {
@@ -714,7 +714,7 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Vg_File_Data *vg_data)
714 else if (style->stroke.paint.gradient) 714 else if (style->stroke.paint.gradient)
715 { 715 {
716 // if the fill has gradient then apply. 716 // if the fill has gradient then apply.
717 evas_vg_shape_stroke_fill_set(vg, _apply_gradient_property(style->stroke.paint.gradient, vg, vg_data)); 717 evas_vg_shape_stroke_fill_set(vg, _apply_gradient_property(style->stroke.paint.gradient, vg, parent, vg_data));
718 } 718 }
719 else if (style->stroke.paint.url) 719 else if (style->stroke.paint.url)
720 { 720 {
@@ -766,7 +766,7 @@ vg_common_create_vg_node_helper(Svg_Node *node, Efl_VG *parent, Vg_File_Data *vg
766 vg = efl_add_ref(EFL_CANVAS_VG_CONTAINER_CLASS, NULL); 766 vg = efl_add_ref(EFL_CANVAS_VG_CONTAINER_CLASS, NULL);
767 else 767 else
768 vg = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, parent); 768 vg = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, parent);
769 _apply_vg_property(node, vg, vg_data); 769 _apply_vg_property(node, vg, parent, vg_data);
770 EINA_LIST_FOREACH(node->child, l, child) 770 EINA_LIST_FOREACH(node->child, l, child)
771 { 771 {
772 vg_common_create_vg_node_helper(child, vg, vg_data); 772 vg_common_create_vg_node_helper(child, vg, vg_data);
@@ -815,7 +815,7 @@ vg_common_create_vg_node_helper(Svg_Node *node, Efl_VG *parent, Vg_File_Data *vg
815 break; 815 break;
816 } 816 }
817 if (vg) 817 if (vg)
818 _apply_vg_property(node, vg, vg_data); 818 _apply_vg_property(node, vg, parent, vg_data);
819 return vg; 819 return vg;
820} 820}
821 821
@@ -884,13 +884,13 @@ _create_gradient_node(Efl_VG *vg)
884{ 884{
885 const Efl_Gfx_Gradient_Stop *stops = NULL; 885 const Efl_Gfx_Gradient_Stop *stops = NULL;
886 Efl_Gfx_Gradient_Stop *new_stop; 886 Efl_Gfx_Gradient_Stop *new_stop;
887 unsigned int count, i; 887 unsigned int count = 0, i;
888 888
889 Svg_Style_Gradient *grad = calloc(1, sizeof(Svg_Style_Gradient)); 889 Svg_Style_Gradient *grad = calloc(1, sizeof(Svg_Style_Gradient));
890 890
891 grad->spread = evas_vg_gradient_spread_get(vg); 891 grad->spread = evas_vg_gradient_spread_get(vg);
892 evas_vg_gradient_stop_get(vg, &stops, &count); 892 evas_vg_gradient_stop_get(vg, &stops, &count);
893 for (i=0 ; i < count; i++) 893 for (i = 0; i < count; i++)
894 { 894 {
895 new_stop = calloc(1, sizeof(Efl_Gfx_Gradient_Stop)); 895 new_stop = calloc(1, sizeof(Efl_Gfx_Gradient_Stop));
896 memcpy(new_stop, stops, sizeof(Efl_Gfx_Gradient_Stop)); 896 memcpy(new_stop, stops, sizeof(Efl_Gfx_Gradient_Stop));
@@ -996,7 +996,7 @@ vg_common_create_svg_node_helper(Efl_VG *vg, Svg_Node *parent)
996 vg_common_create_svg_node_helper(child, svg_node); 996 vg_common_create_svg_node_helper(child, svg_node);
997 } 997 }
998 } 998 }
999 else 999 else if (efl_isa(vg, EFL_CANVAS_VG_SHAPE_CLASS))
1000 { 1000 {
1001 svg_node = _create_node(parent, SVG_NODE_CUSTOME_COMMAND); 1001 svg_node = _create_node(parent, SVG_NODE_CUSTOME_COMMAND);
1002 evas_vg_shape_path_get(vg, &commands, &points); 1002 evas_vg_shape_path_get(vg, &commands, &points);