[PATCH v2 4/4] composite: Copy the window contents back from the pixmap

Keith Packard keithp at keithp.com
Mon Dec 27 10:00:30 PST 2010


On Mon, 27 Dec 2010 14:40:14 +0000, Daniel Stone <daniel at fooishbar.org> wrote:
> Hi,
> 
> On Mon, Dec 27, 2010 at 03:24:13PM +0200, ville.syrjala at nokia.com wrote:
> > +void
> > +compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap)
> > +{
> > +    ScreenPtr pScreen = pWin->drawable.pScreen;
> > +    WindowPtr pParent = pWin->parent;
> > +
> > +    if (pParent->drawable.depth == pWin->drawable.depth) {
> > +	GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen);
> > +	int bw = (int) pWin->borderWidth;
> > +	int x = bw;
> > +	int y = bw;
> > +	int w = pWin->drawable.width;
> > +	int h = pWin->drawable.height;
> > +
> > +	if (pGC) {
> > +	    ChangeGCVal val;
> > +	    val.val = IncludeInferiors;
> > +	    ChangeGC (NullClient, pGC, GCSubwindowMode, &val);
> > +	    ValidateGC(&pWin->drawable, pGC);
> > +	    (*pGC->ops->CopyArea) (&pPixmap->drawable,
> > +				   &pWin->drawable,
> > +				   pGC,
> > +				   x, y, w, h, 0, 0);
> > +	    FreeScratchGC (pGC);
> > +	}
> > +    }
> > +}
> 
> It might be nice to get the Render fallback path for non-matching depths
> here; aside from that, for the entire series:

What's confusing here is that there is a test for matching depth, but
no 'else' branch to cover the other case. I don't think this test is
needed as the pixmap was the previous window pixmap, and depths for that
must match the window depth. If that wasn't the case, then all
drawing to windows would fail, as Pictures and GCs are validated against
the depth of the window, not the pixmap.

Seems like simply removing the test would be fine; it's not like you're
requiring some new invariant in the code here.

(otherwise, this patch sequence is gonna be nice to merge :-)

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101227/798b5bf6/attachment-0001.pgp>


More information about the xorg-devel mailing list