[lasem] <svg> Fix group opacity when using cairo_push_group.



commit f838dae6884e4d230640a980d0e4b4174581a8bd
Author: Emmanuel Pacaud <emmanuel pacaud lapp in2p3 fr>
Date:   Fri Jul 3 10:57:11 2009 +0200

    <svg> Fix group opacity when using cairo_push_group.

 src/lsmsvgview.c          |    4 ++--
 test/svg/misc/opacity.svg |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/src/lsmsvgview.c b/src/lsmsvgview.c
index 648d1ff..0aaed98 100644
--- a/src/lsmsvgview.c
+++ b/src/lsmsvgview.c
@@ -819,14 +819,14 @@ paint (LsmSvgView *view)
 		cairo_push_group (cairo);
 
 	if (_set_color (view, LSM_SVG_VIEW_PAINT_OPERATION_FILL,
-			&fill->paint.paint, fill->opacity.value * group_opacity)) {
+			&fill->paint.paint, fill->opacity.value * (use_group ? 1.0 : group_opacity))) {
 		cairo_set_fill_rule (cairo, fill->rule.value == LSM_SVG_FILL_RULE_EVEN_ODD ?
 				     CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
 		cairo_fill_preserve (cairo);
 	}
 
 	if (_set_color (view, LSM_SVG_VIEW_PAINT_OPERATION_STROKE,
-			&stroke->paint.paint, stroke->opacity.value * group_opacity)) {
+			&stroke->paint.paint, stroke->opacity.value * (use_group ? 1.0 : group_opacity))) {
 		double line_width;
 
 		switch (stroke->line_join.value) {
diff --git a/test/svg/misc/opacity.svg b/test/svg/misc/opacity.svg
new file mode 100644
index 0000000..c234af2
--- /dev/null
+++ b/test/svg/misc/opacity.svg
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   version="1.0"
+   width="200"
+   height="200"
+   id="svg2">
+  <defs
+     id="defs4" />
+  <g
+     id="layer1">
+    <rect
+       width="132.37738"
+       height="119.44991"
+       rx="0"
+       ry="290.93024"
+       x="15.233851"
+       y="21.842253"
+       id="rect3159"
+       style="opacity:1;fill:#0000ff;fill-opacity:0.50196078;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:6.69999981;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50196078;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    <rect
+       width="132.37738"
+       height="119.44991"
+       rx="0"
+       ry="290.93024"
+       x="50.291134"
+       y="61.817455"
+       id="rect2383"
+       style="opacity:0.5;fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:6.69999981;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+  </g>
+</svg>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]