summaryrefslogtreecommitdiff
path: root/src/cairo-path-fill.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-09-19 13:29:01 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-09-19 16:59:51 +0100
commit91f0b8b1eac967d4534201794c9ba7880ddfaa17 (patch)
tree805d3ea93eda9546672cefeca0f096de21b7634b /src/cairo-path-fill.c
parente749b58af827e4cc28353bcc6bc4b2ab8d47aaf6 (diff)
downloadcairo-91f0b8b1eac967d4534201794c9ba7880ddfaa17.tar.gz
[fill] Construct trap using rectangle directly.
Avoid the overhead in sorting the edges within _cairo_traps_tessellate_convex_quad() by using our prior knowledge that we have a simple rectangle and construct the trap from the extreme points.
Diffstat (limited to 'src/cairo-path-fill.c')
-rw-r--r--src/cairo-path-fill.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/cairo-path-fill.c b/src/cairo-path-fill.c
index ba3311489..755579883 100644
--- a/src/cairo-path-fill.c
+++ b/src/cairo-path-fill.c
@@ -215,8 +215,20 @@ _cairo_path_fixed_fill_rectangle (cairo_path_fixed_t *path,
cairo_traps_t *traps)
{
if (_cairo_path_fixed_is_box (path, NULL)) {
- return _cairo_traps_tessellate_convex_quad (traps,
- path->buf_head.base.points);
+ cairo_point_t *p = path->buf_head.base.points;
+ cairo_point_t *top_left, *bot_right;
+ int n;
+
+ top_left = &p[0];
+ bot_right = &p[0];
+ for (n = 1; n < 4; n++) {
+ if (p[n].x <= top_left->x && p[n].y <= top_left->y)
+ top_left = &p[n];
+ if (p[n].x >= bot_right->x && p[n].y >= bot_right->y)
+ bot_right = &p[n];
+ }
+
+ return _cairo_traps_tessellate_rectangle (traps, top_left, bot_right);
}
return CAIRO_INT_STATUS_UNSUPPORTED;