diff options
author | Russell King <rmk@arm.linux.org.uk> | 2014-09-12 13:28:28 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2014-09-12 13:30:28 +0100 |
commit | 2a47974b0375b8e3467747a19773870e5d6ba010 (patch) | |
tree | 69b856421c74c6d461ea8514eec8f0f0b9490794 /src | |
parent | 36db458287cdd0e59d4f70ca784afd7fc3d03fd0 (diff) |
vivante: fix PolyFillRectSolid()
PolyFillRectSolid() must fill the rectangles in the order provided, and
must not optimise overlaps (due to XOR and similar GC operations.)
Re-architect the solid fill function to fill each rectangle in the
provided order for each clip box.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/vivante_accel.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/src/vivante_accel.c b/src/vivante_accel.c index 83f4915..e9ea63c 100644 --- a/src/vivante_accel.c +++ b/src/vivante_accel.c @@ -845,34 +845,50 @@ Bool vivante_accel_PolyFillRectSolid(DrawablePtr pDrawable, GCPtr pGC, int n, struct vivante *vivante = vivante_get_screen_priv(pDrawable->pScreen); struct vivante_pixmap *vPix; PixmapPtr pPix; - RegionPtr rects; - int off_x, off_y; - Bool ret; + RegionPtr clip; + BoxPtr box; + BoxRec boxes[255], clipBox; + int off_x, off_y, nclip, nb; + Bool ret = TRUE; pPix = vivante_drawable_pixmap_deltas(pDrawable, &off_x, &off_y); vPix = vivante_get_pixmap_priv(pPix); if (!vPix) return FALSE; - /* Convert the rectangles to a region */ - rects = RegionFromRects(n, prect, CT_UNSORTED); + clip = fbGetCompositeClip(pGC); + clipBox = *RegionExtents(clip); - /* Translate them for the drawable position */ - RegionTranslate(rects, pDrawable->x, pDrawable->y); + nb = 0; + while (n--) { + BoxRec full_rect; - /* Intersect them with the clipping region */ - RegionIntersect(rects, rects, fbGetCompositeClip(pGC)); + full_rect.x1 = prect->x + pDrawable->x; + full_rect.y1 = prect->y + pDrawable->y; + full_rect.x2 = full_rect.x1 + prect->width; + full_rect.y2 = full_rect.y1 + prect->height; - if (RegionNumRects(rects)) { - ret = vivante_fill(vivante, vPix, pGC, RegionExtents(rects), - RegionRects(rects), RegionNumRects(rects), - off_x, off_y); - } else { - ret = TRUE; - } + prect++; - RegionUninit(rects); - RegionDestroy(rects); + for (box = RegionRects(clip), nclip = RegionNumRects(clip); + nclip; nclip--, box++) { + if (BoxClip(&boxes[nb], &full_rect, box)) + continue; + + if (++nb > 254) { + ret = vivante_fill(vivante, vPix, pGC, &clipBox, + boxes, nb, off_x, off_y); + nb = 0; + if (!ret) + break; + } + } + if (!ret) + break; + } + if (nb) + ret = vivante_fill(vivante, vPix, pGC, &clipBox, + boxes, nb, off_x, off_y); return ret; } |