mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 01:48:07 +02:00
path: Recompute flags in _cairo_path_fixed_scale_and_offset
Only fill_maybe_region can change its value because the transformation preserves vertical and horizontal lines, but can move the points and make them integer if they were not or non-integer if they were. Recomputing it is just as easy as checking if all the points are integer and the path is fill_is_rectilinear.
This commit is contained in:
parent
634fcf2c0a
commit
29d5b18cba
1 changed files with 9 additions and 10 deletions
|
|
@ -979,15 +979,8 @@ _cairo_path_fixed_offset_and_scale (cairo_path_fixed_t *path,
|
|||
path->last_move_point.y = _cairo_fixed_mul (scaley, path->last_move_point.y) + offy;
|
||||
path->current_point.x = _cairo_fixed_mul (scalex, path->current_point.x) + offx;
|
||||
path->current_point.y = _cairo_fixed_mul (scaley, path->current_point.y) + offy;
|
||||
/* Recompute an approximation of the flags.
|
||||
* It might be more strict than what is actually needed.
|
||||
*/
|
||||
if (path->fill_maybe_region) {
|
||||
path->fill_maybe_region = _cairo_fixed_is_integer (offx) &&
|
||||
_cairo_fixed_is_integer (offy) &&
|
||||
_cairo_fixed_is_integer (scalex) &&
|
||||
_cairo_fixed_is_integer (scaley);
|
||||
}
|
||||
|
||||
path->fill_maybe_region = TRUE;
|
||||
|
||||
cairo_path_foreach_buf_start (buf, path) {
|
||||
for (i = 0; i < buf->num_points; i++) {
|
||||
|
|
@ -998,12 +991,18 @@ _cairo_path_fixed_offset_and_scale (cairo_path_fixed_t *path,
|
|||
if (scaley != CAIRO_FIXED_ONE)
|
||||
buf->points[i].y = _cairo_fixed_mul (buf->points[i].y, scaley);
|
||||
buf->points[i].y += offy;
|
||||
|
||||
if (path->fill_maybe_region) {
|
||||
path->fill_maybe_region = _cairo_fixed_is_integer (buf->points[i].x) &&
|
||||
_cairo_fixed_is_integer (buf->points[i].y);
|
||||
}
|
||||
}
|
||||
} cairo_path_foreach_buf_end (buf, path);
|
||||
|
||||
path->fill_maybe_region &= path->fill_is_rectilinear;
|
||||
|
||||
path->extents.p1.x = _cairo_fixed_mul (scalex, path->extents.p1.x) + offx;
|
||||
path->extents.p2.x = _cairo_fixed_mul (scalex, path->extents.p2.x) + offx;
|
||||
|
||||
path->extents.p1.y = _cairo_fixed_mul (scaley, path->extents.p1.y) + offy;
|
||||
path->extents.p2.y = _cairo_fixed_mul (scaley, path->extents.p2.y) + offy;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue