summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-28 14:09:11 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-28 14:35:42 +0100
commit9921c98df070032e082570f0663f6d3ad0cccd56 (patch)
tree34a6adf3d1059920a1049d7bc082628227a6d8ac
parentc1718f96f520874c1fb2af0eb975c7f548762d34 (diff)
sna: Faster unclipped PolyFillRect
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 9f00fd6a..96f0e050 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4765,17 +4765,41 @@ sna_poly_fill_rect_blt(DrawablePtr drawable,
dy += drawable->y;
sna_damage_add_rectangles(damage, rect, n, dx, dy);
- do {
- b->x1 = rect->x + dx;
- b->y1 = rect->y + dy;
- b->x2 = b->x1 + rect->width;
- b->y2 = b->y1 + rect->height;
- rect++;
- if (++b == last_box) {
- fill.boxes(sna, &fill, boxes, last_box-boxes);
+ if (dx|dy) {
+ do {
+ int nbox = n;
+ if (nbox > ARRAY_SIZE(boxes))
+ nbox = ARRAY_SIZE(boxes);
+ n -= nbox;
+ do {
+ b->x1 = rect->x + dx;
+ b->y1 = rect->y + dy;
+ b->x2 = b->x1 + rect->width;
+ b->y2 = b->y1 + rect->height;
+ b++;
+ rect++;
+ } while (--nbox);
+ fill.boxes(sna, &fill, boxes, b-boxes);
b = boxes;
- }
- } while (--n);
+ } while (n);
+ } else {
+ do {
+ int nbox = n;
+ if (nbox > ARRAY_SIZE(boxes))
+ nbox = ARRAY_SIZE(boxes);
+ n -= nbox;
+ do {
+ b->x1 = rect->x;
+ b->y1 = rect->y;
+ b->x2 = b->x1 + rect->width;
+ b->y2 = b->y1 + rect->height;
+ b++;
+ rect++;
+ } while (--nbox);
+ fill.boxes(sna, &fill, boxes, b-boxes);
+ b = boxes;
+ } while (n);
+ }
} else {
RegionRec clip;