summaryrefslogtreecommitdiff
path: root/src/cairo-path-fill.c
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2008-02-25 21:06:23 -0500
committerVladimir Vukicevic <vladimir@sleet.local>2008-02-25 21:06:23 -0500
commita4975ab1173957a293aad8ccac51d1e43cab86da (patch)
treeef5c00ad88d977b936a6d7f4e242ab13095baf85 /src/cairo-path-fill.c
parent63711b1d4a61f21db070f30b9c153d0923cc24bb (diff)
downloadcairo-a4975ab1173957a293aad8ccac51d1e43cab86da.tar.gz
[quartz] Optimize path handling where possible
Diffstat (limited to 'src/cairo-path-fill.c')
-rw-r--r--src/cairo-path-fill.c66
1 files changed, 2 insertions, 64 deletions
diff --git a/src/cairo-path-fill.c b/src/cairo-path-fill.c
index 8e4dacad6..ba3311489 100644
--- a/src/cairo-path-fill.c
+++ b/src/cairo-path-fill.c
@@ -214,71 +214,9 @@ static cairo_int_status_t
_cairo_path_fixed_fill_rectangle (cairo_path_fixed_t *path,
cairo_traps_t *traps)
{
- cairo_path_buf_t *buf = &path->buf_head.base;
- int final;
-
- /* Ensure the path has the operators we expect for a rectangular path.
- */
- if (buf == NULL || buf->num_ops < 5)
- return CAIRO_INT_STATUS_UNSUPPORTED;
-
- if (buf->op[0] != CAIRO_PATH_OP_MOVE_TO ||
- buf->op[1] != CAIRO_PATH_OP_LINE_TO ||
- buf->op[2] != CAIRO_PATH_OP_LINE_TO ||
- buf->op[3] != CAIRO_PATH_OP_LINE_TO)
- {
- return CAIRO_INT_STATUS_UNSUPPORTED;
- }
-
- /* Now, there are choices. The rectangle might end with a LINE_TO
- * (to the original point), but this isn't required. If it
- * doesn't, then it must end with a CLOSE_PATH. */
- if (buf->op[4] == CAIRO_PATH_OP_LINE_TO) {
- if (buf->points[4].x != buf->points[0].x ||
- buf->points[4].y != buf->points[0].y)
- {
- return CAIRO_INT_STATUS_UNSUPPORTED;
- }
- } else if (buf->op[4] != CAIRO_PATH_OP_CLOSE_PATH) {
- return CAIRO_INT_STATUS_UNSUPPORTED;
- }
-
- /* Finally, a trailing CLOSE_PATH or MOVE_TO after the rectangle
- * is fine. But anything more than that means we must return
- * unsupported. */
- final = 5;
- if (final < buf->num_ops &&
- buf->op[final] == CAIRO_PATH_OP_CLOSE_PATH)
- {
- final++;
- }
- if (final < buf->num_ops &&
- buf->op[final] == CAIRO_PATH_OP_MOVE_TO)
- {
- final++;
- }
- if (final < buf->num_ops)
- return CAIRO_INT_STATUS_UNSUPPORTED;
-
- /* Now that we've verified the operators, we must ensure that the
- * path coordinates are consistent with a rectangle. There are two
- * choices here. */
- if (buf->points[0].y == buf->points[1].y &&
- buf->points[1].x == buf->points[2].x &&
- buf->points[2].y == buf->points[3].y &&
- buf->points[3].x == buf->points[0].x)
- {
- return _cairo_traps_tessellate_convex_quad (traps,
- buf->points);
- }
-
- if (buf->points[0].x == buf->points[1].x &&
- buf->points[1].y == buf->points[2].y &&
- buf->points[2].x == buf->points[3].x &&
- buf->points[3].y == buf->points[0].y)
- {
+ if (_cairo_path_fixed_is_box (path, NULL)) {
return _cairo_traps_tessellate_convex_quad (traps,
- buf->points);
+ path->buf_head.base.points);
}
return CAIRO_INT_STATUS_UNSUPPORTED;