コード例 #1
0
static void
xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
{
    ScrnInfoPtr		scrn = crtc->scrn;
    ScreenPtr		screen = scrn->pScreen;
    WindowPtr		root = WindowTable[screen->myNum];
    PixmapPtr		dst_pixmap = crtc->rotatedPixmap;
    PictFormatPtr	format = compWindowFormat (WindowTable[screen->myNum]);
    int			error;
    PicturePtr		src, dst;
    int			n = REGION_NUM_RECTS(region);
    BoxPtr		b = REGION_RECTS(region);
    XID			include_inferiors = IncludeInferiors;
    
    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;

    while (n--)
    {
	BoxRec	dst_box;

	dst_box = *b;
	PictureTransformBounds (&dst_box, &crtc->framebuffer_to_crtc);
	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);
}
コード例 #2
0
ファイル: xf86Rotate.c プロジェクト: AmesianX/xorg-server
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);
}
コード例 #3
0
ファイル: cw_render.c プロジェクト: csulmone/X11
static void
cwValidatePicture(PicturePtr pPicture, Mask mask)
{
    DrawablePtr pDrawable = pPicture->pDrawable;
    ScreenPtr pScreen = pDrawable->pScreen;

    cwPsDecl(pScreen);
    cwPicturePrivate;

    cwPsUnwrap(ValidatePicture);

    /*
     * Must call ValidatePicture to ensure pPicture->pCompositeClip is valid
     */
    (*ps->ValidatePicture) (pPicture, mask);

    if (!cwDrawableIsRedirWindow(pDrawable)) {
        if (pPicturePrivate)
            cwDestroyPicturePrivate(pPicture);
    }
    else {
        PicturePtr pBackingPicture;
        DrawablePtr pBackingDrawable;
        int x_off, y_off;

        pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);

        if (pPicturePrivate &&
            pPicturePrivate->pBackingPicture->pDrawable != pBackingDrawable) {
            cwDestroyPicturePrivate(pPicture);
            pPicturePrivate = 0;
        }

        if (!pPicturePrivate) {
            pPicturePrivate = cwCreatePicturePrivate(pPicture);
            if (!pPicturePrivate) {
                cwPsWrap(ValidatePicture, cwValidatePicture);
                return;
            }
        }

        pBackingPicture = pPicturePrivate->pBackingPicture;

        /*
         * Always copy transform and filters because there's no
         * indication of when they've changed
         */
        SetPictureTransform(pBackingPicture, pPicture->transform);

        if (pBackingPicture->filter != pPicture->filter ||
            pPicture->filter_nparams > 0) {
            char *filter = PictureGetFilterName(pPicture->filter);

            SetPictureFilter(pBackingPicture,
                             filter, strlen(filter),
                             pPicture->filter_params, pPicture->filter_nparams);
        }

        pPicturePrivate->stateChanges |= mask;

        if (pPicturePrivate->serialNumber != pDrawable->serialNumber ||
            (pPicturePrivate->
             stateChanges & (CPClipXOrigin | CPClipYOrigin | CPClipMask))) {
            SetPictureClipRegion(pBackingPicture, x_off - pDrawable->x,
                                 y_off - pDrawable->y,
                                 pPicture->pCompositeClip);

            pPicturePrivate->serialNumber = pDrawable->serialNumber;
            pPicturePrivate->stateChanges &=
                ~(CPClipXOrigin | CPClipYOrigin | CPClipMask);
        }

        CopyPicture(pPicture, pPicturePrivate->stateChanges, pBackingPicture);

        ValidatePicture(pBackingPicture);
    }
    cwPsWrap(ValidatePicture, cwValidatePicture);
}
コード例 #4
0
ファイル: xf86Rotate.c プロジェクト: GrahamCobb/maemo-xsisusb
static void
xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
{
    ScrnInfoPtr		scrn = crtc->scrn;
    ScreenPtr		screen = scrn->pScreen;
    WindowPtr		root = WindowTable[screen->myNum];
    PixmapPtr		dst_pixmap = crtc->rotatedPixmap;
    PictFormatPtr	format = compWindowFormat (WindowTable[screen->myNum]);
    int			error;
    PicturePtr		src, dst;
    PictTransform	transform;
    int			n = REGION_NUM_RECTS(region);
    BoxPtr		b = REGION_RECTS(region);
    XID			include_inferiors = IncludeInferiors;
    
    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;

    memset (&transform, '\0', sizeof (transform));
    transform.matrix[2][2] = IntToxFixed(1);
    transform.matrix[0][2] = IntToxFixed(crtc->x);
    transform.matrix[1][2] = IntToxFixed(crtc->y);
    switch (crtc->rotation & 0xf) {
    default:
    case RR_Rotate_0:
	transform.matrix[0][0] = IntToxFixed(1);
	transform.matrix[1][1] = IntToxFixed(1);
	break;
    case RR_Rotate_90:
	transform.matrix[0][1] = IntToxFixed(-1);
	transform.matrix[1][0] = IntToxFixed(1);
	transform.matrix[0][2] += IntToxFixed(crtc->mode.VDisplay);
	break;
    case RR_Rotate_180:
	transform.matrix[0][0] = IntToxFixed(-1);
	transform.matrix[1][1] = IntToxFixed(-1);
	transform.matrix[0][2] += IntToxFixed(crtc->mode.HDisplay);
	transform.matrix[1][2] += IntToxFixed(crtc->mode.VDisplay);
	break;
    case RR_Rotate_270:
	transform.matrix[0][1] = IntToxFixed(1);
	transform.matrix[1][0] = IntToxFixed(-1);
	transform.matrix[1][2] += IntToxFixed(crtc->mode.HDisplay);
	break;
    }

    /* handle reflection */
    if (crtc->rotation & RR_Reflect_X)
    {
	/* XXX figure this out */
    }
    if (crtc->rotation & RR_Reflect_Y)
    {
	/* XXX figure this out too */
    }

    error = SetPictureTransform (src, &transform);
    if (error)
	return;

    while (n--)
    {
	BoxRec	dst_box;

	xf86TransformBox (&dst_box, b, crtc->rotation,
			  crtc->x, crtc->y,
			  crtc->mode.HDisplay, crtc->mode.VDisplay);
	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);
}