diff options
author | Andrea Canciani <ranma42@gmail.com> | 2010-10-22 22:19:48 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2010-10-29 17:31:23 +0200 |
commit | 9c0e4db570d9de506eb48de0e9a27497b8cf2f61 (patch) | |
tree | 41516b67c5000334f5ff3037336c1a09f1215e25 /src/cairo-path-fixed.c | |
parent | 9d84dff0c6a7be5abf1f931eabe77afca21f04aa (diff) |
path: Recompute flags in _cairo_path_fixed_translate
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 | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index e09426d2b..4ab4e2606 100644 --- a/src/cairo-path-fixed.c +++ b/src/cairo-path-fixed.c @@ -1015,26 +1015,27 @@ _cairo_path_fixed_translate (cairo_path_fixed_t *path, if (offx == 0 && offy == 0) return; - /* 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); - } - path->last_move_point.x += offx; path->last_move_point.y += offy; path->current_point.x += offx; path->current_point.y += offy; + path->fill_maybe_region = TRUE; + cairo_path_foreach_buf_start (buf, path) { - for (i = 0; i < buf->num_points; i++) { - buf->points[i].x += offx; - buf->points[i].y += offy; + for (i = 0; i < buf->num_points; i++) { + buf->points[i].x += offx; + 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 += offx; path->extents.p1.y += offy; path->extents.p2.x += offx; |