コード例 #1
0
ファイル: cw.c プロジェクト: GrahamCobb/maemo-xsisusb
static void
cwPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;

    SCREEN_PROLOGUE(pScreen, PaintWindowBorder);

    if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) {
	(*pScreen->PaintWindowBorder)(pWin, pRegion,  what);
    } else {
	DrawablePtr pBackingDrawable;
	int x_off, y_off, x_screen, y_screen;

	pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off,
						&y_off);

	x_screen = x_off - pWin->drawable.x;
	y_screen = y_off - pWin->drawable.y;

	REGION_TRANSLATE(pScreen, pRegion, x_screen, y_screen);

	if (pWin->borderIsPixel) {
	    cwFillRegionSolid(pBackingDrawable, pRegion, pWin->border.pixel);
	} else {
	    cwFillRegionTiled(pBackingDrawable, pRegion, pWin->border.pixmap,
			      x_off, y_off);
	}

	REGION_TRANSLATE(pScreen, pRegion, -x_screen, -y_screen);
    }

    SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder);
}
コード例 #2
0
ファイル: cw.c プロジェクト: 4eremuxa/xserver
static void
cwGetImage(DrawablePtr pSrc, int x, int y, int w, int h, unsigned int format,
	   unsigned long planemask, char *pdstLine)
{
    ScreenPtr pScreen = pSrc->pScreen;
    DrawablePtr pBackingDrawable;
    int src_off_x, src_off_y;
    
    SCREEN_PROLOGUE(pScreen, GetImage);

    pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y);

    CW_OFFSET_XY_SRC(x, y);

    (*pScreen->GetImage)(pBackingDrawable, x, y, w, h, format, planemask,
			 pdstLine);

    SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage);
}
コード例 #3
0
ファイル: cw.c プロジェクト: 4eremuxa/xserver
static Bool
cwCreateBackingGC(GCPtr pGC, DrawablePtr pDrawable)
{
    cwGCRec *pPriv = getCwGC(pGC);
    int status, x_off, y_off;
    XID noexpose = xFalse;
    DrawablePtr pBackingDrawable;

    pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
    pPriv->pBackingGC = CreateGC(pBackingDrawable, GCGraphicsExposures,
				 &noexpose, &status, (XID)0, serverClient);
    if (status != Success)
	return FALSE;

    pPriv->serialNumber = 0;
    pPriv->stateChanges = GCAllBits;

    return TRUE;
}
コード例 #4
0
ファイル: cw.c プロジェクト: GrahamCobb/maemo-xsisusb
static void
cwPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;

    SCREEN_PROLOGUE(pScreen, PaintWindowBackground);

    if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) {
	(*pScreen->PaintWindowBackground)(pWin, pRegion, what);
    } else {
	DrawablePtr pBackingDrawable;
	int x_off, y_off, x_screen, y_screen;

	while (pWin->backgroundState == ParentRelative)
	    pWin = pWin->parent;

	pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off,
						&y_off);

	x_screen = x_off - pWin->drawable.x;
	y_screen = y_off - pWin->drawable.y;

	if (pWin && (pWin->backgroundState == BackgroundPixel ||
		pWin->backgroundState == BackgroundPixmap))
	{
	    REGION_TRANSLATE(pScreen, pRegion, x_screen, y_screen);

	    if (pWin->backgroundState == BackgroundPixel) {
		cwFillRegionSolid(pBackingDrawable, pRegion,
				  pWin->background.pixel);
	    } else {
		cwFillRegionTiled(pBackingDrawable, pRegion,
				  pWin->background.pixmap, x_off, y_off);
	    }

	    REGION_TRANSLATE(pScreen, pRegion, -x_screen, -y_screen);
	}
    }

    SCREEN_EPILOGUE(pScreen, PaintWindowBackground, cwPaintWindowBackground);
}
コード例 #5
0
ファイル: cw.c プロジェクト: 4eremuxa/xserver
static void
cwGetSpans(DrawablePtr pSrc, int wMax, DDXPointPtr ppt, int *pwidth,
	   int nspans, char *pdstStart)
{
    ScreenPtr pScreen = pSrc->pScreen;
    DrawablePtr pBackingDrawable;
    int i;
    int src_off_x, src_off_y;
    
    SCREEN_PROLOGUE(pScreen, GetSpans);

    pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y);

    for (i = 0; i < nspans; i++)
	CW_OFFSET_XY_SRC(ppt[i].x, ppt[i].y);

    (*pScreen->GetSpans)(pBackingDrawable, wMax, ppt, pwidth, nspans,
			 pdstStart);

    SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans);
}
コード例 #6
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);
}
コード例 #7
0
ファイル: cw.c プロジェクト: 4eremuxa/xserver
static void
cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;

    SCREEN_PROLOGUE(pScreen, CopyWindow);

    if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) {
	(*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
    } else {
	GCPtr	    pGC;
	BoxPtr	    pExtents;
	int	    x_off, y_off;
	int	    dx, dy;
	PixmapPtr   pBackingPixmap;
	RegionPtr   pClip;
	int	    src_x, src_y, dst_x, dst_y, w, h;

	dx = ptOldOrg.x - pWin->drawable.x;
	dy = ptOldOrg.y - pWin->drawable.y;

	pExtents = RegionExtents(prgnSrc);

	pBackingPixmap = (PixmapPtr) cwGetBackingDrawable((DrawablePtr)pWin,
							  &x_off, &y_off);

	src_x = pExtents->x1 - pBackingPixmap->screen_x;
	src_y = pExtents->y1 - pBackingPixmap->screen_y;
	w = pExtents->x2 - pExtents->x1;
	h = pExtents->y2 - pExtents->y1;
	dst_x = src_x - dx;
	dst_y = src_y - dy;
			       
	/* Translate region (as required by API) */
	RegionTranslate(prgnSrc, -dx, -dy);
	
	pGC = GetScratchGC(pBackingPixmap->drawable.depth, pScreen);
	/*
	 * Copy region to GC as clip, aligning as dest clip
	 */
	pClip = RegionCreate(NULL, 0);
	RegionIntersect(pClip, &pWin->borderClip, prgnSrc);
	RegionTranslate(pClip,
			 -pBackingPixmap->screen_x,
			 -pBackingPixmap->screen_y);
	
	(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);

	ValidateGC(&pBackingPixmap->drawable, pGC);

	(*pGC->ops->CopyArea) (&pBackingPixmap->drawable,
			       &pBackingPixmap->drawable, pGC,
			       src_x, src_y, w, h, dst_x, dst_y);

	(*pGC->funcs->DestroyClip) (pGC);

	FreeScratchGC(pGC);
    }
	
    SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
}
コード例 #8
0
ファイル: cw.c プロジェクト: 4eremuxa/xserver
static void
cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
{
    GCPtr   	  	pBackingGC;
    cwGCPtr		pPriv;
    DrawablePtr		pBackingDrawable;
    int			x_off, y_off;

    pPriv = (cwGCPtr) getCwGC (pGC);

    FUNC_PROLOGUE(pGC, pPriv);

    /*
     * Must call ValidateGC to ensure pGC->pCompositeClip is valid
     */
    (*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable);

    if (!cwDrawableIsRedirWindow(pDrawable)) {
	cwDestroyBackingGC(pGC);
	FUNC_EPILOGUE(pGC, pPriv);
	return;
    } else {
	if (!pPriv->pBackingGC && !cwCreateBackingGC(pGC, pDrawable)) {
	    FUNC_EPILOGUE(pGC, pPriv);
	    return;
	}
    }

    pBackingGC = pPriv->pBackingGC;
    pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);

    pPriv->stateChanges |= stateChanges;

    /*
     * Copy the composite clip into the backing GC if either
     * the drawable clip list has changed or the client has changed
     * the client clip data
     */
    if (pDrawable->serialNumber != pPriv->serialNumber ||
	(pPriv->stateChanges & (GCClipXOrigin|GCClipYOrigin|GCClipMask)))
    {
	ChangeGCVal vals[2];
	RegionPtr   pCompositeClip;

	pCompositeClip = RegionCreate(NULL, 0);
	RegionCopy(pCompositeClip, pGC->pCompositeClip);

	/* Either the drawable has changed, or the clip list in the drawable has
	 * changed.  Copy the new clip list over and set the new translated
	 * offset for it.
	 */
	
	(*pBackingGC->funcs->ChangeClip) (pBackingGC, CT_REGION,
					  (pointer) pCompositeClip, 0);
	
	vals[0].val = x_off - pDrawable->x;
	vals[1].val = y_off - pDrawable->y;
	ChangeGC(NullClient, pBackingGC,
		    (GCClipXOrigin | GCClipYOrigin), vals);

	pPriv->serialNumber = pDrawable->serialNumber;
	/*
	 * Mask off any client clip changes to make sure
	 * the clip list set above remains in effect
	 */
	pPriv->stateChanges &= ~(GCClipXOrigin|GCClipYOrigin|GCClipMask);
    }

    if (pPriv->stateChanges) {
	CopyGC(pGC, pBackingGC, pPriv->stateChanges);
	pPriv->stateChanges = 0;
    }

    if ((pGC->patOrg.x + x_off) != pBackingGC->patOrg.x ||
	(pGC->patOrg.y + y_off) != pBackingGC->patOrg.y)
    {
	ChangeGCVal vals[2];
	vals[0].val = pGC->patOrg.x + x_off;
	vals[1].val = pGC->patOrg.y + y_off;
	ChangeGC(NullClient, pBackingGC,
		    (GCTileStipXOrigin | GCTileStipYOrigin), vals);
    }

    ValidateGC(pBackingDrawable, pBackingGC);

    FUNC_EPILOGUE(pGC, pPriv);
}