summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-26 23:30:02 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-29 17:07:38 +0100
commitf22045bb4b9e700ce223c259ad41403dc7efe81f (patch)
tree282d57ca19a0e229fa45fdb0a5ae654479ae4121
parent92f6f275fcb5407baf908485ffd08b6787b2caf9 (diff)
[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.
-rw-r--r--src/cairo-path-fixed-private.h14
-rw-r--r--src/cairo-surface-fallback.c6
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
@@ -136,6 +136,20 @@ _cairo_path_fixed_fill_is_empty (const cairo_path_fixed_t *path)
}
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)
{
#if WATCH_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);