(submit/colormap.h) dix: move colormap flags into colormap_priv.h and rename them
These aren't used by any drivers/modules, so no need to keep them exported. As already touching them, give them a proper name prefix for clarity. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
bc90a3f948
commit
4006ab3249
|
@ -292,7 +292,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
|||
pmap->mid = mid;
|
||||
pmap->flags = 0; /* start out with all flags clear */
|
||||
if (mid == pScreen->defColormap)
|
||||
pmap->flags |= IsDefault;
|
||||
pmap->flags |= CM_IsDefault;
|
||||
pmap->pScreen = pScreen;
|
||||
pmap->pVisual = pVisual;
|
||||
pmap->class = class;
|
||||
|
@ -306,7 +306,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
|||
*pptr = (Pixel *) NULL;
|
||||
if (alloc == AllocAll) {
|
||||
if (class & DynamicClass)
|
||||
pmap->flags |= AllAllocated;
|
||||
pmap->flags |= CM_AllAllocated;
|
||||
for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
|
||||
pent->refcnt = AllocPrivate;
|
||||
pmap->freeRed = 0;
|
||||
|
@ -379,7 +379,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
|||
pmap->numPixelsBlue[client] = size;
|
||||
}
|
||||
}
|
||||
pmap->flags |= BeingCreated;
|
||||
pmap->flags |= CM_BeingCreated;
|
||||
|
||||
if (!AddResource(mid, X11_RESTYPE_COLORMAP, (void *) pmap))
|
||||
return BadAlloc;
|
||||
|
@ -401,7 +401,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
|||
FreeResource(mid, X11_RESTYPE_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
pmap->flags &= ~BeingCreated;
|
||||
pmap->flags &= ~CM_BeingCreated;
|
||||
*ppcmap = pmap;
|
||||
return Success;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ FreeColormap(void *value, XID mid)
|
|||
}
|
||||
}
|
||||
|
||||
if (pmap->flags & IsDefault) {
|
||||
if (pmap->flags & CM_IsDefault) {
|
||||
dixFreePrivates(pmap->devPrivates, PRIVATE_COLORMAP);
|
||||
free(pmap);
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ CopyColormapAndFree(Colormap mid, ColormapPtr pSrc, int client)
|
|||
pScreen = pSrc->pScreen;
|
||||
pVisual = pSrc->pVisual;
|
||||
midSrc = pSrc->mid;
|
||||
alloc = ((pSrc->flags & AllAllocated) && CLIENT_ID(midSrc) == client) ?
|
||||
alloc = ((pSrc->flags & CM_AllAllocated) && CLIENT_ID(midSrc) == client) ?
|
||||
AllocAll : AllocNone;
|
||||
size = pVisual->ColormapEntries;
|
||||
|
||||
|
@ -564,7 +564,7 @@ CopyColormapAndFree(Colormap mid, ColormapPtr pSrc, int client)
|
|||
memmove((char *) pmap->blue, (char *) pSrc->blue,
|
||||
size * sizeof(Entry));
|
||||
}
|
||||
pSrc->flags &= ~AllAllocated;
|
||||
pSrc->flags &= ~CM_AllAllocated;
|
||||
FreePixels(pSrc, client);
|
||||
doUpdateColors(pmap);
|
||||
return Success;
|
||||
|
@ -810,7 +810,7 @@ FindColor(ColormapPtr pmap, EntryPtr pentFirst, int size, xrgb * prgb,
|
|||
/* If we're initializing the colormap, then we are looking for
|
||||
* the first free cell we can find, not to minimize the number
|
||||
* of entries we use. So don't look any further. */
|
||||
if (pmap->flags & BeingCreated)
|
||||
if (pmap->flags & CM_BeingCreated)
|
||||
break;
|
||||
}
|
||||
pixel++;
|
||||
|
@ -883,7 +883,7 @@ FindColor(ColormapPtr pmap, EntryPtr pentFirst, int size, xrgb * prgb,
|
|||
*pPixel = def.pixel;
|
||||
|
||||
gotit:
|
||||
if (pmap->flags & BeingCreated || client == -1)
|
||||
if (pmap->flags & CM_BeingCreated || client == -1)
|
||||
return Success;
|
||||
/* Now remember the pixel, for freeing later */
|
||||
switch (channel) {
|
||||
|
@ -957,7 +957,7 @@ AllocColor(ColormapPtr pmap,
|
|||
* the colormap, even if it's a static type. Otherwise, we'd never be
|
||||
* able to initialize static colormaps
|
||||
*/
|
||||
if (pmap->flags & BeingCreated)
|
||||
if (pmap->flags & CM_BeingCreated)
|
||||
class |= DynamicClass;
|
||||
|
||||
/* If this is one of the static storage classes, and we're not initializing
|
||||
|
@ -1088,7 +1088,7 @@ AllocColor(ColormapPtr pmap,
|
|||
* resource manager that the client has pixels in this colormap which
|
||||
* should be freed when the client dies */
|
||||
if ((pmap->numPixelsRed[client] == 1) &&
|
||||
(CLIENT_ID(pmap->mid) != client) && !(pmap->flags & BeingCreated)) {
|
||||
(CLIENT_ID(pmap->mid) != client) && !(pmap->flags & CM_BeingCreated)) {
|
||||
colorResource *pcr;
|
||||
|
||||
pcr = malloc(sizeof(colorResource));
|
||||
|
@ -2078,7 +2078,7 @@ FreeColors(ColormapPtr pmap, int client, int count, Pixel * pixels, Pixel mask)
|
|||
Pixel rmask;
|
||||
|
||||
class = pmap->class;
|
||||
if (pmap->flags & AllAllocated)
|
||||
if (pmap->flags & CM_AllAllocated)
|
||||
return BadAccess;
|
||||
if ((class | DynamicClass) == DirectColor) {
|
||||
rmask = mask & RGBMASK(pmap->pVisual);
|
||||
|
@ -2260,7 +2260,7 @@ StoreColors(ColormapPtr pmap, int count, xColorItem * defs, ClientPtr client)
|
|||
int ok;
|
||||
|
||||
class = pmap->class;
|
||||
if (!(class & DynamicClass) && !(pmap->flags & BeingCreated)) {
|
||||
if (!(class & DynamicClass) && !(pmap->flags & CM_BeingCreated)) {
|
||||
return BadAccess;
|
||||
}
|
||||
pVisual = pmap->pVisual;
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
#include "include/dix.h"
|
||||
#include "include/window.h"
|
||||
|
||||
/* Values for the flags field of a colormap. These should have 1 bit set
|
||||
* and not overlap */
|
||||
#define CM_IsDefault 1
|
||||
#define CM_AllAllocated 2
|
||||
#define CM_BeingCreated 4
|
||||
|
||||
typedef struct _CMEntry *EntryPtr;
|
||||
|
||||
int CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||
|
|
|
@ -2489,7 +2489,7 @@ ProcFreeColormap(ClientPtr client)
|
|||
client, DixDestroyAccess);
|
||||
if (rc == Success) {
|
||||
/* Freeing a default colormap is a no-op */
|
||||
if (!(pmap->flags & IsDefault))
|
||||
if (!(pmap->flags & CM_IsDefault))
|
||||
FreeResource(stuff->id, X11_RESTYPE_NONE);
|
||||
return Success;
|
||||
}
|
||||
|
@ -2835,7 +2835,7 @@ ProcFreeColors(ClientPtr client)
|
|||
if (rc == Success) {
|
||||
int count;
|
||||
|
||||
if (pcmp->flags & AllAllocated)
|
||||
if (pcmp->flags & CM_AllAllocated)
|
||||
return BadAccess;
|
||||
count = bytes_to_int32((client->req_len << 2) - sizeof(xFreeColorsReq));
|
||||
return FreeColors(pcmp, client->index, count,
|
||||
|
|
|
@ -2736,7 +2736,7 @@ If the colormap is static, which you can tell by looking at the class field,
|
|||
you will want to fill in each color cell to match the hardwares notion of the
|
||||
color for that pixel.
|
||||
If the colormap is the default for the screen, which you can tell by looking
|
||||
at the IsDefault bit in the flags field, you should allocate BlackPixel
|
||||
at the CM_IsDefault bit in the flags field, you should allocate BlackPixel
|
||||
and WhitePixel to match the values you set in the pScreen structure.
|
||||
(Of course, you picked those values to begin with.)</para>
|
||||
<para>
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#endif
|
||||
#include "win.h"
|
||||
|
||||
#include "dix/colormap_priv.h"
|
||||
|
||||
#define FAIL_MSG_MAX_BLT 10
|
||||
|
||||
/*
|
||||
|
@ -1135,7 +1137,7 @@ winDestroyColormapShadowDDNL(ColormapPtr pColormap)
|
|||
* will not have had winUninstallColormap called on it. Thus,
|
||||
* we need to handle the default colormap in a special way.
|
||||
*/
|
||||
if (pColormap->flags & IsDefault) {
|
||||
if (pColormap->flags & CM_IsDefault) {
|
||||
#if ENABLE_DEBUG
|
||||
winDebug
|
||||
("winDestroyColormapShadowDDNL - Destroying default colormap\n");
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#endif
|
||||
#include "win.h"
|
||||
|
||||
#include "dix/colormap_priv.h"
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
@ -1209,7 +1211,7 @@ winDestroyColormapShadowGDI(ColormapPtr pColormap)
|
|||
* will not have had winUninstallColormap called on it. Thus,
|
||||
* we need to handle the default colormap in a special way.
|
||||
*/
|
||||
if (pColormap->flags & IsDefault) {
|
||||
if (pColormap->flags & CM_IsDefault) {
|
||||
#if ENABLE_DEBUG
|
||||
winDebug("winDestroyColormapShadowGDI - Destroying default "
|
||||
"colormap\n");
|
||||
|
|
|
@ -53,12 +53,6 @@ SOFTWARE.
|
|||
|
||||
#define DynamicClass 1
|
||||
|
||||
/* Values for the flags field of a colormap. These should have 1 bit set
|
||||
* and not overlap */
|
||||
#define IsDefault 1
|
||||
#define AllAllocated 2
|
||||
#define BeingCreated 4
|
||||
|
||||
typedef CARD32 Pixel;
|
||||
|
||||
extern _X_EXPORT Bool ResizeVisualArray(ScreenPtr /* pScreen */ ,
|
||||
|
|
|
@ -91,8 +91,8 @@ typedef struct _ColormapRec {
|
|||
short class; /* PseudoColor or DirectColor */
|
||||
XID mid; /* client's name for colormap */
|
||||
ScreenPtr pScreen; /* screen map is associated with */
|
||||
short flags; /* 1 = IsDefault
|
||||
* 2 = AllAllocated */
|
||||
short flags; /* 1 = CM_IsDefault
|
||||
* 2 = CM_AllAllocated */
|
||||
int freeRed;
|
||||
int freeGreen;
|
||||
int freeBlue;
|
||||
|
|
Loading…
Reference in New Issue