summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-03-07 08:16:50 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-03-10 14:54:38 +0000
commitf0b70ca660416af42be8b3f76f9e38a81dcac464 (patch)
treea530d870f0f3918995d852003bb4cfc4ede9df15
parent928453b1bc5a059a87fbcdba9156d318a0310073 (diff)
sna: Unroll finding bbox of points
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index aff7b343..7be43c77 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -8271,10 +8271,33 @@ sna_poly_point_extents(DrawablePtr drawable, GCPtr gc,
box_add_pt(&box, last.x, last.y);
}
} else {
- while (--n) {
- ++pt;
- box_add_pt(&box, pt->x, pt->y);
+ --n; ++pt;
+ while (n >= 8) {
+ box_add_pt(&box, pt[0].x, pt[0].y);
+ box_add_pt(&box, pt[1].x, pt[1].y);
+ box_add_pt(&box, pt[2].x, pt[2].y);
+ box_add_pt(&box, pt[3].x, pt[3].y);
+ box_add_pt(&box, pt[4].x, pt[4].y);
+ box_add_pt(&box, pt[5].x, pt[5].y);
+ box_add_pt(&box, pt[6].x, pt[6].y);
+ box_add_pt(&box, pt[7].x, pt[7].y);
+ pt += 8;
+ n -= 8;
+ }
+ if (n & 4) {
+ box_add_pt(&box, pt[0].x, pt[0].y);
+ box_add_pt(&box, pt[1].x, pt[1].y);
+ box_add_pt(&box, pt[2].x, pt[2].y);
+ box_add_pt(&box, pt[3].x, pt[3].y);
+ pt += 4;
+ }
+ if (n & 2) {
+ box_add_pt(&box, pt[0].x, pt[0].y);
+ box_add_pt(&box, pt[1].x, pt[1].y);
+ pt += 2;
}
+ if (n & 1)
+ box_add_pt(&box, pt[0].x, pt[0].y);
}
box.x2++;
box.y2++;