コード例 #1
0
ファイル: gc.c プロジェクト: Magister/x11rdp_xorg71
Bool
CreateGCperDepth(int screenNum)
{
    register int i;
    register ScreenPtr pScreen;
    DepthPtr pDepth;
    GCPtr *ppGC;

    pScreen = screenInfo.screens[screenNum];
    pScreen->rgf = 0;
    ppGC = pScreen->GCperDepth;
    /* do depth 1 separately because it's not included in list */
    if (!(ppGC[0] = CreateScratchGC(pScreen, 1)))
	return FALSE;
    ppGC[0]->graphicsExposures = FALSE;
    /* Make sure we don't overflow GCperDepth[] */
    if( pScreen->numDepths > MAXFORMATS )
	    return FALSE;

    pDepth = pScreen->allowedDepths;
    for (i=0; i<pScreen->numDepths; i++, pDepth++)
    {
	if (!(ppGC[i+1] = CreateScratchGC(pScreen, pDepth->depth)))
	{
	    for (; i >= 0; i--)
		(void)FreeGC(ppGC[i], (XID)0);
	    return FALSE;
	}
	ppGC[i+1]->graphicsExposures = FALSE;
    }
    return TRUE;
}
コード例 #2
0
ファイル: gc.c プロジェクト: Magister/x11rdp_xorg71
/*
   sets reasonable defaults 
   if we can get a pre-allocated one, use it and mark it as used.
   if we can't, create one out of whole cloth (The Velveteen GC -- if
   you use it often enough it will become real.)
*/
_X_EXPORT GCPtr
GetScratchGC(register unsigned depth, register ScreenPtr pScreen)
{
    register int i;
    register GCPtr pGC;

    for (i=0; i<=pScreen->numDepths; i++)
        if ( pScreen->GCperDepth[i]->depth == depth &&
	     !(pScreen->rgf & (1L << (i+1)))
	   )
	{
	    pScreen->rgf |= (1L << (i+1));
            pGC = (pScreen->GCperDepth[i]);

	    pGC->alu = GXcopy;
	    pGC->planemask = ~0;
	    pGC->serialNumber = 0;
	    pGC->fgPixel = 0;
	    pGC->bgPixel = 1;
	    pGC->lineWidth = 0;
	    pGC->lineStyle = LineSolid;
	    pGC->capStyle = CapButt;
	    pGC->joinStyle = JoinMiter;
	    pGC->fillStyle = FillSolid;
	    pGC->fillRule = EvenOddRule;
	    pGC->arcMode = ArcChord;
	    pGC->patOrg.x = 0;
	    pGC->patOrg.y = 0;
	    pGC->subWindowMode = ClipByChildren;
	    pGC->graphicsExposures = FALSE;
	    pGC->clipOrg.x = 0;
	    pGC->clipOrg.y = 0;
	    if (pGC->clientClipType != CT_NONE)
		(*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
	    pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
	    return pGC;
	}
    /* if we make it this far, need to roll our own */
    pGC = CreateScratchGC(pScreen, depth);
    if (pGC)
	pGC->graphicsExposures = FALSE;
    return pGC;
}
コード例 #3
0
ファイル: gc.c プロジェクト: jon-turney/xorg-server
/*
   sets reasonable defaults
   if we can get a pre-allocated one, use it and mark it as used.
   if we can't, create one out of whole cloth (The Velveteen GC -- if
   you use it often enough it will become real.)
*/
GCPtr
GetScratchGC(unsigned depth, ScreenPtr pScreen)
{
    int i;
    GCPtr pGC;

    for (i = 0; i <= pScreen->numDepths; i++) {
        pGC = pScreen->GCperDepth[i];
        if (pGC && pGC->depth == depth && !pGC->scratch_inuse) {
            pGC->scratch_inuse = TRUE;

            pGC->alu = GXcopy;
            pGC->planemask = ~0;
            pGC->serialNumber = 0;
            pGC->fgPixel = 0;
            pGC->bgPixel = 1;
            pGC->lineWidth = 0;
            pGC->lineStyle = LineSolid;
            pGC->capStyle = CapButt;
            pGC->joinStyle = JoinMiter;
            pGC->fillStyle = FillSolid;
            pGC->fillRule = EvenOddRule;
            pGC->arcMode = ArcChord;
            pGC->patOrg.x = 0;
            pGC->patOrg.y = 0;
            pGC->subWindowMode = ClipByChildren;
            pGC->graphicsExposures = FALSE;
            pGC->clipOrg.x = 0;
            pGC->clipOrg.y = 0;
            if (pGC->clientClip)
                (*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
            pGC->stateChanges = GCAllBits;
            return pGC;
        }
    }
    /* if we make it this far, need to roll our own */
    return CreateScratchGC(pScreen, depth);
}