sna/accel: Use the PolyFillRect to handle tiled spans

Would be preferrable to duplicate the tiling logic. Leave the task of
reimplementing XAA to another day!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-09-23 11:38:18 +01:00
parent 964c96b181
commit 7f7f95abbf
1 changed files with 31 additions and 2 deletions

View File

@ -1648,6 +1648,9 @@ sna_spans_extents(DrawablePtr drawable, GCPtr gc,
return box_empty(&box);
}
static void
sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect);
static void
sna_fill_spans(DrawablePtr drawable, GCPtr gc, int n,
DDXPointPtr pt, int *width, int sorted)
@ -1670,8 +1673,13 @@ sna_fill_spans(DrawablePtr drawable, GCPtr gc, int n,
goto fallback;
}
if (gc->fillStyle == FillSolid &&
PM_IS_SOLID(drawable, gc->planemask)) {
DBG(("%s: fillStyle=%x [%d], mask=%lx [%d]\n", __FUNCTION__,
gc->fillStyle, gc->fillStyle == FillSolid,
gc->planemask, PM_IS_SOLID(drawable, gc->planemask)));
if (!PM_IS_SOLID(drawable, gc->planemask))
goto fallback;
if (gc->fillStyle == FillSolid) {
struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable);
DBG(("%s: trying solid fill [alu=%d, pixel=%08lx] blt paths\n",
@ -1689,6 +1697,27 @@ sna_fill_spans(DrawablePtr drawable, GCPtr gc, int n,
priv->cpu_bo, &priv->cpu_damage,
gc, n, pt, width, sorted))
return;
} else if (gc->fillStyle == FillTiled) {
xRectangle *rect;
int i;
/* Try converting these to a set of rectangles instead */
DBG(("%s: converting to rectagnles\n", __FUNCTION__));
rect = malloc (n * sizeof (xRectangle));
if (rect == NULL)
return;
for (i = 0; i < n; i++) {
rect[i].x = pt[i].x;
rect[i].width = width[i];
rect[i].y = pt[i].y;
rect[i].height = 1;
}
sna_poly_fill_rect(drawable, gc, n, rect);
free (rect);
return;
}
fallback: