static cwPicturePtr cwCreatePicturePrivate(PicturePtr pPicture) { WindowPtr pWindow = (WindowPtr) pPicture->pDrawable; PixmapPtr pPixmap = getCwPixmap(pWindow); int error; cwPicturePtr pPicturePrivate; pPicturePrivate = malloc(sizeof(cwPictureRec)); if (!pPicturePrivate) return NULL; pPicturePrivate->pBackingPicture = CreatePicture(0, &pPixmap->drawable, pPicture->pFormat, 0, 0, serverClient, &error); if (!pPicturePrivate->pBackingPicture) { free(pPicturePrivate); return NULL; } /* * Ensure that this serial number does not match the window's */ pPicturePrivate->serialNumber = pPixmap->drawable.serialNumber; pPicturePrivate->stateChanges = (1 << (CPLastBit + 1)) - 1; setCwPicture(pPicture, pPicturePrivate); return pPicturePrivate; }
static PixmapPtr cwGetWindowPixmap (WindowPtr pWin) { PixmapPtr pPixmap = getCwPixmap (pWin); if (!pPixmap) { ScreenPtr pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE(pScreen, GetWindowPixmap); if (pScreen->GetWindowPixmap) pPixmap = (*pScreen->GetWindowPixmap) (pWin); SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap); } return pPixmap; }
/* Find the real drawable to draw to, and provide offsets that will translate * window coordinates to backing pixmap coordinates. */ DrawablePtr cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off) { PixmapPtr pPixmap; if (pDrawable->type == DRAWABLE_WINDOW && (pPixmap = getCwPixmap ((WindowPtr) pDrawable))) { *x_off = pDrawable->x - pPixmap->screen_x; *y_off = pDrawable->y - pPixmap->screen_y; return &pPixmap->drawable; } else { *x_off = *y_off = 0; return pDrawable; } }
static PicturePtr cwGetBackingPicture(PicturePtr pPicture, int *x_off, int *y_off) { cwPicturePrivate; if (pPicturePrivate) { DrawablePtr pDrawable = pPicture->pDrawable; WindowPtr pWindow = (WindowPtr) pDrawable; PixmapPtr pPixmap = getCwPixmap(pWindow); *x_off = pDrawable->x - pPixmap->screen_x; *y_off = pDrawable->y - pPixmap->screen_y; return pPicturePrivate->pBackingPicture; } else { *x_off = *y_off = 0; return pPicture; } }