fbcmap_mi.c revision 6747b715
16747b715Smrg/*
26747b715Smrg * Copyright © 1987 Sun Microsystems, Inc.  All rights reserved.
36747b715Smrg *
46747b715Smrg * Permission is hereby granted, free of charge, to any person obtaining a
56747b715Smrg * copy of this software and associated documentation files (the "Software"),
66747b715Smrg * to deal in the Software without restriction, including without limitation
76747b715Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
86747b715Smrg * and/or sell copies of the Software, and to permit persons to whom the
96747b715Smrg * Software is furnished to do so, subject to the following conditions:
106747b715Smrg *
116747b715Smrg * The above copyright notice and this permission notice (including the next
126747b715Smrg * paragraph) shall be included in all copies or substantial portions of the
136747b715Smrg * Software.
146747b715Smrg *
156747b715Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
166747b715Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
176747b715Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
186747b715Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
196747b715Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
206747b715Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
216747b715Smrg * DEALINGS IN THE SOFTWARE.
226747b715Smrg */
2305b261ecSmrg
2405b261ecSmrg/**
2505b261ecSmrg * This version of fbcmap.c is implemented in terms of mi functions.
2605b261ecSmrg * These functions used to be in fbcmap.c and depended upon the symbol
2705b261ecSmrg * XFree86Server being defined.
2805b261ecSmrg */
2905b261ecSmrg
3005b261ecSmrg
3105b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
3205b261ecSmrg#include <dix-config.h>
3305b261ecSmrg#endif
3405b261ecSmrg
3505b261ecSmrg#include <X11/X.h>
3605b261ecSmrg#include "fb.h"
3705b261ecSmrg#include "micmap.h"
3805b261ecSmrg
3905b261ecSmrgint
4005b261ecSmrgfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
4105b261ecSmrg{
4205b261ecSmrg    return miListInstalledColormaps(pScreen, pmaps);
4305b261ecSmrg}
4405b261ecSmrg
4505b261ecSmrgvoid
4605b261ecSmrgfbInstallColormap(ColormapPtr pmap)
4705b261ecSmrg{
4805b261ecSmrg    miInstallColormap(pmap);
4905b261ecSmrg}
5005b261ecSmrg
5105b261ecSmrgvoid
5205b261ecSmrgfbUninstallColormap(ColormapPtr pmap)
5305b261ecSmrg{
5405b261ecSmrg    miUninstallColormap(pmap);
5505b261ecSmrg}
5605b261ecSmrg
5705b261ecSmrgvoid
5805b261ecSmrgfbResolveColor(unsigned short   *pred,
5905b261ecSmrg	       unsigned short   *pgreen,
6005b261ecSmrg	       unsigned short   *pblue,
6105b261ecSmrg	       VisualPtr	pVisual)
6205b261ecSmrg{
6305b261ecSmrg    miResolveColor(pred, pgreen, pblue, pVisual);
6405b261ecSmrg}
6505b261ecSmrg
6605b261ecSmrgBool
6705b261ecSmrgfbInitializeColormap(ColormapPtr pmap)
6805b261ecSmrg{
6905b261ecSmrg    return miInitializeColormap(pmap);
7005b261ecSmrg}
7105b261ecSmrg
7205b261ecSmrgint
7305b261ecSmrgfbExpandDirectColors (ColormapPtr   pmap,
7405b261ecSmrg		      int	    ndef,
7505b261ecSmrg		      xColorItem    *indefs,
7605b261ecSmrg		      xColorItem    *outdefs)
7705b261ecSmrg{
7805b261ecSmrg    return miExpandDirectColors(pmap, ndef, indefs, outdefs);
7905b261ecSmrg}
8005b261ecSmrg
8105b261ecSmrgBool
8205b261ecSmrgfbCreateDefColormap(ScreenPtr pScreen)
8305b261ecSmrg{
8405b261ecSmrg    return miCreateDefColormap(pScreen);
8505b261ecSmrg}
8605b261ecSmrg
8705b261ecSmrgvoid
8805b261ecSmrgfbClearVisualTypes(void)
8905b261ecSmrg{
9005b261ecSmrg    miClearVisualTypes();
9105b261ecSmrg}
9205b261ecSmrg
9305b261ecSmrgBool
9405b261ecSmrgfbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
9505b261ecSmrg{
9605b261ecSmrg    return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
9705b261ecSmrg}
9805b261ecSmrg
994642e01fSmrgBool
1004642e01fSmrgfbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
1014642e01fSmrg                          Pixel redMask, Pixel greenMask, Pixel blueMask)
1024642e01fSmrg{
1034642e01fSmrg    return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1,
1044642e01fSmrg                                    redMask, greenMask, blueMask);
1054642e01fSmrg}
1064642e01fSmrg
10705b261ecSmrg/*
10805b261ecSmrg * Given a list of formats for a screen, create a list
10905b261ecSmrg * of visuals and depths for the screen which coorespond to
11005b261ecSmrg * the set which can be used with this version of fb.
11105b261ecSmrg */
11205b261ecSmrgBool
11305b261ecSmrgfbInitVisuals (VisualPtr    *visualp,
11405b261ecSmrg	       DepthPtr	    *depthp,
11505b261ecSmrg	       int	    *nvisualp,
11605b261ecSmrg	       int	    *ndepthp,
11705b261ecSmrg	       int	    *rootDepthp,
11805b261ecSmrg	       VisualID	    *defaultVisp,
11905b261ecSmrg	       unsigned long	sizes,
12005b261ecSmrg	       int	    bitsPerRGB)
12105b261ecSmrg{
12205b261ecSmrg    return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
12305b261ecSmrg			 defaultVisp, sizes, bitsPerRGB, -1);
12405b261ecSmrg}
125