Replace screen->rgf scratch GC flags with a bit in each GC.
This eliminates a poorly-named, poorly-documented field from the ScreenRec, using a previously-unused flag bit in each GC instead. Signed-off-by: Jamey Sharp <jamey@minilop.net> Cc: Keith Packard <keithp@keithp.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
5a7275d78a
commit
5754e66044
|
@ -3916,7 +3916,6 @@ AddScreen(
|
||||||
any of the strings pointed to by argv. They may be passed to
|
any of the strings pointed to by argv. They may be passed to
|
||||||
multiple screens.
|
multiple screens.
|
||||||
*/
|
*/
|
||||||
pScreen->rgf = ~0L; /* there are no scratch GCs yet*/
|
|
||||||
WindowTable[i] = NullWindow;
|
WindowTable[i] = NullWindow;
|
||||||
screenInfo.screens[i] = pScreen;
|
screenInfo.screens[i] = pScreen;
|
||||||
screenInfo.numScreens++;
|
screenInfo.numScreens++;
|
||||||
|
|
37
dix/gc.c
37
dix/gc.c
|
@ -537,6 +537,9 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
|
||||||
pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
|
pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
|
||||||
pGC->stipple->refcnt++;
|
pGC->stipple->refcnt++;
|
||||||
|
|
||||||
|
/* this is not a scratch GC */
|
||||||
|
pGC->scratch_inuse = FALSE;
|
||||||
|
|
||||||
/* security creation/labeling check */
|
/* security creation/labeling check */
|
||||||
*pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC,
|
*pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC,
|
||||||
RT_NONE, NULL, DixCreateAccess|DixSetAttrAccess);
|
RT_NONE, NULL, DixCreateAccess|DixSetAttrAccess);
|
||||||
|
@ -844,6 +847,9 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
|
||||||
pGC->lastWinOrg.x = 0;
|
pGC->lastWinOrg.x = 0;
|
||||||
pGC->lastWinOrg.y = 0;
|
pGC->lastWinOrg.y = 0;
|
||||||
|
|
||||||
|
/* scratch GCs in the GCperDepth pool start off unused */
|
||||||
|
pGC->scratch_inuse = FALSE;
|
||||||
|
|
||||||
pGC->stateChanges = GCAllBits;
|
pGC->stateChanges = GCAllBits;
|
||||||
if (!(*pScreen->CreateGC)(pGC))
|
if (!(*pScreen->CreateGC)(pGC))
|
||||||
{
|
{
|
||||||
|
@ -864,8 +870,10 @@ FreeGCperDepth(int screenNum)
|
||||||
ppGC = pScreen->GCperDepth;
|
ppGC = pScreen->GCperDepth;
|
||||||
|
|
||||||
for (i = 0; i <= pScreen->numDepths; i++)
|
for (i = 0; i <= pScreen->numDepths; i++)
|
||||||
|
{
|
||||||
(void)FreeGC(ppGC[i], (XID)0);
|
(void)FreeGC(ppGC[i], (XID)0);
|
||||||
pScreen->rgf = ~0L;
|
ppGC[i] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -878,7 +886,6 @@ CreateGCperDepth(int screenNum)
|
||||||
GCPtr *ppGC;
|
GCPtr *ppGC;
|
||||||
|
|
||||||
pScreen = screenInfo.screens[screenNum];
|
pScreen = screenInfo.screens[screenNum];
|
||||||
pScreen->rgf = 0;
|
|
||||||
ppGC = pScreen->GCperDepth;
|
ppGC = pScreen->GCperDepth;
|
||||||
/* do depth 1 separately because it's not included in list */
|
/* do depth 1 separately because it's not included in list */
|
||||||
if (!(ppGC[0] = CreateScratchGC(pScreen, 1)))
|
if (!(ppGC[0] = CreateScratchGC(pScreen, 1)))
|
||||||
|
@ -1097,12 +1104,11 @@ GetScratchGC(unsigned depth, ScreenPtr pScreen)
|
||||||
GCPtr pGC;
|
GCPtr pGC;
|
||||||
|
|
||||||
for (i=0; i<=pScreen->numDepths; i++)
|
for (i=0; i<=pScreen->numDepths; i++)
|
||||||
if ( pScreen->GCperDepth[i]->depth == depth &&
|
{
|
||||||
!(pScreen->rgf & (1L << (i+1)))
|
pGC = pScreen->GCperDepth[i];
|
||||||
)
|
if (pGC && pGC->depth == depth && !pGC->scratch_inuse)
|
||||||
{
|
{
|
||||||
pScreen->rgf |= (1L << (i+1));
|
pGC->scratch_inuse = TRUE;
|
||||||
pGC = (pScreen->GCperDepth[i]);
|
|
||||||
|
|
||||||
pGC->alu = GXcopy;
|
pGC->alu = GXcopy;
|
||||||
pGC->planemask = ~0;
|
pGC->planemask = ~0;
|
||||||
|
@ -1127,6 +1133,7 @@ GetScratchGC(unsigned depth, ScreenPtr pScreen)
|
||||||
pGC->stateChanges = GCAllBits;
|
pGC->stateChanges = GCAllBits;
|
||||||
return pGC;
|
return pGC;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* if we make it this far, need to roll our own */
|
/* if we make it this far, need to roll our own */
|
||||||
pGC = CreateScratchGC(pScreen, depth);
|
pGC = CreateScratchGC(pScreen, depth);
|
||||||
if (pGC)
|
if (pGC)
|
||||||
|
@ -1142,16 +1149,8 @@ mark it as available.
|
||||||
void
|
void
|
||||||
FreeScratchGC(GCPtr pGC)
|
FreeScratchGC(GCPtr pGC)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pGC->pScreen;
|
if (pGC->scratch_inuse)
|
||||||
int i;
|
pGC->scratch_inuse = FALSE;
|
||||||
|
else
|
||||||
for (i=0; i<=pScreen->numDepths; i++)
|
FreeGC(pGC, (GContext)0);
|
||||||
{
|
|
||||||
if ( pScreen->GCperDepth[i] == pGC)
|
|
||||||
{
|
|
||||||
pScreen->rgf &= ~(1L << (i+1));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void)FreeGC(pGC, (GContext)0);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,6 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
|
||||||
pScreen->saveUnderSupport = NotUseful;
|
pScreen->saveUnderSupport = NotUseful;
|
||||||
pScreen->whitePixel = xnestWhitePixel;
|
pScreen->whitePixel = xnestWhitePixel;
|
||||||
pScreen->blackPixel = xnestBlackPixel;
|
pScreen->blackPixel = xnestBlackPixel;
|
||||||
/* rgf */
|
|
||||||
/* GCperDepth */
|
/* GCperDepth */
|
||||||
/* PixmapPerDepth */
|
/* PixmapPerDepth */
|
||||||
pScreen->devPrivate = NULL;
|
pScreen->devPrivate = NULL;
|
||||||
|
|
|
@ -292,7 +292,8 @@ typedef struct _GC {
|
||||||
unsigned int tileIsPixel:1; /* tile is solid pixel */
|
unsigned int tileIsPixel:1; /* tile is solid pixel */
|
||||||
unsigned int fExpose:1; /* Call exposure handling */
|
unsigned int fExpose:1; /* Call exposure handling */
|
||||||
unsigned int freeCompClip:1; /* Free composite clip */
|
unsigned int freeCompClip:1; /* Free composite clip */
|
||||||
unsigned int unused:14; /* see comment above */
|
unsigned int scratch_inuse:1; /* is this GC in a pool for reuse? */
|
||||||
|
unsigned int unused:13; /* see comment above */
|
||||||
unsigned long planemask;
|
unsigned long planemask;
|
||||||
unsigned long fgPixel;
|
unsigned long fgPixel;
|
||||||
unsigned long bgPixel;
|
unsigned long bgPixel;
|
||||||
|
|
|
@ -455,7 +455,6 @@ typedef struct _Screen {
|
||||||
short minInstalledCmaps, maxInstalledCmaps;
|
short minInstalledCmaps, maxInstalledCmaps;
|
||||||
char backingStoreSupport, saveUnderSupport;
|
char backingStoreSupport, saveUnderSupport;
|
||||||
unsigned long whitePixel, blackPixel;
|
unsigned long whitePixel, blackPixel;
|
||||||
unsigned long rgf; /* array of flags; she's -- HUNGARIAN */
|
|
||||||
GCPtr GCperDepth[MAXFORMATS+1];
|
GCPtr GCperDepth[MAXFORMATS+1];
|
||||||
/* next field is a stipple to use as default in
|
/* next field is a stipple to use as default in
|
||||||
a GC. we don't build default tiles of all depths
|
a GC. we don't build default tiles of all depths
|
||||||
|
|
Loading…
Reference in New Issue