summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cairo-xlib-source.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c
index ac0fdf8b..09f824f8 100644
--- a/src/cairo-xlib-source.c
+++ b/src/cairo-xlib-source.c
@@ -920,13 +920,19 @@ surface_source (cairo_xlib_surface_t *dst,
cairo_matrix_t m;
upload = *sample;
- if (_cairo_surface_get_extents (pattern->surface, &limit) &&
- ! _cairo_rectangle_intersect (&upload, &limit))
- {
- if (pattern->base.extend == CAIRO_EXTEND_NONE)
- return alpha_source (dst, 0);
-
- upload = limit;
+ if (_cairo_surface_get_extents (pattern->surface, &limit)) {
+ if (pattern->base.extend == CAIRO_EXTEND_NONE) {
+ if (! _cairo_rectangle_intersect (&upload, &limit))
+ return alpha_source (dst, 0);
+ } else {
+ if (upload.x < limit.x ||
+ upload.x + upload.width > limit.x + limit.width ||
+ upload.y < limit.y ||
+ upload.y + upload.height > limit.y + limit.height)
+ {
+ upload = limit;
+ }
+ }
}
src = (cairo_xlib_surface_t *)