4 * Copyright 1998 Patrik Stridvall
17 #include "debugtools.h"
19 DEFAULT_DEBUG_CHANNEL(ttydrv
)
21 static const DC_FUNCTIONS TTYDRV_DC_Driver
=
24 TTYDRV_DC_Arc
, /* pArc */
25 TTYDRV_DC_BitBlt
, /* pBitBlt */
26 NULL
, /* pBitmapBits */
27 TTYDRV_DC_Chord
, /* pChord */
28 TTYDRV_DC_CreateBitmap
, /* pCreateBitmap */
29 TTYDRV_DC_CreateDC
, /* pCreateDC */
30 NULL
, /* pCreateDIBSection */
31 NULL
, /* pCreateDIBSection16 */
32 TTYDRV_DC_DeleteDC
, /* pDeleteDC */
33 TTYDRV_DC_DeleteObject
, /* pDeleteObject */
34 NULL
, /* pDeviceCapabilities */
35 TTYDRV_DC_Ellipse
, /* pEllipse */
38 NULL
, /* pEnumDeviceFonts */
39 TTYDRV_DC_Escape
, /* pEscape */
40 NULL
, /* pExcludeClipRect */
41 NULL
, /* pExtDeviceMode */
42 TTYDRV_DC_ExtFloodFill
, /* pExtFloodFill */
43 TTYDRV_DC_ExtTextOut
, /* pExtTextOut */
46 TTYDRV_DC_GetCharWidth
, /* pGetCharWidth */
47 TTYDRV_DC_GetPixel
, /* pGetPixel */
48 TTYDRV_DC_GetTextExtentPoint
, /* pGetTextExtentPoint */
49 TTYDRV_DC_GetTextMetrics
, /* pGetTextMetrics */
50 NULL
, /* pIntersectClipRect */
51 NULL
, /* pIntersectVisRect */
52 TTYDRV_DC_LineTo
, /* pLineTo */
53 TTYDRV_DC_LoadOEMResource
, /* pLoadOEMResource */
54 TTYDRV_DC_MoveToEx
, /* pMoveToEx */
55 NULL
, /* pOffsetClipRgn */
56 NULL
, /* pOffsetViewportOrg (optional) */
57 NULL
, /* pOffsetWindowOrg (optional) */
58 TTYDRV_DC_PaintRgn
, /* pPaintRgn */
59 TTYDRV_DC_PatBlt
, /* pPatBlt */
60 TTYDRV_DC_Pie
, /* pPie */
61 TTYDRV_DC_PolyPolygon
, /* pPolyPolygon */
62 TTYDRV_DC_PolyPolyline
, /* pPolyPolyline */
63 TTYDRV_DC_Polygon
, /* pPolygon */
64 TTYDRV_DC_Polyline
, /* pPolyline */
65 TTYDRV_DC_PolyBezier
, /* pPolyBezier */
66 NULL
, /* pRealizePalette */
67 TTYDRV_DC_Rectangle
, /* pRectangle */
68 NULL
, /* pRestoreDC */
69 TTYDRV_DC_RoundRect
, /* pRoundRect */
71 NULL
, /* pScaleViewportExt (optional) */
72 NULL
, /* pScaleWindowExt (optional) */
73 NULL
, /* pSelectClipRgn */
74 TTYDRV_DC_SelectObject
, /* pSelectObject */
75 NULL
, /* pSelectPalette */
76 TTYDRV_DC_SetBkColor
, /* pSetBkColor */
77 NULL
, /* pSetBkMode */
78 TTYDRV_DC_SetDeviceClipping
, /* pSetDeviceClipping */
79 NULL
, /* pSetDIBitsToDevice */
80 NULL
, /* pSetMapMode (optional) */
81 NULL
, /* pSetMapperFlags */
82 TTYDRV_DC_SetPixel
, /* pSetPixel */
83 NULL
, /* pSetPolyFillMode */
85 NULL
, /* pSetRelAbs */
86 NULL
, /* pSetStretchBltMode */
87 NULL
, /* pSetTextAlign */
88 NULL
, /* pSetTextCharacterExtra */
89 TTYDRV_DC_SetTextColor
, /* pSetTextColor */
90 NULL
, /* pSetTextJustification */
91 NULL
, /* pSetViewportExt (optional) */
92 NULL
, /* pSetViewportOrg (optional) */
93 NULL
, /* pSetWindowExt (optional) */
94 NULL
, /* pSetWindowOrg (optional) */
96 NULL
, /* pStartPage */
97 TTYDRV_DC_StretchBlt
, /* pStretchBlt */
98 NULL
/* pStretchDIBits */
102 GDI_DRIVER TTYDRV_GDI_Driver
=
104 TTYDRV_GDI_Initialize
,
108 BITMAP_DRIVER TTYDRV_BITMAP_Driver
=
110 TTYDRV_BITMAP_SetDIBits
,
111 TTYDRV_BITMAP_GetDIBits
,
112 TTYDRV_BITMAP_DeleteDIBSection
115 PALETTE_DRIVER TTYDRV_PALETTE_Driver
=
117 TTYDRV_PALETTE_SetMapping
,
118 TTYDRV_PALETTE_UpdateMapping
,
119 TTYDRV_PALETTE_IsDark
122 /* FIXME: Adapt to the TTY driver. Copied from the X11 driver */
124 DeviceCaps TTYDRV_DC_DevCaps
= {
126 /* technology */ DT_RASDISPLAY
,
127 /* size, resolution */ 0, 0, 0, 0, 0,
128 /* device objects */ 1, 16 + 6, 16, 0, 0, 100, 0,
129 /* curve caps */ CC_CIRCLES
| CC_PIE
| CC_CHORD
| CC_ELLIPSES
|
130 CC_WIDE
| CC_STYLED
| CC_WIDESTYLED
| CC_INTERIORS
| CC_ROUNDRECT
,
131 /* line caps */ LC_POLYLINE
| LC_MARKER
| LC_POLYMARKER
| LC_WIDE
|
132 LC_STYLED
| LC_WIDESTYLED
| LC_INTERIORS
,
133 /* polygon caps */ PC_POLYGON
| PC_RECTANGLE
| PC_WINDPOLYGON
|
134 PC_SCANLINE
| PC_WIDE
| PC_STYLED
| PC_WIDESTYLED
| PC_INTERIORS
,
136 /* regions */ CP_REGION
,
137 /* raster caps */ RC_BITBLT
| RC_BANDING
| RC_SCALING
| RC_BITMAP64
|
138 RC_DI_BITMAP
| RC_DIBTODEV
| RC_BIGFONT
| RC_STRETCHBLT
| RC_STRETCHDIB
| RC_DEVBITS
,
139 /* aspects */ 36, 36, 51,
141 /* log pixels */ 0, 0,
143 /* palette size */ 0,
147 /**********************************************************************
148 * TTYDRV_GDI_Initialize
150 BOOL
TTYDRV_GDI_Initialize(void)
152 BITMAP_Driver
= &TTYDRV_BITMAP_Driver
;
153 PALETTE_Driver
= &TTYDRV_PALETTE_Driver
;
155 TTYDRV_DC_DevCaps
.version
= 0x300;
156 TTYDRV_DC_DevCaps
.horzSize
= 0; /* FIXME: Screen width in mm */
157 TTYDRV_DC_DevCaps
.vertSize
= 0; /* FIXME: Screen height in mm */
158 TTYDRV_DC_DevCaps
.horzRes
= 640; /* FIXME: Screen width in pixel */
159 TTYDRV_DC_DevCaps
.vertRes
= 480; /* FIXME: Screen height in pixel */
160 TTYDRV_DC_DevCaps
.bitsPixel
= 1; /* FIXME: Bits per pixel */
161 TTYDRV_DC_DevCaps
.sizePalette
= 0; /* FIXME: ??? */
163 /* Resolution will be adjusted during the font init */
165 TTYDRV_DC_DevCaps
.logPixelsX
= (int) (TTYDRV_DC_DevCaps
.horzRes
* 25.4 / TTYDRV_DC_DevCaps
.horzSize
);
166 TTYDRV_DC_DevCaps
.logPixelsY
= (int) (TTYDRV_DC_DevCaps
.vertRes
* 25.4 / TTYDRV_DC_DevCaps
.vertSize
);
168 if(!TTYDRV_PALETTE_Initialize())
171 return DRIVER_RegisterDriver( "DISPLAY", &TTYDRV_DC_Driver
);
174 /**********************************************************************
175 * TTYDRV_GDI_Finalize
177 void TTYDRV_GDI_Finalize(void)
179 TTYDRV_PALETTE_Finalize();
182 /**********************************************************************
185 BOOL
TTYDRV_DC_CreateDC(DC
*dc
, LPCSTR driver
, LPCSTR device
,
186 LPCSTR output
, const DEVMODEA
*initData
)
188 TTYDRV_PDEVICE
*physDev
;
191 FIXME("(%p, %s, %s, %s, %p): semistub\n",
192 dc
, debugstr_a(driver
), debugstr_a(device
),
193 debugstr_a(output
), initData
);
195 dc
->physDev
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
196 sizeof(TTYDRV_PDEVICE
));
198 ERR("Can't allocate physDev\n");
201 physDev
= (TTYDRV_PDEVICE
*) dc
->physDev
;
203 dc
->w
.devCaps
= &TTYDRV_DC_DevCaps
;
205 if(dc
->w
.flags
& DC_MEMORY
){
206 #ifdef HAVE_LIBCURSES
207 physDev
->window
= NULL
;
208 #endif /* defined(HAVE_LIBCURSES) */
209 physDev
->cellWidth
= 1;
210 physDev
->cellHeight
= 1;
212 TTYDRV_DC_CreateBitmap(dc
->w
.hBitmap
);
213 bmp
= (BITMAPOBJ
*) GDI_GetObjPtr(dc
->w
.hBitmap
, BITMAP_MAGIC
);
215 dc
->w
.bitsPerPixel
= bmp
->bitmap
.bmBitsPixel
;
217 dc
->w
.totalExtent
.left
= 0;
218 dc
->w
.totalExtent
.top
= 0;
219 dc
->w
.totalExtent
.right
= bmp
->bitmap
.bmWidth
;
220 dc
->w
.totalExtent
.bottom
= bmp
->bitmap
.bmHeight
;
221 dc
->w
.hVisRgn
= CreateRectRgnIndirect( &dc
->w
.totalExtent
);
223 GDI_HEAP_UNLOCK( dc
->w
.hBitmap
);
225 #ifdef HAVE_LIBCURSES
226 physDev
->window
= TTYDRV_MONITOR_GetCursesRootWindow(&MONITOR_PrimaryMonitor
);
227 #endif /* defined(HAVE_LIBCURSES) */
228 physDev
->cellWidth
= TTYDRV_MONITOR_GetCellWidth(&MONITOR_PrimaryMonitor
);
229 physDev
->cellHeight
= TTYDRV_MONITOR_GetCellHeight(&MONITOR_PrimaryMonitor
);
231 dc
->w
.bitsPerPixel
= MONITOR_GetDepth(&MONITOR_PrimaryMonitor
);
233 dc
->w
.totalExtent
.left
= 0;
234 dc
->w
.totalExtent
.top
= 0;
235 dc
->w
.totalExtent
.right
= MONITOR_GetWidth(&MONITOR_PrimaryMonitor
);
236 dc
->w
.totalExtent
.bottom
= MONITOR_GetHeight(&MONITOR_PrimaryMonitor
);
237 dc
->w
.hVisRgn
= CreateRectRgnIndirect( &dc
->w
.totalExtent
);
244 /**********************************************************************
247 BOOL
TTYDRV_DC_DeleteDC(DC
*dc
)
249 FIXME("(%p): semistub\n", dc
);
251 HeapFree( GetProcessHeap(), 0, dc
->physDev
);
257 /**********************************************************************
260 INT
TTYDRV_DC_Escape(DC
*dc
, INT nEscape
, INT cbInput
,
261 SEGPTR lpInData
, SEGPTR lpOutData
)