1 /*
2  * Copyright (c) 1987, Oracle and/or its affiliates. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 /**
25  * This version of fbcmap.c is implemented in terms of mi functions.
26  * These functions used to be in fbcmap.c and depended upon the symbol
27  * XFree86Server being defined.
28  */
29 
30 #ifdef HAVE_DIX_CONFIG_H
31 #include <dix-config.h>
32 #endif
33 
34 #include <X11/X.h>
35 #include "fb.h"
36 #include "micmap.h"
37 
38 int
fbListInstalledColormaps(ScreenPtr pScreen,Colormap * pmaps)39 fbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps)
40 {
41     return miListInstalledColormaps(pScreen, pmaps);
42 }
43 
44 void
fbInstallColormap(ColormapPtr pmap)45 fbInstallColormap(ColormapPtr pmap)
46 {
47     miInstallColormap(pmap);
48 }
49 
50 void
fbUninstallColormap(ColormapPtr pmap)51 fbUninstallColormap(ColormapPtr pmap)
52 {
53     miUninstallColormap(pmap);
54 }
55 
56 void
fbResolveColor(unsigned short * pred,unsigned short * pgreen,unsigned short * pblue,VisualPtr pVisual)57 fbResolveColor(unsigned short *pred,
58                unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual)
59 {
60     miResolveColor(pred, pgreen, pblue, pVisual);
61 }
62 
63 Bool
fbInitializeColormap(ColormapPtr pmap)64 fbInitializeColormap(ColormapPtr pmap)
65 {
66     return miInitializeColormap(pmap);
67 }
68 
69 int
fbExpandDirectColors(ColormapPtr pmap,int ndef,xColorItem * indefs,xColorItem * outdefs)70 fbExpandDirectColors(ColormapPtr pmap,
71                      int ndef, xColorItem * indefs, xColorItem * outdefs)
72 {
73     return miExpandDirectColors(pmap, ndef, indefs, outdefs);
74 }
75 
76 Bool
fbCreateDefColormap(ScreenPtr pScreen)77 fbCreateDefColormap(ScreenPtr pScreen)
78 {
79     return miCreateDefColormap(pScreen);
80 }
81 
82 void
fbClearVisualTypes(void)83 fbClearVisualTypes(void)
84 {
85     miClearVisualTypes();
86 }
87 
88 Bool
fbSetVisualTypes(int depth,int visuals,int bitsPerRGB)89 fbSetVisualTypes(int depth, int visuals, int bitsPerRGB)
90 {
91     return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
92 }
93 
94 Bool
fbSetVisualTypesAndMasks(int depth,int visuals,int bitsPerRGB,Pixel redMask,Pixel greenMask,Pixel blueMask)95 fbSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
96                          Pixel redMask, Pixel greenMask, Pixel blueMask)
97 {
98     return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1,
99                                     redMask, greenMask, blueMask);
100 }
101 
102 /*
103  * Given a list of formats for a screen, create a list
104  * of visuals and depths for the screen which coorespond to
105  * the set which can be used with this version of fb.
106  */
107 Bool
fbInitVisuals(VisualPtr * visualp,DepthPtr * depthp,int * nvisualp,int * ndepthp,int * rootDepthp,VisualID * defaultVisp,unsigned long sizes,int bitsPerRGB)108 fbInitVisuals(VisualPtr * visualp,
109               DepthPtr * depthp,
110               int *nvisualp,
111               int *ndepthp,
112               int *rootDepthp,
113               VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB)
114 {
115     return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
116                          defaultVisp, sizes, bitsPerRGB, -1);
117 }
118