[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.
This commit is contained in:
Behdad Esfahbod 2007-04-13 16:33:07 -04:00
parent fcf49a5613
commit 84c10a79ff

View file

@ -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;