mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 19:38:02 +02:00
[SVG] Fix opacity of combined stroke and fill.
When emitting combined stroke and fill, cairo SVG backend was using the opacity two times, instead of using fill-opacity and stroke-opacity, leading to incorrect output. I've updated the mask test reference images for the SVG output, since it seems there's a bug in librsvg when fill-opacity is used in the mask image. I've checked the SVG output with batik, and it looks fine.
This commit is contained in:
parent
5b0a0fe7a2
commit
b68968ffd1
3 changed files with 13 additions and 12 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
/* cairo - a vector graphics library with display and print output
|
/* cairo - a vector graphics library with display and print output
|
||||||
*
|
*
|
||||||
* Copyright © 2004 Red Hat, Inc
|
* Copyright © 2004 Red Hat, Inc
|
||||||
* Copyright © 2005-2006 Emmanuel Pacaud <emmanuel.pacaud@free.fr>
|
* Copyright © 2005-2007 Emmanuel Pacaud <emmanuel.pacaud@free.fr>
|
||||||
* Copyright © 2006 Red Hat, Inc
|
* Copyright © 2006 Red Hat, Inc
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Kristian Høgsberg <krh@redhat.com>
|
* Kristian Høgsberg <krh@redhat.com>
|
||||||
* Emmanuel Pacaud <emmanuel.pacaud@univ-poitiers.fr>
|
* Emmanuel Pacaud <emmanuel.pacaud@free.fr>
|
||||||
* Carl Worth <cworth@cworth.org>
|
* Carl Worth <cworth@cworth.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -1218,15 +1218,14 @@ _cairo_svg_surface_emit_operator (cairo_output_stream_t *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_status_t
|
static cairo_status_t
|
||||||
_cairo_svg_surface_emit_solid_pattern (cairo_svg_surface_t *surface,
|
_cairo_svg_surface_emit_solid_pattern (cairo_svg_surface_t *surface,
|
||||||
cairo_solid_pattern_t *pattern,
|
cairo_solid_pattern_t *pattern,
|
||||||
cairo_output_stream_t *style,
|
cairo_output_stream_t *style,
|
||||||
cairo_bool_t is_stroke)
|
cairo_bool_t is_stroke)
|
||||||
{
|
{
|
||||||
_cairo_output_stream_printf (style,
|
_cairo_output_stream_printf (style, is_stroke ?
|
||||||
"%s: rgb(%f%%,%f%%,%f%%); "
|
"stroke: rgb(%f%%,%f%%,%f%%); stroke-opacity: %f;":
|
||||||
"opacity: %f;",
|
"fill: rgb(%f%%,%f%%,%f%%); fill-opacity: %f;",
|
||||||
is_stroke ? "stroke" : "fill",
|
|
||||||
pattern->color.red * 100.0,
|
pattern->color.red * 100.0,
|
||||||
pattern->color.green * 100.0,
|
pattern->color.green * 100.0,
|
||||||
pattern->color.blue * 100.0,
|
pattern->color.blue * 100.0,
|
||||||
|
|
@ -1678,8 +1677,10 @@ _cairo_svg_surface_emit_radial_pattern (cairo_svg_surface_t *surface,
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_status_t
|
static cairo_status_t
|
||||||
_cairo_svg_surface_emit_pattern (cairo_svg_surface_t *surface, cairo_pattern_t *pattern,
|
_cairo_svg_surface_emit_pattern (cairo_svg_surface_t *surface,
|
||||||
cairo_output_stream_t *output, cairo_bool_t is_stroke)
|
cairo_pattern_t *pattern,
|
||||||
|
cairo_output_stream_t *output,
|
||||||
|
cairo_bool_t is_stroke)
|
||||||
{
|
{
|
||||||
switch (pattern->type) {
|
switch (pattern->type) {
|
||||||
case CAIRO_PATTERN_TYPE_SOLID:
|
case CAIRO_PATTERN_TYPE_SOLID:
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
BIN
test/mask-svg-rgb24-ref.png
Normal file
BIN
test/mask-svg-rgb24-ref.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
Loading…
Add table
Reference in a new issue