saver: Don't open-code IsMapInstalled
Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
16
Xext/saver.c
16
Xext/saver.c
@@ -467,9 +467,6 @@ CreateSaverWindow(ScreenPtr pScreen)
|
|||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
int result;
|
int result;
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
Colormap *installedMaps;
|
|
||||||
int numInstalled;
|
|
||||||
int i;
|
|
||||||
Colormap wantMap;
|
Colormap wantMap;
|
||||||
ColormapPtr pCmap;
|
ColormapPtr pCmap;
|
||||||
|
|
||||||
@@ -545,18 +542,7 @@ CreateSaverWindow(ScreenPtr pScreen)
|
|||||||
|
|
||||||
/* check and install our own colormap if it isn't installed now */
|
/* check and install our own colormap if it isn't installed now */
|
||||||
wantMap = wColormap(pWin);
|
wantMap = wColormap(pWin);
|
||||||
if (wantMap == None)
|
if (wantMap == None || IsMapInstalled(wantMap, pWin))
|
||||||
return TRUE;
|
|
||||||
installedMaps = malloc(pScreen->maxInstalledCmaps * sizeof(Colormap));
|
|
||||||
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
|
|
||||||
(pScreen, installedMaps);
|
|
||||||
for (i = 0; i < numInstalled; i++)
|
|
||||||
if (installedMaps[i] == wantMap)
|
|
||||||
break;
|
|
||||||
|
|
||||||
free((char *) installedMaps);
|
|
||||||
|
|
||||||
if (i < numInstalled)
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
|
result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
|
||||||
|
|||||||
Reference in New Issue
Block a user