[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.
This commit is contained in:
Kai-Uwe Behrmann 2008-09-22 10:10:51 +01:00 committed by Chris Wilson
parent 223e7b9ed0
commit 20be3182ef
2 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -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;