summaryrefslogtreecommitdiff
path: root/src/cairo-path-fill.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-16 12:46:20 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-29 08:08:38 +0100
commit33ef32af4e7adce41f035ee378279c19577469b0 (patch)
tree3dce70d995e239b8d28edd817f18849ae2ee52b1 /src/cairo-path-fill.c
parentab035ab2c7bec254fc94d6391398905b5039e777 (diff)
downloadcairo-33ef32af4e7adce41f035ee378279c19577469b0.tar.gz
[clip] Use the rectangular tessellator to extract boxes
Diffstat (limited to 'src/cairo-path-fill.c')
-rw-r--r--src/cairo-path-fill.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/cairo-path-fill.c b/src/cairo-path-fill.c
index 870a987fd..53350e8d9 100644
--- a/src/cairo-path-fill.c
+++ b/src/cairo-path-fill.c
@@ -176,6 +176,20 @@ _cairo_path_fixed_fill_rectilinear_tessellate_to_region (const cairo_path_fixed_
cairo_status_t status;
cairo_region_t *region;
+ /* first try to bypass fill-to-polygon */
+ _cairo_traps_init (&traps);
+ status = _cairo_path_fixed_fill_rectilinear_to_traps (path,
+ fill_rule,
+ &traps);
+ if (_cairo_status_is_error (status))
+ goto CLEANUP_TRAPS;
+
+ if (status == CAIRO_STATUS_SUCCESS) {
+ status = _cairo_traps_extract_region (&traps, &region);
+ goto CLEANUP_TRAPS;
+ }
+
+ /* path is not rectangular, try extracting clipped rectilinear edges */
_cairo_polygon_init (&polygon);
if (extents != NULL) {
_cairo_box_from_rectangle (&box, extents);
@@ -190,20 +204,20 @@ _cairo_path_fixed_fill_rectilinear_tessellate_to_region (const cairo_path_fixed_
if (polygon.num_edges == 0) {
region = cairo_region_create ();
} else {
- _cairo_traps_init (&traps);
-
- status = _cairo_bentley_ottmann_tessellate_rectilinear_polygon (&traps,
- &polygon,
- fill_rule);
+ status =
+ _cairo_bentley_ottmann_tessellate_rectilinear_polygon (&traps,
+ &polygon,
+ fill_rule);
if (likely (status == CAIRO_STATUS_SUCCESS))
status = _cairo_traps_extract_region (&traps, &region);
-
- _cairo_traps_fini (&traps);
}
CLEANUP_POLYGON:
_cairo_polygon_fini (&polygon);
+ CLEANUP_TRAPS:
+ _cairo_traps_fini (&traps);
+
if (unlikely (status)) { /* XXX _cairo_region_create_in_error() */
region = cairo_region_create ();
if (likely (region->status) == CAIRO_STATUS_SUCCESS)
@@ -230,6 +244,7 @@ _cairo_path_fixed_fill_rectilinear_to_region (const cairo_path_fixed_t *path,
cairo_region_t *region = NULL;
assert (path->maybe_fill_region);
+ assert (! path->is_empty_fill);
if (_cairo_path_fixed_is_box (path, &box)) {
if (box.p1.x > box.p2.x) {