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