diff options
author | Adam Jackson <ajax@redhat.com> | 2018-02-23 16:08:11 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-02-26 10:02:24 -0500 |
commit | 701f3a206d6f71c4754f457e95e2b954cf0b80c7 (patch) | |
tree | 0b0ac5981e2b3db6d317a2d5fb740bebe6e157a6 /render | |
parent | 9339fa87d03204b29d47eb8c9406f701517b3514 (diff) |
render: Simplify miCompositeRects
Make a solid-fill picture for this instead of a 1x1 pixmap. In principle
the backend can accelerate this directly, and we also get to preserve
all the bits of the fill color.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'render')
-rw-r--r-- | render/mirect.c | 63 |
1 files changed, 9 insertions, 54 deletions
diff --git a/render/mirect.c b/render/mirect.c index a36d1d6e3..65f8d5efd 100644 --- a/render/mirect.c +++ b/render/mirect.c @@ -91,8 +91,6 @@ miCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color, int nRect, xRectangle *rects) { - ScreenPtr pScreen = pDst->pDrawable->pScreen; - if (color->alpha == 0xffff) { if (op == PictOpOver) op = PictOpSrc; @@ -108,61 +106,18 @@ miCompositeRects(CARD8 op, pDst->alphaOrigin.x, pDst->alphaOrigin.y); } else { - PictFormatPtr rgbaFormat; - PixmapPtr pPixmap; - PicturePtr pSrc; - xRectangle one; int error; - Pixel pixel; - GCPtr pGC; - ChangeGCVal gcvals[2]; - XID tmpval[1]; - - rgbaFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8); - if (!rgbaFormat) - goto bail1; - - pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, rgbaFormat->depth, - CREATE_PIXMAP_USAGE_SCRATCH); - if (!pPixmap) - goto bail2; - - miRenderColorToPixel(rgbaFormat, color, &pixel); + PicturePtr pSrc = CreateSolidPicture(0, color, &error); - pGC = GetScratchGC(rgbaFormat->depth, pScreen); - if (!pGC) - goto bail3; - gcvals[0].val = GXcopy; - gcvals[1].val = pixel; + if (pSrc) { + while (nRect--) { + CompositePicture(op, pSrc, 0, pDst, 0, 0, 0, 0, + rects->x, rects->y, + rects->width, rects->height); + rects++; + } - ChangeGC(NullClient, pGC, GCFunction | GCForeground, gcvals); - ValidateGC(&pPixmap->drawable, pGC); - one.x = 0; - one.y = 0; - one.width = 1; - one.height = 1; - (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one); - - tmpval[0] = xTrue; - pSrc = CreatePicture(0, &pPixmap->drawable, rgbaFormat, - CPRepeat, tmpval, serverClient, &error); - - if (!pSrc) - goto bail4; - - while (nRect--) { - CompositePicture(op, pSrc, 0, pDst, 0, 0, 0, 0, - rects->x, rects->y, rects->width, rects->height); - rects++; + FreePicture((void *) pSrc, 0); } - - FreePicture((void *) pSrc, 0); - bail4: - FreeScratchGC(pGC); - bail3: - (*pScreen->DestroyPixmap) (pPixmap); - bail2: - bail1: - ; } } |