_cairo_pattern_get_extents: Fix to allow for expansion based on filter

This fixes the filter-bilinear-extents test case and the
related bug entry:

	bad clipping with EXTEND_NONE
	http://bugs.freedesktop.org/show_bug.cgi?id=15349

Though there are still differences in the PDF and PostScript
backends, (primarily because we can't capture cairo's filter
modes in those file formats).
This commit is contained in:
Carl Worth 2008-04-04 19:00:28 -07:00
parent 04608952e2
commit 731e121c80

View file

@ -1991,6 +1991,28 @@ _cairo_pattern_get_extents (cairo_pattern_t *pattern,
x2 = x1 + surface_extents.width;
y2 = y1 + surface_extents.height;
/* The filter can effectively enlarge the extents of the
* pattern, so extend as necessary. Note: We aren't doing any
* backend-specific querying of filter box sizes at this time,
* (since currently no specific backends that could do custom
* filters are calling _cairo_pattern_get_extents). */
switch (pattern->filter) {
case CAIRO_FILTER_GOOD:
case CAIRO_FILTER_BEST:
case CAIRO_FILTER_BILINEAR:
x1 -= 0.5;
y1 -= 0.5;
x2 += 0.5;
y2 += 0.5;
break;
case CAIRO_FILTER_FAST:
case CAIRO_FILTER_NEAREST:
case CAIRO_FILTER_GAUSSIAN:
default:
/* Nothing to do */
break;
}
imatrix = pattern->matrix;
status = cairo_matrix_invert (&imatrix);
/* cairo_pattern_set_matrix ensures the matrix is invertible */