From 84c10a79ffd233a953434bd787dcfe57787552f8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 13 Apr 2007 16:33:07 -0400 Subject: [PATCH] [cairo-pattern] Slightly hackish fix for bug #10508 The so-attributed-to-X-server bug was that cairo maps the drawing region to the pattern space, rounds the box, and uploads only that part of the source surface to the X server. Well, this only works for NEAREST filter as any more sophisticated filter needs to sneak a peek at the neighboring pixels around the edges too. The right fix involves taking into account the filter used, and the pattern matrix, but for most cases, a single pixel should be enough. Not sure about scaling down... Anyway, this is just a workaround to get 1.4.4 out of the door. I'll commit a proper fix soon. --- src/cairo-pattern.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index e92d87dc8..af432f2a2 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -1472,11 +1472,16 @@ _cairo_pattern_acquire_surface_for_surface (cairo_surface_pattern_t *pattern, * in a region larger than the surface, but we never * want to clone more than the surface itself, (we * know we're not repeating at this point due to the - * above. */ - x = MAX (0, floor (x1)); - y = MAX (0, floor (y1)); - width = MIN (extents.width, ceil (x2)) - x; - height = MIN (extents.height, ceil (y2)) - y; + * above. + * + * XXX: The one padding here is to account for filter + * radius. It's a workaround right now, until we get a + * proper fix. (see bug #10508) + */ + x = MAX (0, floor (x1) - 1); + y = MAX (0, floor (y1) - 1); + width = MIN (extents.width, ceil (x2) + 1) - x; + height = MIN (extents.height, ceil (y2) + 1) - y; } x += tx; y += ty;