Commit bbb23e58 authored by Ulrich Sibiller's avatar Ulrich Sibiller

GC.c: condense code

remove some empty lines to make the code more compact
parent c3a7e9b5
...@@ -183,24 +183,18 @@ Bool nxagentCreateGC(GCPtr pGC) ...@@ -183,24 +183,18 @@ Bool nxagentCreateGC(GCPtr pGC)
pPriv->bpp = BitsPerPixel (pGC->depth); pPriv->bpp = BitsPerPixel (pGC->depth);
nxagentGCPriv(pGC)->nClipRects = 0;
memset(&(nxagentGCPriv(pGC) -> lastServerValues), 0, sizeof(XGCValues));
/* /*
* Init to default GC values. * Init to default GC values.
*/ */
memset(&(nxagentGCPriv(pGC) -> lastServerValues), 0, sizeof(XGCValues));
nxagentGCPriv(pGC) -> lastServerValues.background = 1; nxagentGCPriv(pGC) -> lastServerValues.background = 1;
nxagentGCPriv(pGC) -> lastServerValues.plane_mask = ~0; nxagentGCPriv(pGC) -> lastServerValues.plane_mask = ~0;
nxagentGCPriv(pGC) -> lastServerValues.graphics_exposures = 1; nxagentGCPriv(pGC) -> lastServerValues.graphics_exposures = 1;
nxagentGCPriv(pGC) -> lastServerValues.dashes = 4; nxagentGCPriv(pGC) -> lastServerValues.dashes = 4;
nxagentGCPriv(pGC) -> nClipRects = 0;
nxagentGCPriv(pGC) -> mid = FakeClientID(serverClient -> index); nxagentGCPriv(pGC) -> mid = FakeClientID(serverClient -> index);
nxagentGCPriv(pGC) -> pPixmap = NULL; nxagentGCPriv(pGC) -> pPixmap = NULL;
AddResource(nxagentGCPriv(pGC) -> mid, RT_NX_GC, (void *) pGC); AddResource(nxagentGCPriv(pGC) -> mid, RT_NX_GC, (void *) pGC);
...@@ -514,13 +508,11 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -514,13 +508,11 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
case CT_NONE: case CT_NONE:
{ {
clipsMatch = (pGC -> clientClipType == None); clipsMatch = (pGC -> clientClipType == None);
break; break;
} }
case CT_REGION: case CT_REGION:
{ {
clipsMatch = nxagentCompareRegions(pGC -> clientClip, (RegionPtr) pValue); clipsMatch = nxagentCompareRegions(pGC -> clientClip, (RegionPtr) pValue);
break; break;
} }
case CT_UNSORTED: case CT_UNSORTED:
...@@ -529,17 +521,13 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -529,17 +521,13 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
case CT_YXBANDED: case CT_YXBANDED:
{ {
RegionPtr pReg = RegionFromRects(nRects, (xRectangle *)pValue, type); RegionPtr pReg = RegionFromRects(nRects, (xRectangle *)pValue, type);
clipsMatch = nxagentCompareRegions(pGC -> clientClip, pReg); clipsMatch = nxagentCompareRegions(pGC -> clientClip, pReg);
RegionDestroy(pReg); RegionDestroy(pReg);
break; break;
} }
default: default:
{ {
clipsMatch = 0; clipsMatch = 0;
break; break;
} }
} }
...@@ -559,7 +547,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -559,7 +547,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
{ {
XSetClipMask(nxagentDisplay, nxagentGC(pGC), None); XSetClipMask(nxagentDisplay, nxagentGC(pGC), None);
} }
break; break;
} }
case CT_REGION: case CT_REGION:
...@@ -584,7 +571,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -584,7 +571,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
pRects, nRects, Unsorted); pRects, nRects, Unsorted);
SAFE_free(pRects); SAFE_free(pRects);
} }
break; break;
} }
case CT_PIXMAP: case CT_PIXMAP:
...@@ -613,7 +599,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -613,7 +599,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
pGC->clipOrg.x, pGC->clipOrg.y, pGC->clipOrg.x, pGC->clipOrg.y,
(XRectangle *)pValue, nRects, Unsorted); (XRectangle *)pValue, nRects, Unsorted);
} }
break; break;
} }
case CT_YSORTED: case CT_YSORTED:
...@@ -624,7 +609,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -624,7 +609,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
pGC->clipOrg.x, pGC->clipOrg.y, pGC->clipOrg.x, pGC->clipOrg.y,
(XRectangle *)pValue, nRects, YSorted); (XRectangle *)pValue, nRects, YSorted);
} }
break; break;
} }
case CT_YXSORTED: case CT_YXSORTED:
...@@ -635,7 +619,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -635,7 +619,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
pGC->clipOrg.x, pGC->clipOrg.y, pGC->clipOrg.x, pGC->clipOrg.y,
(XRectangle *)pValue, nRects, YXSorted); (XRectangle *)pValue, nRects, YXSorted);
} }
break; break;
} }
case CT_YXBANDED: case CT_YXBANDED:
...@@ -646,7 +629,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -646,7 +629,6 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
pGC->clipOrg.x, pGC->clipOrg.y, pGC->clipOrg.x, pGC->clipOrg.y,
(XRectangle *)pValue, nRects, YXBanded); (XRectangle *)pValue, nRects, YXBanded);
} }
break; break;
} }
} }
...@@ -764,11 +746,9 @@ void nxagentCopyClip(GCPtr pGCDst, GCPtr pGCSrc) ...@@ -764,11 +746,9 @@ void nxagentCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
nxagentChangeClip(pGCDst, CT_PIXMAP, pGCSrc->clientClip, 0); nxagentChangeClip(pGCDst, CT_PIXMAP, pGCSrc->clientClip, 0);
break; break;
case CT_NONE: case CT_NONE:
nxagentDestroyClip(pGCDst); nxagentDestroyClip(pGCDst);
break; break;
} }
} }
...@@ -1061,14 +1041,12 @@ void nxagentDisconnectGC(void * p0, XID x1, void * p2) ...@@ -1061,14 +1041,12 @@ void nxagentDisconnectGC(void * p0, XID x1, void * p2)
fprintf(stderr, "nxagentDisconnectGC: WARNING! pGC is NULL.\n"); fprintf(stderr, "nxagentDisconnectGC: WARNING! pGC is NULL.\n");
#endif #endif
} }
return; return;
} }
if (pGC -> stipple) if (pGC -> stipple)
{ {
PixmapPtr pMap = pGC -> stipple; PixmapPtr pMap = pGC -> stipple;
nxagentDisconnectPixmap(nxagentRealPixmap(pMap), 0, pBool); nxagentDisconnectPixmap(nxagentRealPixmap(pMap), 0, pBool);
} }
} }
...@@ -1131,7 +1109,6 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -1131,7 +1109,6 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects)
case CT_NONE: case CT_NONE:
XSetClipMask(nxagentDisplay, nxagentGC(pGC), None); XSetClipMask(nxagentDisplay, nxagentGC(pGC), None);
break; break;
case CT_REGION: case CT_REGION:
if (nxagentGCPriv(pGC)->pPixmap == NULL) if (nxagentGCPriv(pGC)->pPixmap == NULL)
{ {
...@@ -1164,11 +1141,8 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -1164,11 +1141,8 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects)
XSetClipOrigin(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y); XSetClipOrigin(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y);
} }
break; break;
case CT_PIXMAP: case CT_PIXMAP:
XSetClipMask(nxagentDisplay, nxagentGC(pGC), XSetClipMask(nxagentDisplay, nxagentGC(pGC),
nxagentPixmap((PixmapPtr)pValue)); nxagentPixmap((PixmapPtr)pValue));
...@@ -1183,25 +1157,21 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects) ...@@ -1183,25 +1157,21 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects)
type = CT_REGION; type = CT_REGION;
break; break;
case CT_UNSORTED: case CT_UNSORTED:
XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), XSetClipRectangles(nxagentDisplay, nxagentGC(pGC),
pGC->clipOrg.x, pGC->clipOrg.y, pGC->clipOrg.x, pGC->clipOrg.y,
(XRectangle *)pValue, nRects, Unsorted); (XRectangle *)pValue, nRects, Unsorted);
break; break;
case CT_YSORTED: case CT_YSORTED:
XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), XSetClipRectangles(nxagentDisplay, nxagentGC(pGC),
pGC->clipOrg.x, pGC->clipOrg.y, pGC->clipOrg.x, pGC->clipOrg.y,
(XRectangle *)pValue, nRects, YSorted); (XRectangle *)pValue, nRects, YSorted);
break; break;
case CT_YXSORTED: case CT_YXSORTED:
XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), XSetClipRectangles(nxagentDisplay, nxagentGC(pGC),
pGC->clipOrg.x, pGC->clipOrg.y, pGC->clipOrg.x, pGC->clipOrg.y,
(XRectangle *)pValue, nRects, YXSorted); (XRectangle *)pValue, nRects, YXSorted);
break; break;
case CT_YXBANDED: case CT_YXBANDED:
XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), XSetClipRectangles(nxagentDisplay, nxagentGC(pGC),
pGC->clipOrg.x, pGC->clipOrg.y, pGC->clipOrg.x, pGC->clipOrg.y,
...@@ -1277,7 +1247,6 @@ static int nxagentCompareRegions(RegionPtr r1, RegionPtr r2) ...@@ -1277,7 +1247,6 @@ static int nxagentCompareRegions(RegionPtr r1, RegionPtr r2)
else if (RegionRects(r1)[i].y2 != RegionRects(r2)[i].y2) return 0; else if (RegionRects(r1)[i].y2 != RegionRects(r2)[i].y2) return 0;
} }
} }
return 1; return 1;
} }
...@@ -1489,7 +1458,6 @@ void nxagentAllocateGraphicContexts(void) ...@@ -1489,7 +1458,6 @@ void nxagentAllocateGraphicContexts(void)
for (int i = 0; i < nxagentNumDepths; i++) for (int i = 0; i < nxagentNumDepths; i++)
{ {
nxagentCreateGraphicContext(*depths); nxagentCreateGraphicContext(*depths);
depths++; depths++;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment