From 8d0e520721ab7697d2d4f639425499b79c61b43f Mon Sep 17 00:00:00 2001 From: Roland Mainz Date: Mon, 7 Mar 2005 23:02:59 +0000 Subject: xc/programs/Xserver/dix/atom.c xc/programs/Xserver/dix/colormap.c xc/programs/Xserver/dix/cursor.c xc/programs/Xserver/dix/devices.c xc/programs/Xserver/dix/dispatch.c xc/programs/Xserver/dix/dixfonts.c xc/programs/Xserver/dix/dixutils.c xc/programs/Xserver/dix/events.c xc/programs/Xserver/dix/extension.c xc/programs/Xserver/dix/gc.c xc/programs/Xserver/dix/glyphcurs.c xc/programs/Xserver/dix/grabs.c xc/programs/Xserver/dix/main.c xc/programs/Xserver/dix/pixmap.c xc/programs/Xserver/dix/privates.c xc/programs/Xserver/dix/property.c xc/programs/Xserver/dix/resource.c xc/programs/Xserver/dix/swaprep.c xc/programs/Xserver/dix/swapreq.c //bugs.freedesktop.org/show_bug.cgi?id=2560) attachment #2037 (https://bugs.freedesktop.org/attachment.cgi?id=2037) ANSI-fy Xserver/dix code. The conversion preserves the comments which annotate variables. These have been moved into doxygen(esque?) "stubs" above each function. Patch by Mike Owens . --- dix/colormap.c | 239 +++++++++++++++++++-------------------------------------- 1 file changed, 80 insertions(+), 159 deletions(-) (limited to 'dix/colormap.c') diff --git a/dix/colormap.c b/dix/colormap.c index 947ffe46d..dc5dd405e 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/dix/colormap.c,v 1.4 2004/08/07 00:58:21 keithp Exp $ */ +/* $XdotOrg: xc/programs/Xserver/dix/colormap.c,v 1.5 2004/08/13 08:16:14 keithp Exp $ */ /* $XFree86: xc/programs/Xserver/dix/colormap.c,v 3.11 2003/11/03 05:10:59 tsi Exp $ */ /*********************************************************** @@ -245,15 +245,15 @@ typedef struct _colorResource */ -/* Create and initialize the color map */ +/** + * Create and initialize the color map + * + * \param mid resource to use for this colormap + * \param alloc 1 iff all entries are allocated writable + */ int -CreateColormap (mid, pScreen, pVisual, ppcmap, alloc, client) - Colormap mid; /* resource to use for this colormap */ - ScreenPtr pScreen; - VisualPtr pVisual; - ColormapPtr *ppcmap; - int alloc; /* 1 iff all entries are allocated writeable */ - int client; +CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, + ColormapPtr *ppcmap, int alloc, int client) { int class, size; unsigned long sizebytes; @@ -414,10 +414,12 @@ CreateColormap (mid, pScreen, pVisual, ppcmap, alloc, client) return (Success); } +/** + * + * \param value must conform to DeleteType + */ int -FreeColormap (value, mid) - pointer value; /* must conform to DeleteType */ - XID mid; +FreeColormap (pointer value, XID mid) { int i; register EntryPtr pent; @@ -474,9 +476,7 @@ FreeColormap (value, mid) /* Tell window that pmid has disappeared */ static int -TellNoMap (pwin, pmid) - WindowPtr pwin; - Colormap *pmid; +TellNoMap (WindowPtr pwin, Colormap *pmid) { xEvent xE; @@ -503,9 +503,7 @@ TellNoMap (pwin, pmid) /* Tell window that pmid got uninstalled */ int -TellLostMap (pwin, value) - WindowPtr pwin; - pointer value; +TellLostMap (WindowPtr pwin, pointer value) { Colormap *pmid = (Colormap *)value; xEvent xE; @@ -530,9 +528,7 @@ TellLostMap (pwin, value) /* Tell window that pmid got installed */ int -TellGainedMap (pwin, value) - WindowPtr pwin; - pointer value; +TellGainedMap (WindowPtr pwin, pointer value) { Colormap *pmid = (Colormap *)value; xEvent xE; @@ -557,10 +553,7 @@ TellGainedMap (pwin, value) int -CopyColormapAndFree (mid, pSrc, client) - Colormap mid; - ColormapPtr pSrc; - int client; +CopyColormapAndFree (Colormap mid, ColormapPtr pSrc, int client) { ColormapPtr pmap = (ColormapPtr) NULL; int result, alloc, size; @@ -607,9 +600,7 @@ CopyColormapAndFree (mid, pSrc, client) /* Helper routine for freeing large numbers of cells from a map */ static void -CopyFree (channel, client, pmapSrc, pmapDst) - int channel, client; - ColormapPtr pmapSrc, pmapDst; +CopyFree (int channel, int client, ColormapPtr pmapSrc, ColormapPtr pmapDst) { int z, npix; EntryPtr pentSrcFirst, pentDstFirst; @@ -696,10 +687,7 @@ CopyFree (channel, client, pmapSrc, pmapDst) /* Free the ith entry in a color map. Must handle freeing of * colors allocated through AllocColorPlanes */ static void -FreeCell (pmap, i, channel) - ColormapPtr pmap; - Pixel i; - int channel; +FreeCell (ColormapPtr pmap, Pixel i, int channel) { EntryPtr pent; int *pCount; @@ -746,8 +734,7 @@ FreeCell (pmap, i, channel) } static void -UpdateColors (pmap) - ColormapPtr pmap; +UpdateColors (ColormapPtr pmap) { xColorItem *defs; register xColorItem *pdef; @@ -814,11 +801,9 @@ UpdateColors (pmap) * Returns by changing the value in pred, pgreen, pblue and pPix */ int -AllocColor (pmap, pred, pgreen, pblue, pPix, client) - ColormapPtr pmap; - unsigned short *pred, *pgreen, *pblue; - Pixel *pPix; - int client; +AllocColor (ColormapPtr pmap, + unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, + Pixel *pPix, int client) { Pixel pixR, pixG, pixB; int entries; @@ -1001,9 +986,7 @@ AllocColor (pmap, pred, pgreen, pblue, pPix, client) */ void -FakeAllocColor (pmap, item) - register ColormapPtr pmap; - register xColorItem *item; +FakeAllocColor (register ColormapPtr pmap, register xColorItem *item) { Pixel pixR, pixG, pixB; Pixel temp; @@ -1069,9 +1052,7 @@ FakeAllocColor (pmap, item) /* free a pixel value obtained from FakeAllocColor */ void -FakeFreeColor(pmap, pixel) - register ColormapPtr pmap; - Pixel pixel; +FakeFreeColor(register ColormapPtr pmap, Pixel pixel) { register VisualPtr pVisual; Pixel pixR, pixG, pixB; @@ -1136,11 +1117,7 @@ BigNumAdd (BigNumPtr x, BigNumPtr y, BigNumPtr r) } static Pixel -FindBestPixel(pentFirst, size, prgb, channel) - EntryPtr pentFirst; - int size; - xrgb *prgb; - int channel; +FindBestPixel(EntryPtr pentFirst, int size, xrgb *prgb, int channel) { EntryPtr pent; Pixel pixel, final; @@ -1187,14 +1164,9 @@ FindBestPixel(pentFirst, size, prgb, channel) } static void -FindColorInRootCmap (pmap, pentFirst, size, prgb, pPixel, channel, comp) - ColormapPtr pmap; - EntryPtr pentFirst; - int size; - xrgb* prgb; - Pixel* pPixel; - int channel; - ColorCompareProcPtr comp; +FindColorInRootCmap (ColormapPtr pmap, EntryPtr pentFirst, int size, + xrgb *prgb, Pixel *pPixel, int channel, + ColorCompareProcPtr comp) { EntryPtr pent; Pixel pixel; @@ -1231,15 +1203,9 @@ FindColorInRootCmap (pmap, pentFirst, size, prgb, pPixel, channel, comp) * load *pPixel with that value, otherwise set it to 0 */ int -FindColor (pmap, pentFirst, size, prgb, pPixel, channel, client, comp) - ColormapPtr pmap; - EntryPtr pentFirst; - int size; - xrgb *prgb; - Pixel *pPixel; - int channel; - int client; - ColorCompareProcPtr comp; +FindColor (ColormapPtr pmap, EntryPtr pentFirst, int size, xrgb *prgb, + Pixel *pPixel, int channel, int client, + ColorCompareProcPtr comp) { EntryPtr pent; Bool foundFree; @@ -1412,9 +1378,7 @@ gotit: /* Comparison functions -- passed to FindColor to determine if an * entry is already the color we're looking for or not */ static int -AllComp (pent, prgb) - EntryPtr pent; - xrgb *prgb; +AllComp (EntryPtr pent, xrgb *prgb) { if((pent->co.local.red == prgb->red) && (pent->co.local.green == prgb->green) && @@ -1424,9 +1388,7 @@ AllComp (pent, prgb) } static int -RedComp (pent, prgb) - EntryPtr pent; - xrgb *prgb; +RedComp (EntryPtr pent, xrgb *prgb) { if (pent->co.local.red == prgb->red) return (1); @@ -1434,9 +1396,7 @@ RedComp (pent, prgb) } static int -GreenComp (pent, prgb) - EntryPtr pent; - xrgb *prgb; +GreenComp (EntryPtr pent, xrgb *prgb) { if (pent->co.local.green == prgb->green) return (1); @@ -1444,9 +1404,7 @@ GreenComp (pent, prgb) } static int -BlueComp (pent, prgb) - EntryPtr pent; - xrgb *prgb; +BlueComp (EntryPtr pent, xrgb *prgb) { if (pent->co.local.blue == prgb->blue) return (1); @@ -1457,11 +1415,7 @@ BlueComp (pent, prgb) /* Read the color value of a cell */ int -QueryColors (pmap, count, ppixIn, prgbList) - ColormapPtr pmap; - int count; - Pixel *ppixIn; - xrgb *prgbList; +QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList) { Pixel *ppix, pixel; xrgb *prgb; @@ -1546,9 +1500,7 @@ QueryColors (pmap, count, ppixIn, prgbList) } static void -FreePixels(pmap, client) - register ColormapPtr pmap; - register int client; +FreePixels(register ColormapPtr pmap, register int client) { register Pixel *ppix, *ppixStart; register int n; @@ -1637,12 +1589,14 @@ FreePixels(pmap, client) } } -/* Free all of a client's colors and cells */ -/*ARGSUSED*/ +/** + * Frees all of a client's colors and cells. + * + * \param value must conform to DeleteType + * \unused fakeid + */ int -FreeClientPixels (value, fakeid) - pointer value; /* must conform to DeleteType */ - XID fakeid; +FreeClientPixels (pointer value, XID fakeid) { ColormapPtr pmap; colorResource *pcr = (colorResource *)value; @@ -1655,13 +1609,8 @@ FreeClientPixels (value, fakeid) } int -AllocColorCells (client, pmap, colors, planes, contig, ppix, masks) - int client; - ColormapPtr pmap; - int colors, planes; - Bool contig; - Pixel *ppix; - Pixel *masks; +AllocColorCells (int client, ColormapPtr pmap, int colors, int planes, + Bool contig, Pixel *ppix, Pixel *masks) { Pixel rmask, gmask, bmask, *ppixFirst, r, g, b; int n, class; @@ -1732,14 +1681,9 @@ AllocColorCells (client, pmap, colors, planes, contig, ppix, masks) int -AllocColorPlanes (client, pmap, colors, r, g, b, contig, pixels, - prmask, pgmask, pbmask) - int client; - ColormapPtr pmap; - int colors, r, g, b; - Bool contig; - Pixel *pixels; - Pixel *prmask, *pgmask, *pbmask; +AllocColorPlanes (int client, ColormapPtr pmap, int colors, + int r, int g, int b, Bool contig, Pixel *pixels, + Pixel *prmask, Pixel *pgmask, Pixel *pbmask) { int ok; Pixel mask, *ppixFirst; @@ -1827,13 +1771,8 @@ AllocColorPlanes (client, pmap, colors, r, g, b, contig, pixels, } static int -AllocDirect (client, pmap, c, r, g, b, contig, pixels, prmask, pgmask, pbmask) - int client; - ColormapPtr pmap; - int c, r, g, b; - Bool contig; - Pixel *pixels; - Pixel *prmask, *pgmask, *pbmask; +AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool contig, + Pixel *pixels, Pixel *prmask, Pixel *pgmask, Pixel *pbmask) { Pixel *ppixRed, *ppixGreen, *ppixBlue; Pixel *ppix, *pDst, *p; @@ -1951,14 +1890,8 @@ AllocDirect (client, pmap, c, r, g, b, contig, pixels, prmask, pgmask, pbmask) } static int -AllocPseudo (client, pmap, c, r, contig, pixels, pmask, pppixFirst) - int client; - ColormapPtr pmap; - int c, r; - Bool contig; - Pixel *pixels; - Pixel *pmask; - Pixel **pppixFirst; +AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, + Pixel *pixels, Pixel *pmask, Pixel **pppixFirst) { Pixel *ppix, *p, *pDst, *ppixTemp; int npix; @@ -2012,13 +1945,8 @@ AllocPseudo (client, pmap, c, r, contig, pixels, pmask, pppixFirst) * (see AllocShared for why we care) */ static Bool -AllocCP (pmap, pentFirst, count, planes, contig, pixels, pMask) - ColormapPtr pmap; - EntryPtr pentFirst; - int count, planes; - Bool contig; - Pixel *pixels, *pMask; - +AllocCP (ColormapPtr pmap, EntryPtr pentFirst, int count, int planes, + Bool contig, Pixel *pixels, Pixel *pMask) { EntryPtr ent; Pixel pixel, base, entries, maxp, save; @@ -2187,13 +2115,13 @@ AllocCP (pmap, pentFirst, count, planes, contig, pixels, pMask) return (FALSE); } +/** + * + * \param ppixFirst First of the client's new pixels + */ static Bool -AllocShared (pmap, ppix, c, r, g, b, rmask, gmask, bmask, ppixFirst) - ColormapPtr pmap; - Pixel *ppix; - int c, r, g, b; - Pixel rmask, gmask, bmask; - Pixel *ppixFirst; /* First of the client's new pixels */ +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; @@ -2322,14 +2250,11 @@ AllocShared (pmap, ppix, c, r, g, b, rmask, gmask, bmask, ppixFirst) } -/* Free colors and/or cells (probably slow for large numbers) */ - +/** FreeColors + * Free colors and/or cells (probably slow for large numbers) + */ int -FreeColors (pmap, client, count, pixels, mask) - ColormapPtr pmap; - int client, count; - Pixel *pixels; - Pixel mask; +FreeColors (ColormapPtr pmap, int client, int count, Pixel *pixels, Pixel mask) { int rval, result, class; Pixel rmask; @@ -2367,19 +2292,20 @@ FreeColors (pmap, client, count, pixels, mask) return (result); } -/* Helper for FreeColors -- frees all combinations of *newpixels and mask bits +/** + * Helper for FreeColors -- frees all combinations of *newpixels and mask bits * which the client has allocated in channel colormap cells of pmap. - * doesn't change newpixels if it doesn't need to */ + * doesn't change newpixels if it doesn't need to + * + * \param pmap which colormap head + * \param color which sub-map, eg, RED, BLUE, PSEUDO + * \param npixIn number of pixels passed in + * \param ppixIn number of base pixels + * \param mask mask client gave us + */ static int -FreeCo (pmap, client, color, npixIn, ppixIn, mask) - ColormapPtr pmap; /* which colormap head */ - int client; - int color; /* which sub-map, eg RED, BLUE, PSEUDO */ - int npixIn; /* number of pixels passed in */ - Pixel *ppixIn; /* list of base pixels */ - Pixel mask; /* mask client gave us */ +FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixel mask) { - Pixel *ppixClient, pixTest; int npixClient, npixNew, npix; Pixel bits, base, cmask, rgbbad; @@ -2572,10 +2498,7 @@ FreeCo (pmap, client, color, npixIn, ppixIn, mask) /* Redefine color values */ int -StoreColors (pmap, count, defs) - ColormapPtr pmap; - int count; - xColorItem *defs; +StoreColors (ColormapPtr pmap, int count, xColorItem *defs) { register Pixel pix; register xColorItem *pdef; @@ -2842,9 +2765,7 @@ StoreColors (pmap, count, defs) } int -IsMapInstalled(map, pWin) - Colormap map; - WindowPtr pWin; +IsMapInstalled(Colormap map, WindowPtr pWin) { Colormap *pmaps; int imap, nummaps, found; -- cgit v1.2.3