From 49fb1070dd68453addc291864aad562fe05cf901 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Sun, 21 Mar 2021 17:38:09 +0100 Subject: [PATCH] vg_common_svg: colors unpremultiplication added before saving into edj file Colors were premultiplied first when reading from the svg file and second when saving into edj file. As the result svg files with the opacity < 1 could be uncorretly displayed (only when the color and the opacity were given in the same node). Change-Id: If4bc806a88993fdb3ca8a7c78b2a574215cb71f5 --- src/static_libs/vg_common/vg_common_svg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c index 7852daa..e6f0223 100644 --- a/src/static_libs/vg_common/vg_common_svg.c +++ b/src/static_libs/vg_common/vg_common_svg.c @@ -1056,6 +1056,7 @@ _create_gradient_node(Efl_VG *vg) new_stop = calloc(1, sizeof(Evas_Vg_Gradient_Stop)); if (!new_stop) goto oom_error; memcpy(new_stop, stops, sizeof(Evas_Vg_Gradient_Stop)); + evas_color_argb_unpremul(new_stop->a, &new_stop->r, &new_stop->g, &new_stop->b); grad->stops = eina_list_append(grad->stops, new_stop); stops++; } @@ -1130,6 +1131,7 @@ _apply_svg_property(Svg_Node *node, Efl_VG *vg) { evas_vg_node_color_get(vg, &style->fill.paint.r, &style->fill.paint.g, &style->fill.paint.b, &style->fill.opacity); + evas_color_argb_unpremul(style->fill.opacity, &style->fill.paint.r, &style->fill.paint.g, &style->fill.paint.b); } // apply stroke style property @@ -1145,6 +1147,7 @@ _apply_svg_property(Svg_Node *node, Efl_VG *vg) // apply the stroke color evas_vg_shape_stroke_color_get(vg, &style->stroke.paint.r, &style->stroke.paint.g, &style->stroke.paint.b, &style->stroke.opacity); + evas_color_argb_unpremul(style->stroke.opacity, &style->stroke.paint.r, &style->stroke.paint.g, &style->stroke.paint.b); } style->stroke.width = evas_vg_shape_stroke_width_get(vg); -- 2.7.4