diff --git a/composite/compalloc.c b/composite/compalloc.c index f555411..5aec522 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -459,9 +459,7 @@ static PixmapPtr compNewPixmap (WindowPtr pWin, int x, int y, int w, int h) { ScreenPtr pScreen = pWin->drawable.pScreen; - WindowPtr pParent = pWin->parent; - PixmapPtr pPixmap; - GCPtr pGC; + PixmapPtr pPixmap, pOld; pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth); @@ -470,26 +468,31 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h) pPixmap->screen_x = x; pPixmap->screen_y = y; - - pGC = GetScratchGC (pWin->drawable.depth, pScreen); - - /* - * Copy bits from the parent into the new pixmap so that it will - * have "reasonable" contents in case for background None areas. - */ - if (pGC) - { - XID val = IncludeInferiors; + + pOld = (*pScreen->GetWindowPixmap) (pWin); + + if (pOld->drawable.depth == pPixmap->drawable.depth) { + GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen); + + /* + * Copy bits from the old pixmap into the new pixmap so that it will + * have "reasonable" contents in case for background None areas. + */ + if (pGC) + { + XID val = IncludeInferiors; - ValidateGC(&pPixmap->drawable, pGC); - dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL); - (*pGC->ops->CopyArea) (&pParent->drawable, - &pPixmap->drawable, - pGC, - x - pParent->drawable.x, - y - pParent->drawable.y, - w, h, 0, 0); - FreeScratchGC (pGC); + ValidateGC(&pPixmap->drawable, pGC); + dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL); + + (*pGC->ops->CopyArea) (&pOld->drawable, + &pPixmap->drawable, + pGC, + x - pOld->drawable.x + pOld->screen_x, + y - pOld->drawable.y + pOld->screen_y, + w, h, 0, 0); + FreeScratchGC (pGC); + } } return pPixmap; }