[PATCH] composite: Don't bother copying the pixmap for ForgetGravity windows (v3)

Keith Packard keithp at keithp.com
Wed Nov 18 21:43:45 PST 2015


"Jasper St. Pierre" <jstpierre at mecheye.net> writes:

> +static Bool
> +needsPixmapCopy(WindowPtr pWin)
> +{
> +    WindowPtr pChild;
> +
> +    if (pWin->bitGravity != ForgetGravity)
> +        return TRUE;
> +
> +    for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
> +        if (needsPixmapCopy(pChild))
> +            return TRUE;
> +
> +    return FALSE;
> +}

I think you can use TraverseTree here; that has the advantage of not
being recursive.

> +
>  static PixmapPtr
>  compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
>  {
> @@ -542,54 +557,56 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
>      pPixmap->screen_x = x;
>      pPixmap->screen_y = y;
>  
> -    if (pParent->drawable.depth == pWin->drawable.depth) {
> -        GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen);
> -
> -        if (pGC) {
> -            ChangeGCVal val;
> -
> -            val.val = IncludeInferiors;
> -            ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
> -            ValidateGC(&pPixmap->drawable, pGC);
> -            (*pGC->ops->CopyArea) (&pParent->drawable,
> -                                   &pPixmap->drawable,
> -                                   pGC,
> -                                   x - pParent->drawable.x,
> -                                   y - pParent->drawable.y, w, h, 0, 0);
> -            FreeScratchGC(pGC);
> +    if (needsPixmapCopy(pWin)) {

I think this part could be replaced with

        if (!needsPixmapCopy(pWin))
                return pPixmap;

That would, at least, be easier to review.

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20151118/152ad558/attachment.sig>


More information about the xorg-devel mailing list