4 * Copyright 1999 Patrik Stridvall
11 #include "debugtools.h"
13 DEFAULT_DEBUG_CHANNEL(ttydrv);
15 /**********************************************************************/
17 static LONG TTYDRV_DC_GetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count);
18 static LONG TTYDRV_DC_SetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count);
20 /***********************************************************************
21 * TTYDRV_DC_AllocBitmap
23 TTYDRV_PHYSBITMAP *TTYDRV_DC_AllocBitmap(BITMAPOBJ *bitmap)
25 TTYDRV_PHYSBITMAP *physBitmap;
27 if(!(physBitmap = HeapAlloc(GetProcessHeap(), 0, sizeof(TTYDRV_PHYSBITMAP)))) {
28 ERR("Can't alloc TTYDRV_PHYSBITMAP\n");
32 bitmap->physBitmap = physBitmap;
33 bitmap->funcs = DRIVER_FindDriver("DISPLAY");
38 /***********************************************************************
39 * TTYDRV_DC_BitmapBits
41 LONG TTYDRV_DC_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags)
46 if(!(bitmap = (BITMAPOBJ *) GDI_GetObjPtr(hbitmap, BITMAP_MAGIC)))
50 result = TTYDRV_DC_GetBitmapBits(bitmap, bits, count);
51 else if(flags == DDB_SET)
52 result = TTYDRV_DC_SetBitmapBits(bitmap, bits, count);
54 ERR("Unknown flags value %d\n", flags);
58 GDI_ReleaseObj(hbitmap);
62 /***********************************************************************
63 * TTYDRV_DC_CreateBitmap
65 BOOL TTYDRV_DC_CreateBitmap(HBITMAP hbitmap)
67 TTYDRV_PHYSBITMAP *physBitmap;
70 TRACE("(0x%04x)\n", hbitmap);
72 if(!(bitmap = (BITMAPOBJ *) GDI_GetObjPtr(hbitmap, BITMAP_MAGIC)))
75 if(!(physBitmap = TTYDRV_DC_AllocBitmap(bitmap))) {
76 GDI_ReleaseObj(hbitmap);
81 if(bitmap->bitmap.bmBits) {
82 TTYDRV_DC_BitmapBits(hbitmap, bitmap->bitmap.bmBits,
83 bitmap->bitmap.bmHeight * bitmap->bitmap.bmWidthBytes,
87 GDI_ReleaseObj(hbitmap);
92 /***********************************************************************
93 * TTYDRV_DC_BITMAP_DeleteObject
95 BOOL TTYDRV_DC_BITMAP_DeleteObject(HBITMAP hbitmap, BITMAPOBJ *bitmap)
97 TRACE("(0x%04x, %p)\n", hbitmap, bitmap);
99 HeapFree(GetProcessHeap(), 0, bitmap->physBitmap);
100 bitmap->physBitmap = NULL;
101 bitmap->funcs = NULL;
106 /***********************************************************************
107 * TTYDRV_DC_GetBitmapBits
109 static LONG TTYDRV_DC_GetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count)
111 FIXME("(%p, %p, %ld): stub\n", bitmap, bits, count);
113 memset(bits, 0, count);
118 /***********************************************************************
119 * TTYDRV_DC_BITMAP_SelectObject
121 HBITMAP TTYDRV_DC_BITMAP_SelectObject(DC *dc, HBITMAP hbitmap, BITMAPOBJ *bitmap)
123 HBITMAP hPreviousBitmap;
125 TRACE("(%p, 0x%04x, %p)\n", dc, hbitmap, bitmap);
127 if(!(dc->flags & DC_MEMORY))
130 /* Assure that the bitmap device dependent */
131 if(!bitmap->physBitmap && !TTYDRV_DC_CreateBitmap(hbitmap))
134 if(bitmap->funcs != dc->funcs) {
135 ERR("Trying to select a non-TTY DDB into a TTY DC\n");
139 dc->totalExtent.left = 0;
140 dc->totalExtent.top = 0;
141 dc->totalExtent.right = bitmap->bitmap.bmWidth;
142 dc->totalExtent.bottom = bitmap->bitmap.bmHeight;
144 /* FIXME: Should be done in the common code instead */
146 SetRectRgn(dc->hVisRgn, 0, 0,
147 bitmap->bitmap.bmWidth, bitmap->bitmap.bmHeight);
151 if(!(hrgn = CreateRectRgn(0, 0, bitmap->bitmap.bmWidth, bitmap->bitmap.bmHeight)))
157 hPreviousBitmap = dc->hBitmap;
158 dc->hBitmap = hbitmap;
160 return hPreviousBitmap;
163 /***********************************************************************
164 * TTYDRV_DC_SetBitmapBits
166 static LONG TTYDRV_DC_SetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count)
168 FIXME("(%p, %p, %ld): semistub\n", bitmap, bits, count);
173 /***********************************************************************
174 * TTYDRV_BITMAP_CreateDIBSection
176 HBITMAP TTYDRV_BITMAP_CreateDIBSection(
177 DC *dc, BITMAPINFO *bmi, UINT usage,
178 LPVOID *bits, HANDLE section, DWORD offset)
180 FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n",
181 dc, bmi, usage, bits, section, offset);
183 return (HBITMAP) NULL;
186 /**********************************************************************
187 * TTYDRV_BITMAP_CreateDIBSection16
189 HBITMAP16 TTYDRV_DIB_CreateDIBSection16(
190 DC *dc, BITMAPINFO *bmi, UINT16 usage,
191 SEGPTR *bits, HANDLE section, DWORD offset)
193 FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n",
194 dc, bmi, usage, bits, section, offset);
196 return (HBITMAP16) NULL;
199 /***********************************************************************
200 * TTYDRV_BITMAP_DeleteDIBSection
202 void TTYDRV_BITMAP_DeleteDIBSection(BITMAPOBJ *bmp)
204 FIXME("(%p): stub\n", bmp);
207 /***********************************************************************
208 * TTYDRV_BITMAP_SetDIBColorTable
210 UINT TTYDRV_BITMAP_SetDIBColorTable(BITMAPOBJ *bmp, DC *dc, UINT start, UINT count, const RGBQUAD *colors)
212 FIXME("(%p): stub\n", bmp);
216 /***********************************************************************
217 * TTYDRV_BITMAP_GetDIBColorTable
219 UINT TTYDRV_BITMAP_GetDIBColorTable(BITMAPOBJ *bmp, DC *dc, UINT start, UINT count, RGBQUAD *colors)
221 FIXME("(%p): stub\n", bmp);
225 /***********************************************************************
226 * TTYDRV_BITMAP_GetDIBits
228 INT TTYDRV_BITMAP_GetDIBits(
229 BITMAPOBJ *bmp, DC *dc, UINT startscan, UINT lines,
230 LPVOID bits, BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap)
232 FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
233 bmp, dc, startscan, lines, bits, info, coloruse, hbitmap);
239 /***********************************************************************
240 * TTYDRV_BITMAP_SetDIBits
242 INT TTYDRV_BITMAP_SetDIBits(
243 BITMAPOBJ *bmp, DC *dc, UINT startscan, UINT lines,
244 LPCVOID bits, const BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap)
246 FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
247 bmp, dc, startscan, lines, bits, info, coloruse, hbitmap);
252 /***********************************************************************
253 * TTYDRV_DC_SetDIBitsToDevice
255 INT TTYDRV_DC_SetDIBitsToDevice(DC *dc, INT xDest, INT yDest, DWORD cx,
256 DWORD cy, INT xSrc, INT ySrc,
257 UINT startscan, UINT lines, LPCVOID bits,
258 const BITMAPINFO *info, UINT coloruse)
260 FIXME("(%p, %d, %d, %ld, %ld, %d, %d, %u, %u, %p, %p, %u): stub\n",
261 dc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, bits, info, coloruse);