aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/src/kcmap.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-01-08 13:59:32 +0000
committermarha <marha@users.sourceforge.net>2010-01-08 13:59:32 +0000
commit1ae1f3dee798a8468a415eaa8f1da78e9d3fbae8 (patch)
tree5ff2d27dc0c94b02beedeb4551f677691e606352 /xorg-server/hw/kdrive/src/kcmap.c
parentd5ac51b006c039894e4e35102a8e182d21a52efc (diff)
parent91a30d5622174febaa2107b010effcf2fb5b9a2e (diff)
downloadvcxsrv-1ae1f3dee798a8468a415eaa8f1da78e9d3fbae8.tar.gz
vcxsrv-1ae1f3dee798a8468a415eaa8f1da78e9d3fbae8.tar.bz2
vcxsrv-1ae1f3dee798a8468a415eaa8f1da78e9d3fbae8.zip
svn merge ^/branches/released
Diffstat (limited to 'xorg-server/hw/kdrive/src/kcmap.c')
-rw-r--r--xorg-server/hw/kdrive/src/kcmap.c145
1 files changed, 48 insertions, 97 deletions
diff --git a/xorg-server/hw/kdrive/src/kcmap.c b/xorg-server/hw/kdrive/src/kcmap.c
index 2c33e798a..40697e091 100644
--- a/xorg-server/hw/kdrive/src/kcmap.c
+++ b/xorg-server/hw/kdrive/src/kcmap.c
@@ -30,10 +30,10 @@
*/
void
-KdSetColormap (ScreenPtr pScreen, int fb)
+KdSetColormap (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- ColormapPtr pCmap = pScreenPriv->pInstalledmap[fb];
+ ColormapPtr pCmap = pScreenPriv->pInstalledmap;
Pixel pixels[KD_MAX_PSEUDO_SIZE];
xrgb colors[KD_MAX_PSEUDO_SIZE];
xColorItem defs[KD_MAX_PSEUDO_SIZE];
@@ -41,12 +41,12 @@ KdSetColormap (ScreenPtr pScreen, int fb)
if (!pScreenPriv->card->cfuncs->putColors)
return;
- if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
+ if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
return;
-
+
if (!pScreenPriv->enabled)
return;
-
+
if (!pCmap)
return;
@@ -54,13 +54,13 @@ KdSetColormap (ScreenPtr pScreen, int fb)
* Make DIX convert pixels into RGB values -- this handles
* true/direct as well as pseudo/static visuals
*/
-
- for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
+
+ for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
pixels[i] = i;
- QueryColors (pCmap, (1 << pScreenPriv->screen->fb[fb].depth), pixels, colors);
-
- for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
+ QueryColors (pCmap, (1 << pScreenPriv->screen->fb.depth), pixels, colors);
+
+ for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
{
defs[i].pixel = i;
defs[i].red = colors[i].red;
@@ -69,8 +69,8 @@ KdSetColormap (ScreenPtr pScreen, int fb)
defs[i].flags = DoRed|DoGreen|DoBlue;
}
- (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb,
- (1 << pScreenPriv->screen->fb[fb].depth),
+ (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen,
+ (1 << pScreenPriv->screen->fb.depth),
defs);
/* recolor hardware cursor */
@@ -87,77 +87,35 @@ KdEnableColormap (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
int i;
- int fb;
- Bool done = FALSE;
if (!pScreenPriv->card->cfuncs->putColors)
return;
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
+
+ if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH)
{
- if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH && !done)
- {
- for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
- pScreenPriv->systemPalette[i].pixel = i;
- (*pScreenPriv->card->cfuncs->getColors) (pScreen, fb,
- (1 << pScreenPriv->screen->fb[fb].depth),
- pScreenPriv->systemPalette);
- done = TRUE;
- }
- KdSetColormap (pScreen, fb);
+ for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
+ pScreenPriv->systemPalette[i].pixel = i;
+ (*pScreenPriv->card->cfuncs->getColors) (pScreen,
+ (1 << pScreenPriv->screen->fb.depth),
+ pScreenPriv->systemPalette);
}
+ KdSetColormap (pScreen);
}
void
KdDisableColormap (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
- int fb;
if (!pScreenPriv->card->cfuncs->putColors)
return;
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
- {
- if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH)
- {
- (*pScreenPriv->card->cfuncs->putColors) (pScreen, fb,
- (1 << pScreenPriv->screen->fb[fb].depth),
- pScreenPriv->systemPalette);
- break;
- }
- }
-}
-static int
-KdColormapFb (ColormapPtr pCmap)
-{
- ScreenPtr pScreen = pCmap->pScreen;
- KdScreenPriv (pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- int d;
- DepthPtr depth;
- int v;
- VisualID vid = pCmap->pVisual->vid;
- int fb;
-
- if (screen->fb[1].depth)
+ if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH)
{
- for (d = 0; d < pScreen->numDepths; d++)
- {
- depth = &pScreen->allowedDepths[d];
- for (v = 0; v < depth->numVids; v++)
- {
- if (depth->vids[v] == vid)
- {
- for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
- {
- if (depth->depth == screen->fb[fb].depth)
- return fb;
- }
- }
- }
- }
+ (*pScreenPriv->card->cfuncs->putColors) (pScreen,
+ (1 << pScreenPriv->screen->fb.depth),
+ pScreenPriv->systemPalette);
}
- return 0;
}
/*
@@ -173,21 +131,20 @@ void
KdInstallColormap (ColormapPtr pCmap)
{
KdScreenPriv(pCmap->pScreen);
- int fb = KdColormapFb (pCmap);
- if (pCmap == pScreenPriv->pInstalledmap[fb])
+ if (pCmap == pScreenPriv->pInstalledmap)
return;
/* Tell X clients that the installed colormap is going away. */
- if (pScreenPriv->pInstalledmap[fb])
- WalkTree(pScreenPriv->pInstalledmap[fb]->pScreen, TellLostMap,
- (pointer) &(pScreenPriv->pInstalledmap[fb]->mid));
+ if (pScreenPriv->pInstalledmap)
+ WalkTree(pScreenPriv->pInstalledmap->pScreen, TellLostMap,
+ (pointer) &(pScreenPriv->pInstalledmap->mid));
/* Take note of the new installed colorscreen-> */
- pScreenPriv->pInstalledmap[fb] = pCmap;
+ pScreenPriv->pInstalledmap = pCmap;
+
+ KdSetColormap (pCmap->pScreen);
- KdSetColormap (pCmap->pScreen, fb);
-
/* Tell X clients of the new colormap */
WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
}
@@ -195,7 +152,7 @@ KdInstallColormap (ColormapPtr pCmap)
/*
* KdUninstallColormap
*
- * This function uninstalls a colormap by either installing
+ * This function uninstalls a colormap by either installing
* the default X colormap or erasing the installed colormap pointer.
* The default X colormap itself cannot be uninstalled.
*/
@@ -203,12 +160,11 @@ void
KdUninstallColormap (ColormapPtr pCmap)
{
KdScreenPriv(pCmap->pScreen);
- int fb = KdColormapFb (pCmap);
Colormap defMapID;
ColormapPtr defMap;
/* ignore if not installed */
- if (pCmap != pScreenPriv->pInstalledmap[fb])
+ if (pCmap != pScreenPriv->pInstalledmap)
return;
/* ignore attempts to uninstall default colormap */
@@ -216,17 +172,17 @@ KdUninstallColormap (ColormapPtr pCmap)
if ((Colormap) pCmap->mid == defMapID)
return;
- /* install default if on same fb */
+ /* install default */
dixLookupResourceByType((pointer *)&defMap, defMapID, RT_COLORMAP,
serverClient, DixInstallAccess);
- if (defMap && KdColormapFb (defMap) == fb)
+ if (defMap)
(*pCmap->pScreen->InstallColormap)(defMap);
else
{
/* uninstall and clear colormap pointer */
WalkTree(pCmap->pScreen, TellLostMap,
(pointer) &(pCmap->mid));
- pScreenPriv->pInstalledmap[fb] = 0;
+ pScreenPriv->pInstalledmap = 0;
}
}
@@ -234,16 +190,12 @@ int
KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
{
KdScreenPriv(pScreen);
- int fb;
int n = 0;
-
- for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
+
+ if (pScreenPriv->pInstalledmap)
{
- if (pScreenPriv->pInstalledmap[fb])
- {
- *pCmaps++ = pScreenPriv->pInstalledmap[fb]->mid;
- n++;
- }
+ *pCmaps++ = pScreenPriv->pInstalledmap->mid;
+ n++;
}
return n;
}
@@ -261,20 +213,19 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
KdScreenPriv(pCmap->pScreen);
VisualPtr pVisual;
xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
- int fb = KdColormapFb (pCmap);
- if (pCmap != pScreenPriv->pInstalledmap[fb])
+ if (pCmap != pScreenPriv->pInstalledmap)
return;
-
+
if (!pScreenPriv->card->cfuncs->putColors)
return;
-
- if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
+
+ if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
return;
-
+
if (!pScreenPriv->enabled)
return;
-
+
/* Check for DirectColor or TrueColor being simulated on a PseudoColor device. */
pVisual = pCmap->pVisual;
if ((pVisual->class | DynamicClass) == DirectColor)
@@ -287,8 +238,8 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
pdefs = expanddefs;
}
- (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb, ndef, pdefs);
-
+ (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, ndef, pdefs);
+
/* recolor hardware cursor */
if (pScreenPriv->card->cfuncs->recolorCursor)
(*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, ndef, pdefs);