summaryrefslogtreecommitdiff
path: root/src/static_libs
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-04-19 13:56:48 +0900
committerHermet Park <hermetpark@gmail.com>2019-04-19 13:56:49 +0900
commit5403af9629a9cc6805e26ade38ea95c2e0bbdb31 (patch)
tree4180118a397c949b6fc98f320f6643593a22e19e /src/static_libs
parent3715faf96566c73f1c985ce4872845963032ee9f (diff)
vg_common_svg: Prevent duplicate operations for percentage value
Summary: x1, y1, x2 and y2 of Svg_Linear_Gradient structure must be a percentage value.(0 ~ 1) but these variables are reused with efl_gfx_gradient_linear_start/end_set/get and duplicate operations occur. Test Plan: N/A Reviewers: Hermet, smohanty Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8662
Diffstat (limited to 'src/static_libs')
-rw-r--r--src/static_libs/vg_common/vg_common.h1
-rw-r--r--src/static_libs/vg_common/vg_common_svg.c13
2 files changed, 12 insertions, 2 deletions
diff --git a/src/static_libs/vg_common/vg_common.h b/src/static_libs/vg_common/vg_common.h
index ab0cb0d..b1dfa7d 100644
--- a/src/static_libs/vg_common/vg_common.h
+++ b/src/static_libs/vg_common/vg_common.h
@@ -206,6 +206,7 @@ struct _Svg_Style_Gradient
206 Eina_List *stops; // Efl_Gfx_Gradient_Stop 206 Eina_List *stops; // Efl_Gfx_Gradient_Stop
207 Svg_Radial_Gradient *radial; 207 Svg_Radial_Gradient *radial;
208 Svg_Linear_Gradient *linear; 208 Svg_Linear_Gradient *linear;
209 Eina_Bool use_percentage;
209}; 210};
210 211
211struct _Svg_Paint 212struct _Svg_Paint
diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c
index 1c33e64..9f26453 100644
--- a/src/static_libs/vg_common/vg_common_svg.c
+++ b/src/static_libs/vg_common/vg_common_svg.c
@@ -568,8 +568,16 @@ _apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Efl_VG *parent, Vg_F
568 if (g->type == SVG_LINEAR_GRADIENT) 568 if (g->type == SVG_LINEAR_GRADIENT)
569 { 569 {
570 grad_obj = efl_add(EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS, parent); 570 grad_obj = efl_add(EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS, parent);
571 efl_gfx_gradient_linear_start_set(grad_obj, g->linear->x1 * r.w + r.x, g->linear->y1 * r.h + r.y); 571
572 efl_gfx_gradient_linear_end_set(grad_obj, g->linear->x2 * r.w + r.x, g->linear->y2 * r.h + r.y); 572 if (g->use_percentage)
573 {
574 g->linear->x1 = g->linear->x1 * r.w + r.x;
575 g->linear->y1 = g->linear->y1 * r.h + r.y;
576 g->linear->x2 = g->linear->x2 * r.w + r.x;
577 g->linear->y2 = g->linear->y2 * r.h + r.y;
578 }
579 efl_gfx_gradient_linear_start_set(grad_obj, g->linear->x1, g->linear->y1);
580 efl_gfx_gradient_linear_end_set(grad_obj, g->linear->x2, g->linear->y2);
573 } 581 }
574 else if (g->type == SVG_RADIAL_GRADIENT) 582 else if (g->type == SVG_RADIAL_GRADIENT)
575 { 583 {
@@ -911,6 +919,7 @@ _create_gradient_node(Efl_VG *vg)
911 if (!grad->linear) goto oom_error; 919 if (!grad->linear) goto oom_error;
912 efl_gfx_gradient_linear_start_get(vg, &grad->linear->x1, &grad->linear->y1); 920 efl_gfx_gradient_linear_start_get(vg, &grad->linear->x1, &grad->linear->y1);
913 efl_gfx_gradient_linear_end_get(vg, &grad->linear->x2, &grad->linear->y2); 921 efl_gfx_gradient_linear_end_get(vg, &grad->linear->x2, &grad->linear->y2);
922 grad->use_percentage = EINA_FALSE;
914 } 923 }
915 else 924 else
916 { 925 {