Beispiel #1
0
static PicturePtr
miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin)
{
    PictFormatPtr pFormat;
    XID subwindow_mode = IncludeInferiors;
    PicturePtr pPicture;
    int error;

    pFormat = PictureWindowFormat(pWin);
    if (!pFormat)
        return 0;
    pPicture = CreatePicture(0, pDraw, pFormat,
                             CPSubwindowMode, &subwindow_mode,
                             serverClient, &error);
    *ppPicture = pPicture;
    return pPicture;
}
Beispiel #2
0
static void
xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region)
{
    ScrnInfoPtr scrn = crtc->scrn;
    ScreenPtr screen = scrn->pScreen;
    WindowPtr root = screen->root;
    PixmapPtr dst_pixmap = crtc->rotatedPixmap;
    PictFormatPtr format = PictureWindowFormat(screen->root);
    int error;
    PicturePtr src, dst;
    int n = RegionNumRects(region);
    BoxPtr b = RegionRects(region);
    XID include_inferiors = IncludeInferiors;

    if (crtc->driverIsPerformingTransform)
        return;

    src = CreatePicture(None,
                        &root->drawable,
                        format,
                        CPSubwindowMode,
                        &include_inferiors, serverClient, &error);
    if (!src)
        return;

    dst = CreatePicture(None,
                        &dst_pixmap->drawable,
                        format, 0L, NULL, serverClient, &error);
    if (!dst)
        return;

    error = SetPictureTransform(src, &crtc->crtc_to_framebuffer);
    if (error)
        return;
    if (crtc->transform_in_use && crtc->filter)
        SetPicturePictFilter(src, crtc->filter, crtc->params, crtc->nparams);

    if (crtc->shadowClear) {
        CompositePicture(PictOpSrc,
                         src, NULL, dst,
                         0, 0, 0, 0, 0, 0,
                         crtc->mode.HDisplay, crtc->mode.VDisplay);
        crtc->shadowClear = FALSE;
    }
    else {
        while (n--) {
            BoxRec dst_box;

            dst_box = *b;
            dst_box.x1 -= crtc->filter_width >> 1;
            dst_box.x2 += crtc->filter_width >> 1;
            dst_box.y1 -= crtc->filter_height >> 1;
            dst_box.y2 += crtc->filter_height >> 1;
            pixman_f_transform_bounds(&crtc->f_framebuffer_to_crtc, &dst_box);
            CompositePicture(PictOpSrc,
                             src, NULL, dst,
                             dst_box.x1, dst_box.y1, 0, 0, dst_box.x1,
                             dst_box.y1, dst_box.x2 - dst_box.x1,
                             dst_box.y2 - dst_box.y1);
            b++;
        }
    }
    FreePicture(src, None);
    FreePicture(dst, None);
}
Beispiel #3
0
static PixmapPtr
compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;
    WindowPtr pParent = pWin->parent;
    PixmapPtr pPixmap;

    pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth,
                                        CREATE_PIXMAP_USAGE_BACKING_PIXMAP);

    if (!pPixmap)
        return 0;

    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);
        }
    }
    else {
        PictFormatPtr pSrcFormat = PictureWindowFormat(pParent);
        PictFormatPtr pDstFormat = PictureWindowFormat(pWin);
        XID inferiors = IncludeInferiors;
        int error;

        PicturePtr pSrcPicture = CreatePicture(None,
                                               &pParent->drawable,
                                               pSrcFormat,
                                               CPSubwindowMode,
                                               &inferiors,
                                               serverClient, &error);

        PicturePtr pDstPicture = CreatePicture(None,
                                               &pPixmap->drawable,
                                               pDstFormat,
                                               0, 0,
                                               serverClient, &error);

        if (pSrcPicture && pDstPicture) {
            CompositePicture(PictOpSrc,
                             pSrcPicture,
                             NULL,
                             pDstPicture,
                             x - pParent->drawable.x,
                             y - pParent->drawable.y, 0, 0, 0, 0, w, h);
        }
        if (pSrcPicture)
            FreePicture(pSrcPicture, 0);
        if (pDstPicture)
            FreePicture(pDstPicture, 0);
    }
    return pPixmap;
}