_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 committed by Chris Wilson
parent 6ef4bd4ecf
commit 7d7057cf88
6 changed files with 22 additions and 0 deletions

View file

@ -2098,6 +2098,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 */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 243 B