summaryrefslogtreecommitdiff
path: root/src/static_libs/vg_common
diff options
context:
space:
mode:
authorVitalii Vorobiov <vi.vorobiov@samsung.com>2017-02-22 13:02:31 +0200
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-07 11:54:09 +0900
commit6bf5d9d96ef07dcd12f5c9e7ceaa1dbcca046206 (patch)
treea5cd44abe6e649f6c0aa009c9ad4e07d0187daad /src/static_libs/vg_common
parentf81f031ceb799f22bd8b6ea216a9b565244af12c (diff)
svg_parse: parse correct values for radialGradient
Especially Radius calculation which was a huge pain to find formula within SVG documentations!
Diffstat (limited to 'src/static_libs/vg_common')
-rw-r--r--src/static_libs/vg_common/vg_common.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/static_libs/vg_common/vg_common.c b/src/static_libs/vg_common/vg_common.c
index eb6c992652..7b33053ed0 100644
--- a/src/static_libs/vg_common/vg_common.c
+++ b/src/static_libs/vg_common/vg_common.c
@@ -573,10 +573,16 @@ _apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Vg_File_Data *vg_dat
573 } 573 }
574 else if (g->type == SVG_RADIAL_GRADIENT) 574 else if (g->type == SVG_RADIAL_GRADIENT)
575 { 575 {
576 /**
577 * That is according to Units in here
578 *
579 * https://www.w3.org/TR/2015/WD-SVG2-20150915/coords.html
580 */
581 int radius = sqrt(pow(r.h, 2) + pow(r.w, 2)) / sqrt(2.0);
576 grad_obj = evas_vg_gradient_radial_add(NULL); 582 grad_obj = evas_vg_gradient_radial_add(NULL);
577 evas_vg_gradient_radial_center_set(grad_obj, g->radial->cx, g->radial->cy); 583 evas_vg_gradient_radial_center_set(grad_obj, g->radial->cx * r.w + r.x, g->radial->cy * r.h + r.y);
578 evas_vg_gradient_radial_radius_set(grad_obj, g->radial->r); 584 evas_vg_gradient_radial_radius_set(grad_obj, g->radial->r * radius);
579 evas_vg_gradient_radial_focal_set(grad_obj, g->radial->fx, g->radial->fy); 585 evas_vg_gradient_radial_focal_set(grad_obj, g->radial->fx * r.w + r.x, g->radial->fy * r.h + r.y);
580 } 586 }
581 else 587 else
582 { 588 {