diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 5c1a02dcc..60cd4a35f 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -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 */ diff --git a/test/paint-source-alpha-svg11-ref.png b/test/paint-source-alpha-svg11-ref.png index 3b3a990c6..8736d44ab 100644 Binary files a/test/paint-source-alpha-svg11-ref.png and b/test/paint-source-alpha-svg11-ref.png differ diff --git a/test/scale-source-surface-paint-svg11-argb32-ref.png b/test/scale-source-surface-paint-svg11-argb32-ref.png index de274f95d..ed946d4d4 100644 Binary files a/test/scale-source-surface-paint-svg11-argb32-ref.png and b/test/scale-source-surface-paint-svg11-argb32-ref.png differ diff --git a/test/scale-source-surface-paint-svg11-rgb24-ref.png b/test/scale-source-surface-paint-svg11-rgb24-ref.png index 099b8a0d3..d424dce08 100644 Binary files a/test/scale-source-surface-paint-svg11-rgb24-ref.png and b/test/scale-source-surface-paint-svg11-rgb24-ref.png differ diff --git a/test/scale-source-surface-paint-svg12-argb32-ref.png b/test/scale-source-surface-paint-svg12-argb32-ref.png index de274f95d..ed946d4d4 100644 Binary files a/test/scale-source-surface-paint-svg12-argb32-ref.png and b/test/scale-source-surface-paint-svg12-argb32-ref.png differ diff --git a/test/scale-source-surface-paint-svg12-rgb24-ref.png b/test/scale-source-surface-paint-svg12-rgb24-ref.png index 099b8a0d3..d424dce08 100644 Binary files a/test/scale-source-surface-paint-svg12-rgb24-ref.png and b/test/scale-source-surface-paint-svg12-rgb24-ref.png differ