summaryrefslogtreecommitdiff
path: root/src/static_libs
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-07-15 21:22:03 +0900
committerHermet Park <hermetpark@gmail.com>2019-07-15 21:22:49 +0900
commit84fcc5d073c7be9ff4152745fcbc63383cb95dc3 (patch)
treee6e6271bd2d792371727ea7661dd67e01c766757 /src/static_libs
parent01d6683e3293c945840644ff9d5ebd44f286044f (diff)
evas_vg_load_svg: Prevent duplicate operations on radial gradient variables
Summary: This solves the problem of radial gradient being displayed abnormally when the radial gradient variables are 0 to 1. Test Plan: Sample SVG <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"> <defs id="defs11"> <linearGradient id="linearGradient1" x1="0" y1="0" x2="0.2" y2="0.2" spreadMethod="reflect"> <stop style="stop-color:#ff0000;stop-opacity:1;" offset="0"/> <stop style="stop-color:#0000ff;stop-opacity:1;" offset="1"/> </linearGradient> <radialGradient id="radialGradient222" r="0.2" cx="0.3" cy="0.3" spreadMethod="reflect"> <stop style="stop-color:#ffFF00;stop-opacity:1;" offset="0"/> <stop style="stop-color:#00FFff;stop-opacity:1;" offset="1"/> </radialGradient> </defs> <rect x="0" y="0" width="100" height="100" fill="url(#linearGradient1)"/> <rect x="50" y="50" width="50" height="50" fill="url(#radialGradient222)"/> </svg> Reviewers: Hermet, kimcinoo, smohanty Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9312
Diffstat (limited to 'src/static_libs')
-rw-r--r--src/static_libs/vg_common/vg_common_svg.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c
index e753e229d0..20a167c806 100644
--- a/src/static_libs/vg_common/vg_common_svg.c
+++ b/src/static_libs/vg_common/vg_common_svg.c
@@ -618,10 +618,18 @@ _apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Efl_VG *parent, Vg_F
618 int min = (r.h > r.w) ? r.w : r.h; 618 int min = (r.h > r.w) ? r.w : r.h;
619 radius = sqrt(pow(min, 2) + pow(min, 2)) / sqrt(2.0); 619 radius = sqrt(pow(min, 2) + pow(min, 2)) / sqrt(2.0);
620 } 620 }
621 if (g->use_percentage)
622 {
623 g->radial->cx = g->radial->cx * r.w + r.x;
624 g->radial->cy = g->radial->cy * r.h + r.y;
625 g->radial->r = g->radial->r * radius;
626 g->radial->fx = g->radial->fx * r.w + r.x;
627 g->radial->fy = g->radial->fy * r.h + r.y;
628 }
621 grad_obj = efl_add(EFL_CANVAS_VG_GRADIENT_RADIAL_CLASS, parent); 629 grad_obj = efl_add(EFL_CANVAS_VG_GRADIENT_RADIAL_CLASS, parent);
622 efl_gfx_gradient_radial_center_set(grad_obj, g->radial->cx * r.w + r.x, g->radial->cy * r.h + r.y); 630 efl_gfx_gradient_radial_center_set(grad_obj, g->radial->cx, g->radial->cy);
623 efl_gfx_gradient_radial_radius_set(grad_obj, g->radial->r * radius); 631 efl_gfx_gradient_radial_radius_set(grad_obj, g->radial->r);
624 efl_gfx_gradient_radial_focal_set(grad_obj, g->radial->fx * r.w + r.x, g->radial->fy * r.h + r.y); 632 efl_gfx_gradient_radial_focal_set(grad_obj, g->radial->fx, g->radial->fy);
625 633
626 /* in case of objectBoundingBox it need proper scaling */ 634 /* in case of objectBoundingBox it need proper scaling */
627 if (!g->user_space) 635 if (!g->user_space)
@@ -955,7 +963,6 @@ _create_gradient_node(Efl_VG *vg)
955 if (!grad->linear) goto oom_error; 963 if (!grad->linear) goto oom_error;
956 efl_gfx_gradient_linear_start_get(vg, &grad->linear->x1, &grad->linear->y1); 964 efl_gfx_gradient_linear_start_get(vg, &grad->linear->x1, &grad->linear->y1);
957 efl_gfx_gradient_linear_end_get(vg, &grad->linear->x2, &grad->linear->y2); 965 efl_gfx_gradient_linear_end_get(vg, &grad->linear->x2, &grad->linear->y2);
958 grad->use_percentage = EINA_FALSE;
959 } 966 }
960 else 967 else
961 { 968 {
@@ -966,6 +973,7 @@ _create_gradient_node(Efl_VG *vg)
966 efl_gfx_gradient_radial_focal_get(vg, &grad->radial->fx, &grad->radial->fy); 973 efl_gfx_gradient_radial_focal_get(vg, &grad->radial->fx, &grad->radial->fy);
967 grad->radial->r = efl_gfx_gradient_radial_radius_get(vg); 974 grad->radial->r = efl_gfx_gradient_radial_radius_get(vg);
968 } 975 }
976 grad->use_percentage = EINA_FALSE;
969 977
970 return grad; 978 return grad;
971 979