From f22045bb4b9e700ce223c259ad41403dc7efe81f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 26 Aug 2009 23:30:02 +0100 Subject: [fallback] Include implicit closes in the check for rectilinear paths Fixes test/implicit-close By forgetting the implicit-close when checking for rectilinear paths, we tried to feed the triangle (and other diagclose) into the specialised rectilinear tesselators which completely mishandled that final edge. --- src/cairo-path-fixed-private.h | 14 ++++++++++++++ src/cairo-surface-fallback.c | 6 ++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/cairo-path-fixed-private.h b/src/cairo-path-fixed-private.h index f25a45e2..ce35c9ef 100644 --- a/src/cairo-path-fixed-private.h +++ b/src/cairo-path-fixed-private.h @@ -135,6 +135,20 @@ _cairo_path_fixed_fill_is_empty (const cairo_path_fixed_t *path) return path->is_empty_fill; } +static inline cairo_bool_t +_cairo_path_fixed_is_rectilinear_fill (const cairo_path_fixed_t *path) +{ + if (! path->is_rectilinear) + return FALSE; + + if (! path->has_current_point) + return TRUE; + + /* check whether the implicit close preserves the rectilinear property */ + return path->current_point.x == path->last_move_point.x || + path->current_point.y == path->last_move_point.y; +} + static inline cairo_bool_t _cairo_path_fixed_maybe_fill_region (const cairo_path_fixed_t *path) { diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c index a5a529ca..8fa7fa98 100644 --- a/src/cairo-surface-fallback.c +++ b/src/cairo-surface-fallback.c @@ -1233,6 +1233,7 @@ _cairo_surface_fallback_fill (cairo_surface_t *surface, int num_boxes = ARRAY_LENGTH (boxes_stack); cairo_rectangle_int_t extents; cairo_bool_t is_bounded; + cairo_bool_t is_rectilinear; cairo_status_t status; is_bounded = _cairo_surface_get_extents (surface, &extents); @@ -1286,7 +1287,8 @@ _cairo_surface_fallback_fill (cairo_surface_t *surface, if (path->is_empty_fill) goto DO_TRAPS; - if (path->is_rectilinear) { + is_rectilinear = _cairo_path_fixed_is_rectilinear_fill (path); + if (is_rectilinear) { status = _cairo_path_fixed_fill_rectilinear_to_traps (path, fill_rule, &traps); @@ -1312,7 +1314,7 @@ _cairo_surface_fallback_fill (cairo_surface_t *surface, goto CLEANUP; } - if (path->is_rectilinear) { + if (is_rectilinear) { status = _cairo_bentley_ottmann_tessellate_rectilinear_polygon (&traps, &polygon, fill_rule); -- cgit v1.2.3