mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-06 16:40:19 +01:00
[pattern] After cloning adjust [xy]_offset if possible.
For the simple case where the pattern matrix only contains an integer
translation then care is taken to convert that to a identity source matrix
with the translation applied to the [xy]_offsets. 5b97ee6525 broke this
guarantee by applying the clone offsets to the source matrix. So when the
source matrix is identity we can simply adjust the [xy]_offsets and
preserve the identity matrix. (This idea can be extended further by
removing any integer translation from the source matrix and storing it in
the [xy]_offsets as a means to extend the limited precision in
pixman_matrix_t - encountered when downscaling large images offset onto
the target surface.)
This commit is contained in:
parent
552cc09e6b
commit
eaa4bd1392
1 changed files with 13 additions and 3 deletions
|
|
@ -1890,10 +1890,20 @@ _cairo_pattern_acquire_surface_for_surface (cairo_surface_pattern_t *pattern,
|
|||
extents.width, extents.height,
|
||||
&x, &y, out);
|
||||
if (status == CAIRO_STATUS_SUCCESS && (x != 0 || y != 0)) {
|
||||
cairo_matrix_t m;
|
||||
if (_cairo_matrix_is_identity (&attr->matrix)) {
|
||||
attr->x_offset -= x;
|
||||
attr->y_offset -= y;
|
||||
} else {
|
||||
cairo_matrix_t m;
|
||||
|
||||
cairo_matrix_init_translate (&m, -x, -y);
|
||||
cairo_matrix_multiply (&attr->matrix, &attr->matrix, &m);
|
||||
x -= attr->x_offset;
|
||||
y -= attr->y_offset;
|
||||
attr->x_offset = 0;
|
||||
attr->y_offset = 0;
|
||||
|
||||
cairo_matrix_init_translate (&m, -x, -y);
|
||||
cairo_matrix_multiply (&attr->matrix, &attr->matrix, &m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue