diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-01 11:26:54 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-01 20:39:09 +0100 |
commit | c6acf1325833b8679ef09ab74f0cb0fd82a8cd92 (patch) | |
tree | 8c0139ab8c0c47d1efe5f1211f88246a753c9f0e | |
parent | 8029765515399b130bee18db0a2830eb83f47a07 (diff) |
sna/accel: Micro-optimise sna_fill_spans_blt
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 60ac9ddc..e8370507 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1504,10 +1504,11 @@ sna_fill_spans_blt(DrawablePtr drawable, { struct sna *sna = to_sna_from_drawable(drawable); PixmapPtr pixmap = get_drawable_pixmap(drawable); - struct sna_fill_op fill; - BoxPtr extents, clip; - int nclip; + BoxPtr extents; + int nclip = REGION_NUM_RECTS(gc->pCompositeClip); + int need_translation = !gc->miTranslate; int16_t dx, dy; + struct sna_fill_op fill; if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel)) return false; @@ -1525,7 +1526,7 @@ sna_fill_spans_blt(DrawablePtr drawable, int y = pt->y; int X2 = X1 + (int)*width; - if (!gc->miTranslate) { + if (need_translation) { X1 += drawable->x; X2 += drawable->x; y += drawable->y; @@ -1546,22 +1547,19 @@ sna_fill_spans_blt(DrawablePtr drawable, if (X1 >= X2) continue; - nclip = REGION_NUM_RECTS(gc->pCompositeClip); + y += dy; if (nclip == 1) { X1 += dx; - if (X1 < 0) - X1 = 0; X2 += dx; - if (X2 > pixmap->drawable.width) - X2 = pixmap->drawable.width; + assert(X1 >= 0 && X2 <= pixmap->drawable.width); if (X2 > X1) { - fill.blt(sna, &fill, X1, y+dy, X2-X1, 1); + fill.blt(sna, &fill, X1, y, X2-X1, 1); if (damage) { BoxRec box; box.x1 = X1; box.x2 = X2; - box.y1 = y + dy; + box.y1 = y; box.y2 = box.y1 + 1; assert_pixmap_contains_box(pixmap, &box); @@ -1569,8 +1567,9 @@ sna_fill_spans_blt(DrawablePtr drawable, } } } else { - clip = REGION_RECTS(gc->pCompositeClip); - while (nclip--) { + int nc = nclip; + BoxPtr clip = REGION_RECTS(gc->pCompositeClip); + while (nc--) { if (clip->y1 <= y && y < clip->y2) { int x1 = clip->x1; int x2 = clip->x2; @@ -1588,13 +1587,12 @@ sna_fill_spans_blt(DrawablePtr drawable, if (x2 > x1) { fill.blt(sna, &fill, - x1, y + dy, - x2-x1, 1); + x1, y, x2-x1, 1); if (damage) { BoxRec box; box.x1 = x1; - box.y1 = y + dy; + box.y1 = y; box.x2 = x2; box.y2 = box.y1 + 1; |