fbcmap_mi.c revision 4642e01f
105b261ecSmrg/************************************************************
205b261ecSmrgCopyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
305b261ecSmrg
405b261ecSmrg                    All Rights Reserved
505b261ecSmrg
605b261ecSmrgPermission  to  use,  copy,  modify,  and  distribute   this
705b261ecSmrgsoftware  and  its documentation for any purpose and without
805b261ecSmrgfee is hereby granted, provided that the above copyright no-
905b261ecSmrgtice  appear  in all copies and that both that copyright no-
1005b261ecSmrgtice and this permission notice appear in  supporting  docu-
1105b261ecSmrgmentation,  and  that the names of Sun or X Consortium
1205b261ecSmrgnot be used in advertising or publicity pertaining to
1305b261ecSmrgdistribution  of  the software  without specific prior
1405b261ecSmrgwritten permission. Sun and X Consortium make no
1505b261ecSmrgrepresentations about the suitability of this software for
1605b261ecSmrgany purpose. It is provided "as is" without any express or
1705b261ecSmrgimplied warranty.
1805b261ecSmrg
1905b261ecSmrgSUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
2005b261ecSmrgINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
2105b261ecSmrgNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
2205b261ecSmrgABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
2305b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
2405b261ecSmrgPROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
2505b261ecSmrgOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
2605b261ecSmrgTHE USE OR PERFORMANCE OF THIS SOFTWARE.
2705b261ecSmrg
2805b261ecSmrg********************************************************/
2905b261ecSmrg
3005b261ecSmrg
3105b261ecSmrg/**
3205b261ecSmrg * This version of fbcmap.c is implemented in terms of mi functions.
3305b261ecSmrg * These functions used to be in fbcmap.c and depended upon the symbol
3405b261ecSmrg * XFree86Server being defined.
3505b261ecSmrg */
3605b261ecSmrg
3705b261ecSmrg
3805b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
3905b261ecSmrg#include <dix-config.h>
4005b261ecSmrg#endif
4105b261ecSmrg
4205b261ecSmrg#include <X11/X.h>
4305b261ecSmrg#include "fb.h"
4405b261ecSmrg#include "micmap.h"
4505b261ecSmrg
4605b261ecSmrgint
4705b261ecSmrgfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
4805b261ecSmrg{
4905b261ecSmrg    return miListInstalledColormaps(pScreen, pmaps);
5005b261ecSmrg}
5105b261ecSmrg
5205b261ecSmrgvoid
5305b261ecSmrgfbInstallColormap(ColormapPtr pmap)
5405b261ecSmrg{
5505b261ecSmrg    miInstallColormap(pmap);
5605b261ecSmrg}
5705b261ecSmrg
5805b261ecSmrgvoid
5905b261ecSmrgfbUninstallColormap(ColormapPtr pmap)
6005b261ecSmrg{
6105b261ecSmrg    miUninstallColormap(pmap);
6205b261ecSmrg}
6305b261ecSmrg
6405b261ecSmrgvoid
6505b261ecSmrgfbResolveColor(unsigned short   *pred,
6605b261ecSmrg	       unsigned short   *pgreen,
6705b261ecSmrg	       unsigned short   *pblue,
6805b261ecSmrg	       VisualPtr	pVisual)
6905b261ecSmrg{
7005b261ecSmrg    miResolveColor(pred, pgreen, pblue, pVisual);
7105b261ecSmrg}
7205b261ecSmrg
7305b261ecSmrgBool
7405b261ecSmrgfbInitializeColormap(ColormapPtr pmap)
7505b261ecSmrg{
7605b261ecSmrg    return miInitializeColormap(pmap);
7705b261ecSmrg}
7805b261ecSmrg
7905b261ecSmrgint
8005b261ecSmrgfbExpandDirectColors (ColormapPtr   pmap,
8105b261ecSmrg		      int	    ndef,
8205b261ecSmrg		      xColorItem    *indefs,
8305b261ecSmrg		      xColorItem    *outdefs)
8405b261ecSmrg{
8505b261ecSmrg    return miExpandDirectColors(pmap, ndef, indefs, outdefs);
8605b261ecSmrg}
8705b261ecSmrg
8805b261ecSmrgBool
8905b261ecSmrgfbCreateDefColormap(ScreenPtr pScreen)
9005b261ecSmrg{
9105b261ecSmrg    return miCreateDefColormap(pScreen);
9205b261ecSmrg}
9305b261ecSmrg
9405b261ecSmrgvoid
9505b261ecSmrgfbClearVisualTypes(void)
9605b261ecSmrg{
9705b261ecSmrg    miClearVisualTypes();
9805b261ecSmrg}
9905b261ecSmrg
10005b261ecSmrgBool
10105b261ecSmrgfbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
10205b261ecSmrg{
10305b261ecSmrg    return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
10405b261ecSmrg}
10505b261ecSmrg
1064642e01fSmrgBool
1074642e01fSmrgfbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
1084642e01fSmrg                          Pixel redMask, Pixel greenMask, Pixel blueMask)
1094642e01fSmrg{
1104642e01fSmrg    return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1,
1114642e01fSmrg                                    redMask, greenMask, blueMask);
1124642e01fSmrg}
1134642e01fSmrg
11405b261ecSmrg/*
11505b261ecSmrg * Given a list of formats for a screen, create a list
11605b261ecSmrg * of visuals and depths for the screen which coorespond to
11705b261ecSmrg * the set which can be used with this version of fb.
11805b261ecSmrg */
11905b261ecSmrgBool
12005b261ecSmrgfbInitVisuals (VisualPtr    *visualp,
12105b261ecSmrg	       DepthPtr	    *depthp,
12205b261ecSmrg	       int	    *nvisualp,
12305b261ecSmrg	       int	    *ndepthp,
12405b261ecSmrg	       int	    *rootDepthp,
12505b261ecSmrg	       VisualID	    *defaultVisp,
12605b261ecSmrg	       unsigned long	sizes,
12705b261ecSmrg	       int	    bitsPerRGB)
12805b261ecSmrg{
12905b261ecSmrg    return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
13005b261ecSmrg			 defaultVisp, sizes, bitsPerRGB, -1);
13105b261ecSmrg}
132