diff options
author | Andrea Canciani <ranma42@gmail.com> | 2010-10-28 18:38:50 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2010-10-29 17:31:23 +0200 |
commit | 29d5b18cba05357dc4885447035e65f93e7d7728 (patch) | |
tree | 332968e01f9f0864e46a56e2f98ada87dec8b09a /src/cairo-path-fixed.c | |
parent | 634fcf2c0a66b342ae81faa0e0a75ae72491a313 (diff) |
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.
Diffstat (limited to 'src/cairo-path-fixed.c')
-rw-r--r-- | src/cairo-path-fixed.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index 4fdcfe0a5..7ee910425 100644 --- a/src/cairo-path-fixed.c +++ b/src/cairo-path-fixed.c @@ -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; } |