diff options
author | Kai-Uwe Behrmann <ku.b@gmx.de> | 2008-09-22 10:10:51 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-09-22 12:01:11 +0100 |
commit | 20be3182ef29bb07ffac749f5cf1844b4781e1bb (patch) | |
tree | 802295237965daa3f27ce58248881aa76a8d53e6 | |
parent | 223e7b9ed0053f9569df4bafc7688439aeb12572 (diff) | |
download | cairo-20be3182ef29bb07ffac749f5cf1844b4781e1bb.tar.gz |
[svg] Counteract application of object matrix to mask.
The expected behaviour for masking in Cairo is to set the mask according
to the current active matrix and apply unchanged to the masked surface.
In SVG, the mask element is bound to the masked object and thus the local
matrix from that image object applies to the nested mask as well.
Attached is a small patch for substracting the matrix of a image
surface from the matrix of the mask to comply to Cairo's behaviour.
I did not test for other stuff like vectors or text and would expect this
part is incomplete.
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | src/cairo-svg-surface.c | 9 |
2 files changed, 6 insertions, 4 deletions
@@ -4,6 +4,7 @@ Shawn T. Amundson <amundson@gtk.org> Build fix Olivier Andrieu <oliv__a@users.sourceforge.net> PNG backend Peter Dennis Bartok <peter@novonyx.com> Bug fix for clipping Dave Beckett <dajobe@debian.org> Build fixes, Debian packaging +Kai-Uwe Behrmann <ku.b@gmx.de> SVG bug fixes Christian Biesinger <cbiesinger@web.de> BeOS backend Billy Biggs <vektor@dumbterm.net> Pixman code merge. Optimization. Fixes for subtle rendering bugs. Hans Breuer <hans@breuer.org> win32 bug fixes, build fixes, and improvements diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c index 63b0bfb44..e8567bcb5 100644 --- a/src/cairo-svg-surface.c +++ b/src/cairo-svg-surface.c @@ -1938,6 +1938,7 @@ _cairo_svg_surface_emit_paint (cairo_output_stream_t *output, cairo_svg_surface_t *surface, cairo_operator_t op, cairo_pattern_t *source, + cairo_pattern_t *mask_source, const char *extra_attributes) { cairo_status_t status; @@ -1948,7 +1949,7 @@ _cairo_svg_surface_emit_paint (cairo_output_stream_t *output, surface, (cairo_surface_pattern_t *) source, invalid_pattern_id, - NULL, + mask_source ? &mask_source->matrix :NULL, extra_attributes); _cairo_output_stream_printf (output, @@ -2031,7 +2032,7 @@ _cairo_svg_surface_paint (void *abstract_surface, } } - return _cairo_svg_surface_emit_paint (surface->xml_node, surface, op, source, NULL); + return _cairo_svg_surface_emit_paint (surface->xml_node, surface, op, source, 0, NULL); } static cairo_int_status_t @@ -2077,7 +2078,7 @@ _cairo_svg_surface_mask (void *abstract_surface, "%s", mask_id, discard_filter ? "" : " <g filter=\"url(#alpha)\">\n"); - status = _cairo_svg_surface_emit_paint (mask_stream, surface, op, mask, NULL); + status = _cairo_svg_surface_emit_paint (mask_stream, surface, op, mask, source, NULL); if (status) { cairo_status_t ignore = _cairo_output_stream_destroy (mask_stream); return status; @@ -2096,7 +2097,7 @@ _cairo_svg_surface_mask (void *abstract_surface, snprintf (buffer, sizeof buffer, "mask=\"url(#mask%d)\"", mask_id); - status = _cairo_svg_surface_emit_paint (surface->xml_node, surface, op, source, buffer); + status = _cairo_svg_surface_emit_paint (surface->xml_node, surface, op, source, 0, buffer); if (status) return status; |