[pattern] Split the translation between the matrix and [xy]_offset

pixman limits the src] co-ordinates (and thus [xy]_offset] to 16bits,
so we need to be careful how much of the translation vector to push into
[xy]_offset. Since the range is the same for both, split the integer
component between the matrix and the offset.

test/scale-offset* now at least shows the source image, even if it is
misplaced.
This commit is contained in:
Chris Wilson 2008-11-05 09:56:02 +00:00
parent d1b8186fd7
commit c95eebc923
5 changed files with 5 additions and 2 deletions

View file

@ -2000,8 +2000,11 @@ _cairo_pattern_acquire_surface_for_surface (const cairo_surface_pattern_t *pat
assert (invert_status == CAIRO_STATUS_SUCCESS);
if (m.x0 != 0. || m.y0 != 0.) {
x = floor (m.x0);
y = floor (m.y0);
/* pixman also limits the [xy]_offset to 16 bits so evenly
* spread the bits between the two.
*/
x = floor (m.x0 / 2);
y = floor (m.y0 / 2);
attr->x_offset -= x;
attr->y_offset -= y;
cairo_matrix_init_translate (&m, x, y);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB