Skip to content

Commit

Permalink
dixChangeGC callers: Use ChangeGCVal instead of XID almost everywhere.
Browse files Browse the repository at this point in the history
The exceptions are ProcChangeGC and CreateGC.

Signed-off-by: Jamey Sharp <[email protected]>
Reviewed-by: Keith Packard <[email protected]>
  • Loading branch information
jameysharp committed May 14, 2010
1 parent 95728ca commit e2929db
Show file tree
Hide file tree
Showing 22 changed files with 181 additions and 164 deletions.
5 changes: 3 additions & 2 deletions composite/compalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,11 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
*/
if (pGC)
{
XID val = IncludeInferiors;
ChangeGCVal val;
val.val = IncludeInferiors;

ValidateGC(&pPixmap->drawable, pGC);
dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL);
dixChangeGC (serverClient, pGC, GCSubwindowMode, NULL, &val);
(*pGC->ops->CopyArea) (&pParent->drawable,
&pPixmap->drawable,
pGC,
Expand Down
14 changes: 9 additions & 5 deletions dix/dixfonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,

#define TextEltHeader 2
#define FontShiftSize 5
static XID clearGC[] = { CT_NONE };
static ChangeGCVal clearGC[] = { { .ptr = NullPixmap } };
#define clearGCmask (GCClipMask)

int
Expand Down Expand Up @@ -1261,7 +1261,9 @@ doPolyText(ClientPtr client, PTclosurePtr c)
{
if (pFont != c->pGC->font && c->pDraw)
{
dixChangeGC(NullClient, c->pGC, GCFont, &fid, NULL);
ChangeGCVal val;
val.ptr = pFont;
dixChangeGC(NullClient, c->pGC, GCFont, NULL, &val);
ValidateGC(c->pDraw, c->pGC);
if (c->reqType == X_PolyText8)
c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
Expand Down Expand Up @@ -1404,7 +1406,9 @@ doPolyText(ClientPtr client, PTclosurePtr c)
/* Step 4 */
if (pFont != origGC->font)
{
dixChangeGC(NullClient, origGC, GCFont, &fid, NULL);
ChangeGCVal val;
val.ptr = pFont;
dixChangeGC(NullClient, origGC, GCFont, NULL, &val);
ValidateGC(c->pDraw, origGC);
}

Expand All @@ -1423,7 +1427,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
if (c->slept)
{
ClientWakeup(c->client);
dixChangeGC(NullClient, c->pGC, clearGCmask, clearGC, NULL);
dixChangeGC(NullClient, c->pGC, clearGCmask, NULL, clearGC);

/* Unreference the font from the scratch GC */
CloseFont(c->pGC->font, (Font)0);
Expand Down Expand Up @@ -1580,7 +1584,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
if (c->slept)
{
ClientWakeup(c->client);
dixChangeGC(NullClient, c->pGC, clearGCmask, clearGC, NULL);
dixChangeGC(NullClient, c->pGC, clearGCmask, NULL, clearGC);

/* Unreference the font from the scratch GC */
CloseFont(c->pGC->font, (Font)0);
Expand Down
18 changes: 10 additions & 8 deletions dix/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
static Bool
CreateDefaultTile (GCPtr pGC)
{
XID tmpval[3];
ChangeGCVal tmpval[3];
PixmapPtr pTile;
GCPtr pgcScratch;
xRectangle rect;
Expand All @@ -614,10 +614,10 @@ CreateDefaultTile (GCPtr pGC)
FreeScratchGC(pgcScratch);
return FALSE;
}
tmpval[0] = GXcopy;
tmpval[1] = pGC->tile.pixel;
tmpval[2] = FillSolid;
(void)dixChangeGC(NullClient, pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval, NULL);
tmpval[0].val = GXcopy;
tmpval[1].val = pGC->tile.pixel;
tmpval[2].val = FillSolid;
(void)dixChangeGC(NullClient, pgcScratch, GCFunction | GCForeground | GCFillStyle, NULL, tmpval);
ValidateGC((DrawablePtr)pTile, pgcScratch);
rect.x = 0;
rect.y = 0;
Expand Down Expand Up @@ -935,7 +935,7 @@ Bool
CreateDefaultStipple(int screenNum)
{
ScreenPtr pScreen;
XID tmpval[3];
ChangeGCVal tmpval[3];
xRectangle rect;
CARD16 w, h;
GCPtr pgcScratch;
Expand All @@ -949,14 +949,16 @@ CreateDefaultStipple(int screenNum)
(*pScreen->CreatePixmap)(pScreen, w, h, 1, 0)))
return FALSE;
/* fill stipple with 1 */
tmpval[0] = GXcopy; tmpval[1] = 1; tmpval[2] = FillSolid;
tmpval[0].val = GXcopy;
tmpval[1].val = 1;
tmpval[2].val = FillSolid;
pgcScratch = GetScratchGC(1, pScreen);
if (!pgcScratch)
{
(*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
return FALSE;
}
(void)dixChangeGC(NullClient, pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval, NULL);
(void)dixChangeGC(NullClient, pgcScratch, GCFunction|GCForeground|GCFillStyle, NULL, tmpval);
ValidateGC((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch);
rect.x = 0;
rect.y = 0;
Expand Down
8 changes: 4 additions & 4 deletions dix/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ MakeRootTile(WindowPtr pWin)
FatalError("could not create root tile");

{
CARD32 attributes[2];
ChangeGCVal attributes[2];

attributes[0] = pScreen->whitePixel;
attributes[1] = pScreen->blackPixel;
attributes[0].val = pScreen->whitePixel;
attributes[1].val = pScreen->blackPixel;

(void)dixChangeGC(NullClient, pGC, GCForeground | GCBackground, attributes, NULL);
(void)dixChangeGC(NullClient, pGC, GCForeground | GCBackground, NULL, attributes);
}

ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
Expand Down
4 changes: 3 additions & 1 deletion fb/fbseg.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ fbSetFg (DrawablePtr pDrawable,
{
if (fg != pGC->fgPixel)
{
dixChangeGC (NullClient, pGC, GCForeground, &fg, NULL);
ChangeGCVal val;
val.val = fg;
dixChangeGC (NullClient, pGC, GCForeground, NULL, &val);
ValidateGC (pDrawable, pGC);
}
}
Expand Down
16 changes: 5 additions & 11 deletions glx/glxdriswrast.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,6 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
return &context->base;
}

static void
glxChangeGC(GCPtr gc, BITS32 mask, CARD32 val)
{
CARD32 v[1];
v[0] = val;
dixChangeGC(NullClient, gc, mask, v, NULL);
}

static __GLXdrawable *
__glXDRIscreenCreateDrawable(ClientPtr client,
__GLXscreen *screen,
Expand All @@ -309,6 +301,7 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
XID glxDrawId,
__GLXconfig *glxConfig)
{
ChangeGCVal gcvals[2];
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
__GLXDRIdrawable *private;
Expand All @@ -333,9 +326,10 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private->gc = CreateScratchGC(pScreen, pDraw->depth);
private->swapgc = CreateScratchGC(pScreen, pDraw->depth);

glxChangeGC(private->gc, GCFunction, GXcopy);
glxChangeGC(private->swapgc, GCFunction, GXcopy);
glxChangeGC(private->swapgc, GCGraphicsExposures, FALSE);
gcvals[0].val = GXcopy;
dixChangeGC(NullClient, private->gc, GCFunction, NULL, gcvals);
gcvals[1].val = FALSE;
dixChangeGC(NullClient, private->gc, GCFunction | GCGraphicsExposures, NULL, gcvals);

private->driDrawable =
(*driScreen->swrast->createNewDrawable)(driScreen->driScreen,
Expand Down
18 changes: 9 additions & 9 deletions hw/kdrive/ephyr/ephyr_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ ephyrPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
CARD32 tmpval[3];
ChangeGCVal tmpval[3];

ephyrPreparePipelinedAccess(pPix, EXA_PREPARE_DEST);

fakexa->pDst = pPix;
fakexa->pGC = GetScratchGC(pPix->drawable.depth, pScreen);

tmpval[0] = alu;
tmpval[1] = pm;
tmpval[2] = fg;
dixChangeGC(NullClient, fakexa->pGC, GCFunction | GCPlaneMask | GCForeground, tmpval, NULL);
tmpval[0].val = alu;
tmpval[1].val = pm;
tmpval[2].val = fg;
dixChangeGC(NullClient, fakexa->pGC, GCFunction | GCPlaneMask | GCForeground, NULL, tmpval);

ValidateGC(&pPix->drawable, fakexa->pGC);

Expand Down Expand Up @@ -161,7 +161,7 @@ ephyrPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu,
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
CARD32 tmpval[2];
ChangeGCVal tmpval[2];

ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);
ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC);
Expand All @@ -170,9 +170,9 @@ ephyrPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu,
fakexa->pDst = pDst;
fakexa->pGC = GetScratchGC(pDst->drawable.depth, pScreen);

tmpval[0] = alu;
tmpval[1] = pm;
dixChangeGC (NullClient, fakexa->pGC, GCFunction | GCPlaneMask, tmpval, NULL);
tmpval[0].val = alu;
tmpval[1].val = pm;
dixChangeGC (NullClient, fakexa->pGC, GCFunction | GCPlaneMask, NULL, tmpval);

ValidateGC(&pDst->drawable, fakexa->pGC);

Expand Down
8 changes: 4 additions & 4 deletions hw/kdrive/src/kxv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ void
KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
{
GCPtr pGC;
CARD32 val[2];
ChangeGCVal val[2];
xRectangle *rects, *r;
BoxPtr pBox = REGION_RECTS (pRgn);
int nBox = REGION_NUM_RECTS (pRgn);
Expand All @@ -1890,9 +1890,9 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
if (!pGC)
goto bail1;

val[0] = fg;
val[1] = IncludeInferiors;
dixChangeGC (NullClient, pGC, GCForeground|GCSubwindowMode, val, NULL);
val[0].val = fg;
val[1].val = IncludeInferiors;
dixChangeGC (NullClient, pGC, GCForeground|GCSubwindowMode, NULL, val);

ValidateGC (pDraw, pGC);

Expand Down
15 changes: 8 additions & 7 deletions hw/xfree86/common/xf86xv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,6 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
WindowPtr pWin = (WindowPtr)pDraw;
XF86XVWindowPtr pPriv = GET_XF86XV_WINDOW(pWin);
GCPtr pGC = NULL;
XID pval[2];
BoxPtr pbox = REGION_RECTS(clipboxes);
int i, nbox = REGION_NUM_RECTS(clipboxes);
xRectangle *rects;
Expand All @@ -1846,6 +1845,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)

if(!pGC) {
int status;
XID pval[2];
pval[0] = key;
pval[1] = IncludeInferiors;
pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status,
Expand All @@ -1854,8 +1854,9 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
ValidateGC(pDraw, pGC);
if (pPriv) pPriv->pGC = pGC;
} else if (key != pGC->fgPixel){
pval[0] = key;
dixChangeGC(NullClient, pGC, GCForeground, pval, NULL);
ChangeGCVal val;
val.val = key;
dixChangeGC(NullClient, pGC, GCForeground, NULL, &val);
ValidateGC(pDraw, pGC);
}

Expand All @@ -1881,7 +1882,7 @@ void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
{
DrawablePtr root = &WindowTable[pScreen->myNum]->drawable;
XID pval[2];
ChangeGCVal pval[2];
BoxPtr pbox = REGION_RECTS(clipboxes);
int i, nbox = REGION_NUM_RECTS(clipboxes);
xRectangle *rects;
Expand All @@ -1890,9 +1891,9 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
if(!xf86Screens[pScreen->myNum]->vtSema) return;

gc = GetScratchGC(root->depth, pScreen);
pval[0] = key;
pval[1] = IncludeInferiors;
(void) dixChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, pval, NULL);
pval[0].val = key;
pval[1].val = IncludeInferiors;
(void) dixChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, NULL, pval);
ValidateGC(root, gc);

rects = malloc(nbox * sizeof(xRectangle));
Expand Down
8 changes: 4 additions & 4 deletions hw/xfree86/xaa/xaaPCache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ XAAWriteBitmapToCacheLinear(
){
ScreenPtr pScreen = pScrn->pScreen;
PixmapPtr pScreenPix, pDstPix;
XID gcvals[2];
ChangeGCVal gcvals[2];
GCPtr pGC;

pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
Expand All @@ -1879,9 +1879,9 @@ XAAWriteBitmapToCacheLinear(
pScreenPix->devPrivate.ptr);

pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen);
gcvals[0] = fg;
gcvals[1] = bg;
dixChangeGC(NullClient, pGC, GCForeground | GCBackground, gcvals, NULL);
gcvals[0].val = fg;
gcvals[1].val = bg;
dixChangeGC(NullClient, pGC, GCForeground | GCBackground, NULL, gcvals);
ValidateGC((DrawablePtr)pDstPix, pGC);

/* We've unwrapped already so these ops miss a sync */
Expand Down
23 changes: 13 additions & 10 deletions mi/miarc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,16 +1036,16 @@ miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
if (!pGCTo)
return;
{
CARD32 gcvals[6];
gcvals[0] = GXcopy;
gcvals[1] = 1;
gcvals[2] = 0;
gcvals[3] = pGC->lineWidth;
gcvals[4] = pGC->capStyle;
gcvals[5] = pGC->joinStyle;
ChangeGCVal gcvals[6];
gcvals[0].val = GXcopy;
gcvals[1].val = 1;
gcvals[2].val = 0;
gcvals[3].val = pGC->lineWidth;
gcvals[4].val = pGC->capStyle;
gcvals[5].val = pGC->joinStyle;
dixChangeGC(NullClient, pGCTo, GCFunction |
GCForeground | GCBackground | GCLineWidth |
GCCapStyle | GCJoinStyle, gcvals, NULL);
GCCapStyle | GCJoinStyle, NULL, gcvals);
}

/* allocate a 1 bit deep pixmap of the appropriate size, and
Expand Down Expand Up @@ -1085,11 +1085,14 @@ miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
iphase >= 0;
iphase--)
{
ChangeGCVal gcval;
if (iphase == 1) {
dixChangeGC (NullClient, pGC, GCForeground, &bg, NULL);
gcval.val = bg;
dixChangeGC (NullClient, pGC, GCForeground, NULL, &gcval);
ValidateGC (pDraw, pGC);
} else if (pGC->lineStyle == LineDoubleDash) {
dixChangeGC (NullClient, pGC, GCForeground, &fg, NULL);
gcval.val = fg;
dixChangeGC (NullClient, pGC, GCForeground, NULL, &gcval);
ValidateGC (pDraw, pGC);
}
for (i = 0; i < polyArcs[iphase].narcs; i++) {
Expand Down
Loading

0 comments on commit e2929db

Please sign in to comment.