xserver: Branch 'master'

Adam Jackson ajax at kemper.freedesktop.org
Mon Feb 26 15:16:04 UTC 2018


 render/mirect.c |   63 ++++++++------------------------------------------------
 1 file changed, 9 insertions(+), 54 deletions(-)

New commits:
commit 701f3a206d6f71c4754f457e95e2b954cf0b80c7
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Feb 23 16:08:11 2018 -0500

    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 at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>

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:
-        ;
     }
 }


More information about the xorg-commit mailing list