mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 08:04:30 +00:00
dix: colormap.c more C99 scoped declaration
Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
This commit is contained in:
committed by
Enrico Weigelt
parent
c8c52387c5
commit
ebeb805b70
163
dix/colormap.c
163
dix/colormap.c
@@ -245,9 +245,8 @@ dixCreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||
int class, size;
|
||||
unsigned long sizebytes;
|
||||
ColormapPtr pmap;
|
||||
EntryPtr pent;
|
||||
int i;
|
||||
Pixel *ppix, **pptr;
|
||||
int access;
|
||||
Pixel *ppix;
|
||||
|
||||
if (!pClient)
|
||||
return BadMatch;
|
||||
@@ -299,13 +298,13 @@ dixCreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||
pmap->freeRed = size;
|
||||
memset((char *) pmap->red, 0, (int) sizebytes);
|
||||
memset((char *) pmap->numPixelsRed, 0, LimitClients * sizeof(int));
|
||||
for (pptr = &pmap->clientPixelsRed[LimitClients];
|
||||
for (Pixel **pptr = &pmap->clientPixelsRed[LimitClients];
|
||||
--pptr >= pmap->clientPixelsRed;)
|
||||
*pptr = (Pixel *) NULL;
|
||||
if (alloc == AllocAll) {
|
||||
if (class & DynamicClass)
|
||||
pmap->flags |= CM_AllAllocated;
|
||||
for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
|
||||
for (EntryPtr pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
|
||||
pent->refcnt = AllocPrivate;
|
||||
pmap->freeRed = 0;
|
||||
ppix = calloc(size, sizeof(Pixel));
|
||||
@@ -314,7 +313,7 @@ dixCreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||
return BadAlloc;
|
||||
}
|
||||
pmap->clientPixelsRed[clientIndex] = ppix;
|
||||
for (i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
ppix[i] = i;
|
||||
pmap->numPixelsRed[clientIndex] = size;
|
||||
}
|
||||
@@ -346,7 +345,7 @@ dixCreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||
/* If every cell is allocated, mark its refcnt */
|
||||
if (alloc == AllocAll) {
|
||||
size = pmap->freeGreen;
|
||||
for (pent = &pmap->green[size - 1]; pent >= pmap->green; pent--)
|
||||
for (EntryPtr pent = &pmap->green[size - 1]; pent >= pmap->green; pent--)
|
||||
pent->refcnt = AllocPrivate;
|
||||
pmap->freeGreen = 0;
|
||||
ppix = calloc(size, sizeof(Pixel));
|
||||
@@ -356,12 +355,12 @@ dixCreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||
return BadAlloc;
|
||||
}
|
||||
pmap->clientPixelsGreen[clientIndex] = ppix;
|
||||
for (i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
ppix[i] = i;
|
||||
pmap->numPixelsGreen[clientIndex] = size;
|
||||
|
||||
size = pmap->freeBlue;
|
||||
for (pent = &pmap->blue[size - 1]; pent >= pmap->blue; pent--)
|
||||
for (EntryPtr pent = &pmap->blue[size - 1]; pent >= pmap->blue; pent--)
|
||||
pent->refcnt = AllocPrivate;
|
||||
pmap->freeBlue = 0;
|
||||
ppix = calloc(size, sizeof(Pixel));
|
||||
@@ -372,7 +371,7 @@ dixCreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||
return BadAlloc;
|
||||
}
|
||||
pmap->clientPixelsBlue[clientIndex] = ppix;
|
||||
for (i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
ppix[i] = i;
|
||||
pmap->numPixelsBlue[clientIndex] = size;
|
||||
}
|
||||
@@ -385,11 +384,11 @@ dixCreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||
/*
|
||||
* Security creation/labeling check
|
||||
*/
|
||||
i = XaceHookResourceAccess(pClient, mid, X11_RESTYPE_COLORMAP,
|
||||
access = XaceHookResourceAccess(pClient, mid, X11_RESTYPE_COLORMAP,
|
||||
pmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
|
||||
if (i != Success) {
|
||||
if (access != Success) {
|
||||
FreeResource(mid, X11_RESTYPE_NONE);
|
||||
return i;
|
||||
return access;
|
||||
}
|
||||
|
||||
/* If the device wants a chance to initialize the colormap in any way,
|
||||
@@ -411,8 +410,6 @@ dixCreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||
int
|
||||
FreeColormap(void *value, XID mid)
|
||||
{
|
||||
int i;
|
||||
EntryPtr pent;
|
||||
ColormapPtr pmap = (ColormapPtr) value;
|
||||
|
||||
if (!dixResouceIsServerOwned(mid)) {
|
||||
@@ -425,12 +422,12 @@ FreeColormap(void *value, XID mid)
|
||||
(*pmap->pScreen->DestroyColormap) (pmap);
|
||||
|
||||
if (pmap->clientPixelsRed) {
|
||||
for (i = 0; i < LimitClients; i++)
|
||||
for (int i = 0; i < LimitClients; i++)
|
||||
free(pmap->clientPixelsRed[i]);
|
||||
}
|
||||
|
||||
if ((pmap->class == PseudoColor) || (pmap->class == GrayScale)) {
|
||||
for (pent = &pmap->red[pmap->pVisual->ColormapEntries - 1];
|
||||
for (EntryPtr pent = &pmap->red[pmap->pVisual->ColormapEntries - 1];
|
||||
pent >= pmap->red; pent--) {
|
||||
if (pent->fShared) {
|
||||
if (--pent->co.shco.red->refcnt == 0)
|
||||
@@ -443,7 +440,7 @@ FreeColormap(void *value, XID mid)
|
||||
}
|
||||
}
|
||||
if ((pmap->class | DynamicClass) == DirectColor) {
|
||||
for (i = 0; i < LimitClients; i++) {
|
||||
for (int i = 0; i < LimitClients; i++) {
|
||||
free(pmap->clientPixelsGreen[i]);
|
||||
free(pmap->clientPixelsBlue[i]);
|
||||
}
|
||||
@@ -583,7 +580,7 @@ CopyColormapAndFree(Colormap mid, ColormapPtr pSrc, int client)
|
||||
static void
|
||||
CopyFree(int channel, int client, ColormapPtr pmapSrc, ColormapPtr pmapDst)
|
||||
{
|
||||
int z, npix;
|
||||
int npix;
|
||||
EntryPtr pentSrcFirst, pentDstFirst;
|
||||
EntryPtr pentSrc, pentDst;
|
||||
Pixel *ppix;
|
||||
@@ -612,7 +609,7 @@ CopyFree(int channel, int client, ColormapPtr pmapSrc, ColormapPtr pmapDst)
|
||||
}
|
||||
nalloc = 0;
|
||||
if (pmapSrc->class & DynamicClass) {
|
||||
for (z = npix; --z >= 0; ppix++) {
|
||||
for (int z = npix; --z >= 0; ppix++) {
|
||||
/* Copy entries */
|
||||
pentSrc = pentSrcFirst + *ppix;
|
||||
pentDst = pentDstFirst + *ppix;
|
||||
@@ -708,9 +705,8 @@ doUpdateColors(ColormapPtr pmap)
|
||||
{
|
||||
xColorItem *defs;
|
||||
xColorItem *pdef;
|
||||
EntryPtr pent;
|
||||
VisualPtr pVisual;
|
||||
int i, n, size;
|
||||
int n, size;
|
||||
|
||||
pVisual = pmap->pVisual;
|
||||
size = pVisual->ColormapEntries;
|
||||
@@ -720,7 +716,7 @@ doUpdateColors(ColormapPtr pmap)
|
||||
n = 0;
|
||||
pdef = defs;
|
||||
if (pmap->class == DirectColor) {
|
||||
for (i = 0; i < size; i++) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (!pmap->red[i].refcnt &&
|
||||
!pmap->green[i].refcnt && !pmap->blue[i].refcnt)
|
||||
continue;
|
||||
@@ -736,7 +732,8 @@ doUpdateColors(ColormapPtr pmap)
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0, pent = pmap->red; i < size; i++, pent++) {
|
||||
int i = 0;
|
||||
for (EntryPtr pent = pmap->red; i < size; i++, pent++) {
|
||||
if (!pent->refcnt)
|
||||
continue;
|
||||
pdef->pixel = i;
|
||||
@@ -1432,15 +1429,14 @@ QueryColors(ColormapPtr pmap, int count, Pixel * ppixIn, xrgb * prgbList,
|
||||
static void
|
||||
FreePixels(ColormapPtr pmap, int client)
|
||||
{
|
||||
Pixel *ppix, *ppixStart;
|
||||
int n;
|
||||
Pixel *ppixStart;
|
||||
int class;
|
||||
|
||||
class = pmap->class;
|
||||
ppixStart = pmap->clientPixelsRed[client];
|
||||
if (class & DynamicClass) {
|
||||
n = pmap->numPixelsRed[client];
|
||||
for (ppix = ppixStart; --n >= 0;) {
|
||||
int n = pmap->numPixelsRed[client];
|
||||
for (Pixel *ppix = ppixStart; --n >= 0;) {
|
||||
FreeCell(pmap, *ppix, REDMAP);
|
||||
ppix++;
|
||||
}
|
||||
@@ -1451,17 +1447,21 @@ FreePixels(ColormapPtr pmap, int client)
|
||||
pmap->numPixelsRed[client] = 0;
|
||||
if ((class | DynamicClass) == DirectColor) {
|
||||
ppixStart = pmap->clientPixelsGreen[client];
|
||||
if (class & DynamicClass)
|
||||
for (ppix = ppixStart, n = pmap->numPixelsGreen[client]; --n >= 0;)
|
||||
if (class & DynamicClass) {
|
||||
int n = pmap->numPixelsGreen[client];
|
||||
for (Pixel *ppix = ppixStart; --n >= 0;)
|
||||
FreeCell(pmap, *ppix++, GREENMAP);
|
||||
}
|
||||
free(ppixStart);
|
||||
pmap->clientPixelsGreen[client] = (Pixel *) NULL;
|
||||
pmap->numPixelsGreen[client] = 0;
|
||||
|
||||
ppixStart = pmap->clientPixelsBlue[client];
|
||||
if (class & DynamicClass)
|
||||
for (ppix = ppixStart, n = pmap->numPixelsBlue[client]; --n >= 0;)
|
||||
if (class & DynamicClass) {
|
||||
int n = pmap->numPixelsBlue[client];
|
||||
for (Pixel* ppix = ppixStart; --n >= 0;)
|
||||
FreeCell(pmap, *ppix++, BLUEMAP);
|
||||
}
|
||||
free(ppixStart);
|
||||
pmap->clientPixelsBlue[client] = (Pixel *) NULL;
|
||||
pmap->numPixelsBlue[client] = 0;
|
||||
@@ -1493,8 +1493,8 @@ int
|
||||
AllocColorCells(ClientPtr pClient, ColormapPtr pmap, int colors, int planes,
|
||||
Bool contig, Pixel * ppix, Pixel * masks)
|
||||
{
|
||||
Pixel rmask, gmask, bmask, *ppixFirst, r, g, b;
|
||||
int n, class;
|
||||
Pixel rmask, gmask, bmask, *ppixFirst;
|
||||
int class;
|
||||
int ok;
|
||||
int oldcount;
|
||||
const int client = pClient->index;
|
||||
@@ -1516,7 +1516,7 @@ AllocColorCells(ClientPtr pClient, ColormapPtr pmap, int colors, int planes,
|
||||
ok = AllocDirect(client, pmap, colors, planes, planes, planes,
|
||||
contig, ppix, &rmask, &gmask, &bmask);
|
||||
if (ok == Success) {
|
||||
for (r = g = b = 1, n = planes; --n >= 0; r += r, g += g, b += b) {
|
||||
for (int r = 1, g = 1, b = 1, n = planes; --n >= 0; r += r, g += g, b += b) {
|
||||
while (!(rmask & r))
|
||||
r += r;
|
||||
while (!(gmask & g))
|
||||
@@ -1531,7 +1531,7 @@ AllocColorCells(ClientPtr pClient, ColormapPtr pmap, int colors, int planes,
|
||||
ok = AllocPseudo(client, pmap, colors, planes, contig, ppix, &rmask,
|
||||
&ppixFirst);
|
||||
if (ok == Success) {
|
||||
for (r = 1, n = planes; --n >= 0; r += r) {
|
||||
for (int r = 1, n = planes; --n >= 0; r += r) {
|
||||
while (!(rmask & r))
|
||||
r += r;
|
||||
*masks++ = r;
|
||||
@@ -1562,7 +1562,6 @@ AllocColorPlanes(int client, ColormapPtr pmap, int colors,
|
||||
int ok;
|
||||
Pixel mask, *ppixFirst;
|
||||
Pixel shift;
|
||||
int i;
|
||||
int class;
|
||||
int oldcount;
|
||||
colorResource *pcr = (colorResource *) NULL;
|
||||
@@ -1596,17 +1595,17 @@ AllocColorPlanes(int client, ColormapPtr pmap, int colors,
|
||||
/* now split that mask into three */
|
||||
*prmask = *pgmask = *pbmask = 0;
|
||||
shift = 1;
|
||||
for (i = r; --i >= 0; shift += shift) {
|
||||
for (int i = r; --i >= 0; shift += shift) {
|
||||
while (!(mask & shift))
|
||||
shift += shift;
|
||||
*prmask |= shift;
|
||||
}
|
||||
for (i = g; --i >= 0; shift += shift) {
|
||||
for (int i = g; --i >= 0; shift += shift) {
|
||||
while (!(mask & shift))
|
||||
shift += shift;
|
||||
*pgmask |= shift;
|
||||
}
|
||||
for (i = b; --i >= 0; shift += shift) {
|
||||
for (int i = b; --i >= 0; shift += shift) {
|
||||
while (!(mask & shift))
|
||||
shift += shift;
|
||||
*pbmask |= shift;
|
||||
@@ -1642,8 +1641,8 @@ AllocDirect(int client, ColormapPtr pmap, int c, int r, int g, int b,
|
||||
Pixel * pbmask)
|
||||
{
|
||||
Pixel *ppixRed, *ppixGreen, *ppixBlue;
|
||||
Pixel *ppix, *pDst, *p;
|
||||
int npix, npixR, npixG, npixB;
|
||||
Pixel *ppix;
|
||||
int npixR, npixG, npixB;
|
||||
Bool okR, okG, okB;
|
||||
Pixel *rpix = 0, *gpix = 0, *bpix = 0;
|
||||
|
||||
@@ -1657,7 +1656,7 @@ AllocDirect(int client, ColormapPtr pmap, int c, int r, int g, int b,
|
||||
return BadAlloc;
|
||||
|
||||
/* start out with empty pixels */
|
||||
for (p = pixels; p < pixels + c; p++)
|
||||
for (Pixel *p = pixels; p < pixels + c; p++)
|
||||
*p = 0;
|
||||
|
||||
ppixRed = calloc(npixR, sizeof(Pixel));
|
||||
@@ -1693,15 +1692,21 @@ AllocDirect(int client, ColormapPtr pmap, int c, int r, int g, int b,
|
||||
}
|
||||
|
||||
if (!okR || !okG || !okB || !rpix || !gpix || !bpix) {
|
||||
if (okR)
|
||||
for (ppix = ppixRed, npix = npixR; --npix >= 0; ppix++)
|
||||
if (okR) {
|
||||
ppix = ppixRed;
|
||||
for (int npix = npixR; --npix >= 0; ppix++)
|
||||
pmap->red[*ppix].refcnt = 0;
|
||||
if (okG)
|
||||
for (ppix = ppixGreen, npix = npixG; --npix >= 0; ppix++)
|
||||
}
|
||||
if (okG) {
|
||||
ppix = ppixGreen;
|
||||
for (int npix = npixG; --npix >= 0; ppix++)
|
||||
pmap->green[*ppix].refcnt = 0;
|
||||
if (okB)
|
||||
for (ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++)
|
||||
}
|
||||
if (okB) {
|
||||
ppix = ppixBlue;
|
||||
for (int npix = npixB; --npix >= 0; ppix++)
|
||||
pmap->blue[*ppix].refcnt = 0;
|
||||
}
|
||||
free(ppixBlue);
|
||||
free(ppixGreen);
|
||||
free(ppixRed);
|
||||
@@ -1713,7 +1718,7 @@ AllocDirect(int client, ColormapPtr pmap, int c, int r, int g, int b,
|
||||
*pbmask <<= pmap->pVisual->offsetBlue;
|
||||
|
||||
ppix = rpix + pmap->numPixelsRed[client];
|
||||
for (pDst = pixels, p = ppixRed; p < ppixRed + npixR; p++) {
|
||||
for (Pixel *pDst = pixels, *p = ppixRed; p < ppixRed + npixR; p++) {
|
||||
*ppix++ = *p;
|
||||
if (p < ppixRed + c)
|
||||
*pDst++ |= *p << pmap->pVisual->offsetRed;
|
||||
@@ -1722,7 +1727,7 @@ AllocDirect(int client, ColormapPtr pmap, int c, int r, int g, int b,
|
||||
pmap->freeRed -= npixR;
|
||||
|
||||
ppix = gpix + pmap->numPixelsGreen[client];
|
||||
for (pDst = pixels, p = ppixGreen; p < ppixGreen + npixG; p++) {
|
||||
for (Pixel *pDst = pixels, *p = ppixGreen; p < ppixGreen + npixG; p++) {
|
||||
*ppix++ = *p;
|
||||
if (p < ppixGreen + c)
|
||||
*pDst++ |= *p << pmap->pVisual->offsetGreen;
|
||||
@@ -1731,7 +1736,7 @@ AllocDirect(int client, ColormapPtr pmap, int c, int r, int g, int b,
|
||||
pmap->freeGreen -= npixG;
|
||||
|
||||
ppix = bpix + pmap->numPixelsBlue[client];
|
||||
for (pDst = pixels, p = ppixBlue; p < ppixBlue + npixB; p++) {
|
||||
for (Pixel *pDst = pixels, *p = ppixBlue; p < ppixBlue + npixB; p++) {
|
||||
*ppix++ = *p;
|
||||
if (p < ppixBlue + c)
|
||||
*pDst++ |= *p << pmap->pVisual->offsetBlue;
|
||||
@@ -1739,7 +1744,7 @@ AllocDirect(int client, ColormapPtr pmap, int c, int r, int g, int b,
|
||||
pmap->numPixelsBlue[client] += npixB;
|
||||
pmap->freeBlue -= npixB;
|
||||
|
||||
for (pDst = pixels; pDst < pixels + c; pDst++)
|
||||
for (Pixel *pDst = pixels; pDst < pixels + c; pDst++)
|
||||
*pDst |= ALPHAMASK(pmap->pVisual);
|
||||
|
||||
free(ppixBlue);
|
||||
@@ -1753,7 +1758,7 @@ static int
|
||||
AllocPseudo(int client, ColormapPtr pmap, int c, int r, Bool contig,
|
||||
Pixel * pixels, Pixel * pmask, Pixel ** pppixFirst)
|
||||
{
|
||||
Pixel *ppix, *p, *pDst, *ppixTemp;
|
||||
Pixel *ppix, *pDst, *ppixTemp;
|
||||
int npix;
|
||||
Bool ok;
|
||||
|
||||
@@ -1771,7 +1776,7 @@ AllocPseudo(int client, ColormapPtr pmap, int c, int r, Bool contig,
|
||||
ppix = reallocarray(pmap->clientPixelsRed[client],
|
||||
pmap->numPixelsRed[client] + npix, sizeof(Pixel));
|
||||
if (!ppix) {
|
||||
for (p = ppixTemp; p < ppixTemp + npix; p++)
|
||||
for (Pixel *p = ppixTemp; p < ppixTemp + npix; p++)
|
||||
pmap->red[*p].refcnt = 0;
|
||||
free(ppixTemp);
|
||||
return BadAlloc;
|
||||
@@ -1780,7 +1785,7 @@ AllocPseudo(int client, ColormapPtr pmap, int c, int r, Bool contig,
|
||||
ppix += pmap->numPixelsRed[client];
|
||||
*pppixFirst = ppix;
|
||||
pDst = pixels;
|
||||
for (p = ppixTemp; p < ppixTemp + npix; p++) {
|
||||
for (Pixel *p = ppixTemp; p < ppixTemp + npix; p++) {
|
||||
*ppix++ = *p;
|
||||
if (p < ppixTemp + c)
|
||||
*pDst++ = *p;
|
||||
@@ -1965,8 +1970,8 @@ static Bool
|
||||
AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
||||
Pixel rmask, Pixel gmask, Pixel bmask, Pixel * ppixFirst)
|
||||
{
|
||||
Pixel *pptr, *cptr;
|
||||
int npix, z, npixClientNew, npixShared;
|
||||
Pixel *pptr;
|
||||
int npix, npixClientNew, npixShared;
|
||||
Pixel basemask, base, bits, common;
|
||||
SHAREDCOLOR *pshared, **ppshared, **psharedList;
|
||||
|
||||
@@ -1976,7 +1981,7 @@ AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
||||
if (!psharedList)
|
||||
return FALSE;
|
||||
ppshared = psharedList;
|
||||
for (z = npixShared; --z >= 0;) {
|
||||
for (int z = npixShared; --z >= 0;) {
|
||||
if (!(ppshared[z] = calloc(1, sizeof(SHAREDCOLOR)))) {
|
||||
for (z++; z < npixShared; z++)
|
||||
free(ppshared[z]);
|
||||
@@ -1993,7 +1998,8 @@ AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
||||
while (1) {
|
||||
pshared = *ppshared++;
|
||||
pshared->refcnt = 1 << (g + b);
|
||||
for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
|
||||
int z = npixClientNew;
|
||||
for (Pixel *cptr = ppixFirst; --z >= 0; cptr++) {
|
||||
if ((*cptr & basemask) == (common | bits)) {
|
||||
pmap->red[*cptr].fShared = TRUE;
|
||||
pmap->red[*cptr].co.shco.red = pshared;
|
||||
@@ -2005,7 +2011,8 @@ AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
||||
else {
|
||||
pshared = *ppshared++;
|
||||
pshared->refcnt = 1 << (g + b);
|
||||
for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
|
||||
int z = npixClientNew;
|
||||
for (Pixel *cptr = ppixFirst; --z >= 0; cptr++) {
|
||||
if ((*cptr & basemask) == common) {
|
||||
pmap->red[*cptr].fShared = TRUE;
|
||||
pmap->red[*cptr].co.shco.red = pshared;
|
||||
@@ -2020,7 +2027,8 @@ AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
||||
while (1) {
|
||||
pshared = *ppshared++;
|
||||
pshared->refcnt = 1 << (r + b);
|
||||
for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
|
||||
int z = npixClientNew;
|
||||
for (Pixel *cptr = ppixFirst; --z >= 0; cptr++) {
|
||||
if ((*cptr & basemask) == (common | bits)) {
|
||||
pmap->red[*cptr].co.shco.green = pshared;
|
||||
}
|
||||
@@ -2031,7 +2039,8 @@ AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
||||
else {
|
||||
pshared = *ppshared++;
|
||||
pshared->refcnt = 1 << (g + b);
|
||||
for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
|
||||
int z = npixClientNew;
|
||||
for (Pixel* cptr = ppixFirst; --z >= 0; cptr++) {
|
||||
if ((*cptr & basemask) == common) {
|
||||
pmap->red[*cptr].co.shco.green = pshared;
|
||||
}
|
||||
@@ -2045,7 +2054,8 @@ AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
||||
while (1) {
|
||||
pshared = *ppshared++;
|
||||
pshared->refcnt = 1 << (r + g);
|
||||
for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
|
||||
int z = npixClientNew;
|
||||
for (Pixel* cptr = ppixFirst; --z >= 0; cptr++) {
|
||||
if ((*cptr & basemask) == (common | bits)) {
|
||||
pmap->red[*cptr].co.shco.blue = pshared;
|
||||
}
|
||||
@@ -2056,7 +2066,8 @@ AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
||||
else {
|
||||
pshared = *ppshared++;
|
||||
pshared->refcnt = 1 << (g + b);
|
||||
for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) {
|
||||
int z = npixClientNew;
|
||||
for (Pixel* cptr = ppixFirst; --z >= 0; cptr++) {
|
||||
if ((*cptr & basemask) == common) {
|
||||
pmap->red[*cptr].co.shco.blue = pshared;
|
||||
}
|
||||
@@ -2125,7 +2136,7 @@ FreeCo(ColormapPtr pmap, int client, int color, int npixIn, Pixel * ppixIn,
|
||||
int npixClient, npixNew, npix;
|
||||
Pixel bits, base, cmask, rgbbad;
|
||||
Pixel *pptr, *cptr;
|
||||
int n, zapped;
|
||||
int zapped;
|
||||
int errVal = Success;
|
||||
int offset, numents;
|
||||
|
||||
@@ -2174,7 +2185,8 @@ FreeCo(ColormapPtr pmap, int client, int color, int npixIn, Pixel * ppixIn,
|
||||
/* zap all pixels which match */
|
||||
while (1) {
|
||||
/* go through pixel list */
|
||||
for (pptr = ppixIn, n = npixIn; --n >= 0; pptr++) {
|
||||
pptr = ppixIn;
|
||||
for (int n = npixIn; --n >= 0; pptr++) {
|
||||
pixTest = ((*pptr | bits) & cmask) >> offset;
|
||||
if ((pixTest >= numents) || (*pptr & rgbbad)) {
|
||||
clients[client]->errorValue = *pptr | bits;
|
||||
@@ -2250,11 +2262,10 @@ int
|
||||
StoreColors(ColormapPtr pmap, int count, xColorItem * defs, ClientPtr client)
|
||||
{
|
||||
Pixel pix;
|
||||
xColorItem *pdef;
|
||||
EntryPtr pent, pentT, pentLast;
|
||||
VisualPtr pVisual;
|
||||
SHAREDCOLOR *pred, *pgreen, *pblue;
|
||||
int n, ChgRed, ChgGreen, ChgBlue, idef;
|
||||
int ChgRed, ChgGreen, ChgBlue, idef;
|
||||
int class, errVal = Success;
|
||||
int ok;
|
||||
|
||||
@@ -2273,7 +2284,8 @@ StoreColors(ColormapPtr pmap, int count, xColorItem * defs, ClientPtr client)
|
||||
numgreen = NUMGREEN(pVisual);
|
||||
numblue = NUMBLUE(pVisual);
|
||||
rgbbad = ~RGBMASK(pVisual);
|
||||
for (pdef = defs, n = 0; n < count; pdef++, n++) {
|
||||
int n = 0;
|
||||
for (xColorItem *pdef = defs; n < count; pdef++, n++) {
|
||||
ok = TRUE;
|
||||
(*pmap->pScreen->ResolveColor)
|
||||
(&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual);
|
||||
@@ -2344,7 +2356,8 @@ StoreColors(ColormapPtr pmap, int count, xColorItem * defs, ClientPtr client)
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (pdef = defs, n = 0; n < count; pdef++, n++) {
|
||||
int n = 0;
|
||||
for (xColorItem *pdef = defs; n < count; pdef++, n++) {
|
||||
|
||||
ok = TRUE;
|
||||
if (pdef->pixel >= pVisual->ColormapEntries) {
|
||||
@@ -2479,7 +2492,7 @@ int
|
||||
IsMapInstalled(Colormap map, WindowPtr pWin)
|
||||
{
|
||||
Colormap *pmaps;
|
||||
int imap, nummaps, found;
|
||||
int nummaps, found;
|
||||
|
||||
pmaps = calloc(pWin->drawable.pScreen->maxInstalledCmaps,
|
||||
sizeof(Colormap));
|
||||
@@ -2488,7 +2501,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
|
||||
nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
|
||||
(pWin->drawable.pScreen, pmaps);
|
||||
found = FALSE;
|
||||
for (imap = 0; imap < nummaps; imap++) {
|
||||
for (int imap = 0; imap < nummaps; imap++) {
|
||||
if (pmaps[imap] == map) {
|
||||
found = TRUE;
|
||||
break;
|
||||
@@ -2528,7 +2541,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
|
||||
int numVisuals;
|
||||
VisualPtr visuals;
|
||||
XID *vids, vid;
|
||||
int first_new_vid, first_new_visual, i;
|
||||
int first_new_vid, first_new_visual;
|
||||
|
||||
first_new_vid = depth->numVids;
|
||||
first_new_visual = pScreen->numVisuals;
|
||||
@@ -2554,7 +2567,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
|
||||
|
||||
pScreen->visuals = visuals;
|
||||
|
||||
for (i = 0; i < new_visual_count; i++) {
|
||||
for (int i = 0; i < new_visual_count; i++) {
|
||||
vid = dixAllocServerXID();
|
||||
pScreen->visuals[first_new_visual + i].vid = vid;
|
||||
vids[first_new_vid + i] = vid;
|
||||
|
||||
Reference in New Issue
Block a user