vg_common_svg: colors unpremultiplication added before saving into edj file 27/255627/2
authorMira Grudzinska <m.grudzinska@samsung.com>
Sun, 21 Mar 2021 16:38:09 +0000 (17:38 +0100)
committerHermet Park <chuneon.park@samsung.com>
Tue, 23 Mar 2021 05:42:15 +0000 (05:42 +0000)
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

index 7852daa..e6f0223 100644 (file)
@@ -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);