1
/* $XFree86: xc/programs/Xserver/iplan2p4/iplscrinit.c,v 3.2 1998/06/27 12:55:03 hohndel Exp $ */
2
/************************************************************
3
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
7
Permission to use, copy, modify, and distribute this
8
software and its documentation for any purpose and without
9
fee is hereby granted, provided that the above copyright no-
10
tice appear in all copies and that both that copyright no-
11
tice and this permission notice appear in supporting docu-
12
mentation, and that the names of Sun or X Consortium
13
not be used in advertising or publicity pertaining to
14
distribution of the software without specific prior
15
written permission. Sun and X Consortium make no
16
representations about the suitability of this software for
17
any purpose. It is provided "as is" without any express or
20
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
21
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
22
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
23
ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
24
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
25
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
27
THE USE OR PERFORMANCE OF THIS SOFTWARE.
29
********************************************************/
30
/* $XConsortium: iplscrinit.c,v 5.32 94/04/17 20:29:00 dpw Exp $ */
32
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
35
#ifdef HAVE_DIX_CONFIG_H
36
#include <dix-config.h>
42
#include "scrnintstr.h"
43
#include "pixmapstr.h"
46
#include "colormapst.h"
54
BSFuncRec iplBSFuncRec = {
57
(BackingStoreSetClipmaskRgnProcPtr) 0,
58
(BackingStoreGetImagePixmapProcPtr) 0,
59
(BackingStoreGetSpansPixmapProcPtr) 0,
63
iplCloseScreen (index, pScreen)
68
DepthPtr depths = pScreen->allowedDepths;
70
for (d = 0; d < pScreen->numDepths; d++)
71
xfree (depths[d].vids);
73
xfree (pScreen->visuals);
74
#ifdef CFB_NEED_SCREEN_PRIVATE
75
xfree (pScreen->devPrivates[iplScreenPrivateIndex].ptr);
77
xfree (pScreen->devPrivate);
83
iplSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
84
register ScreenPtr pScreen;
85
pointer pbits; /* pointer to screen bitmap */
86
int xsize, ysize; /* in pixels */
87
int dpix, dpiy; /* dots per inch */
88
int width; /* pixel width of frame buffer */
91
extern RegionPtr (*iplPuntCopyPlane)();
93
if (!iplAllocatePrivates(pScreen, (int *) 0, (int *) 0))
95
pScreen->defColormap = FakeClientID(0);
96
/* let CreateDefColormap do whatever it wants for pixels */
97
pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
98
pScreen->QueryBestSize = mfbQueryBestSize;
100
pScreen->GetImage = iplGetImage;
101
pScreen->GetSpans = iplGetSpans;
102
pScreen->CreateWindow = iplCreateWindow;
103
pScreen->DestroyWindow = iplDestroyWindow;
104
pScreen->PositionWindow = iplPositionWindow;
105
pScreen->ChangeWindowAttributes = iplChangeWindowAttributes;
106
pScreen->RealizeWindow = iplMapWindow;
107
pScreen->UnrealizeWindow = iplUnmapWindow;
108
pScreen->PaintWindowBackground = iplPaintWindow;
109
pScreen->PaintWindowBorder = iplPaintWindow;
110
pScreen->CopyWindow = iplCopyWindow;
111
pScreen->CreatePixmap = iplCreatePixmap;
112
pScreen->DestroyPixmap = iplDestroyPixmap;
113
pScreen->RealizeFont = mfbRealizeFont;
114
pScreen->UnrealizeFont = mfbUnrealizeFont;
115
pScreen->CreateGC = iplCreateGC;
116
pScreen->CreateColormap = iplInitializeColormap;
117
pScreen->DestroyColormap = (void (*)())NoopDDA;
118
pScreen->InstallColormap = iplInstallColormap;
119
pScreen->UninstallColormap = iplUninstallColormap;
120
pScreen->ListInstalledColormaps = iplListInstalledColormaps;
121
pScreen->StoreColors = (void (*)())NoopDDA;
122
pScreen->ResolveColor = iplResolveColor;
123
pScreen->BitmapToRegion = mfbPixmapToRegion;
125
mfbRegisterCopyPlaneProc (pScreen, iplCopyPlane);
129
#ifdef CFB_NEED_SCREEN_PRIVATE
131
iplCreateScreenResources(pScreen)
136
pointer oldDevPrivate = pScreen->devPrivate;
137
pScreen->devPrivate = pScreen->devPrivates[iplScreenPrivateIndex].ptr;
138
retval = miCreateScreenResources(pScreen);
139
pScreen->devPrivates[iplScreenPrivateIndex].ptr = pScreen->devPrivate;
140
pScreen->devPrivate = oldDevPrivate;
146
iplFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
147
register ScreenPtr pScreen;
148
pointer pbits; /* pointer to screen bitmap */
149
int xsize, ysize; /* in pixels */
150
int dpix, dpiy; /* dots per inch */
151
int width; /* pixel width of frame buffer */
154
#ifdef CFB_NEED_SCREEN_PRIVATE
155
pointer oldDevPrivate;
162
VisualID defaultVisual;
165
if (!iplInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
166
&defaultVisual,((unsigned long)1<<(INTER_PLANES-1)), 8))
168
#ifdef CFB_NEED_SCREEN_PRIVATE
169
oldDevPrivate = pScreen->devPrivate;
171
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
172
rootdepth, ndepths, depths,
173
defaultVisual, nvisuals, visuals))
175
/* overwrite miCloseScreen with our own */
176
pScreen->CloseScreen = iplCloseScreen;
177
#ifdef CFB_NEED_SCREEN_PRIVATE
178
pScreen->CreateScreenResources = iplCreateScreenResources;
179
pScreen->devPrivates[iplScreenPrivateIndex].ptr = pScreen->devPrivate;
180
pScreen->devPrivate = oldDevPrivate;
182
pScreen->BackingStoreFuncs = iplBSFuncRec;
183
pScreen->GetScreenPixmap = iplGetScreenPixmap;
184
pScreen->SetScreenPixmap = iplSetScreenPixmap;
188
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
190
iplScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
191
register ScreenPtr pScreen;
192
pointer pbits; /* pointer to screen bitmap */
193
int xsize, ysize; /* in pixels */
194
int dpix, dpiy; /* dots per inch */
195
int width; /* pixel width of frame buffer */
197
if (!iplSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
199
if (!iplFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
201
#if INTER_PLANES == 2
202
/* This shouldn't be necessary */
203
PixmapWidthPaddingInfo[2].padPixelsLog2 = 4;
204
PixmapWidthPaddingInfo[2].padRoundUp = 15;
205
PixmapWidthPaddingInfo[2].padBytesLog2 = 2;
211
iplGetScreenPixmap(pScreen)
214
#ifdef CFB_NEED_SCREEN_PRIVATE
215
return (PixmapPtr)(pScreen->devPrivates[iplScreenPrivateIndex].ptr);
217
return (PixmapPtr)(pScreen->devPrivate.ptr);
222
iplSetScreenPixmap(pPix)
225
#ifdef CFB_NEED_SCREEN_PRIVATE
227
pPix->drawable.pScreen->devPrivates[iplScreenPrivateIndex].ptr =
231
pPix->drawable.pScreen->devPrivate.ptr = (pointer)pPix;