[cairo-commit] src/cairo-path-fill.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Sep 23 15:59:46 PDT 2008
src/cairo-path-fill.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
New commits:
commit 0a4a6213e2ab915098b6fdc8bd2652cd5026599c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Sep 19 21:12:55 2008 +0100
[fill] Check for the most common rectilinear case first.
Avoid the iterative search for the extreme points by first checking the
most likely arrangement (as produced by cairo_rectangle() under no
transformation).
diff --git a/src/cairo-path-fill.c b/src/cairo-path-fill.c
index 7555798..1cef20e 100644
--- a/src/cairo-path-fill.c
+++ b/src/cairo-path-fill.c
@@ -217,15 +217,19 @@ _cairo_path_fixed_fill_rectangle (cairo_path_fixed_t *path,
if (_cairo_path_fixed_is_box (path, NULL)) {
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];
+ bot_right = &p[2];
+ if (top_left->x > bot_right->x || top_left->y > bot_right->y) {
+ int n;
+
+ /* not a simple cairo_rectangle() */
+ for (n = 0; 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);
More information about the cairo-commit
mailing list