4 * Copyright 1999 Patrik Stridvall
12 #include "debugtools.h"
14 DEFAULT_DEBUG_CHANNEL(ttydrv
);
16 /**********************************************************************/
18 static LONG
TTYDRV_DC_GetBitmapBits(BITMAPOBJ
*bitmap
, void *bits
, LONG count
);
19 static LONG
TTYDRV_DC_SetBitmapBits(BITMAPOBJ
*bitmap
, void *bits
, LONG count
);
21 /***********************************************************************
22 * TTYDRV_DC_AllocBitmap
24 TTYDRV_PHYSBITMAP
*TTYDRV_DC_AllocBitmap(BITMAPOBJ
*bitmap
)
26 TTYDRV_PHYSBITMAP
*physBitmap
;
28 if(!(physBitmap
= HeapAlloc(GetProcessHeap(), 0, sizeof(TTYDRV_PHYSBITMAP
)))) {
29 ERR("Can't alloc TTYDRV_PHYSBITMAP\n");
33 bitmap
->physBitmap
= physBitmap
;
34 bitmap
->funcs
= DRIVER_FindDriver("DISPLAY");
39 /***********************************************************************
40 * TTYDRV_DC_BitmapBits
42 LONG
TTYDRV_DC_BitmapBits(HBITMAP hbitmap
, void *bits
, LONG count
, WORD flags
)
47 if(!(bitmap
= (BITMAPOBJ
*) GDI_GetObjPtr(hbitmap
, BITMAP_MAGIC
)))
51 result
= TTYDRV_DC_GetBitmapBits(bitmap
, bits
, count
);
52 else if(flags
== DDB_SET
)
53 result
= TTYDRV_DC_SetBitmapBits(bitmap
, bits
, count
);
55 ERR("Unknown flags value %d\n", flags
);
59 GDI_ReleaseObj(hbitmap
);
63 /***********************************************************************
64 * TTYDRV_DC_CreateBitmap
66 BOOL
TTYDRV_DC_CreateBitmap(HBITMAP hbitmap
)
68 TTYDRV_PHYSBITMAP
*physBitmap
;
71 TRACE("(0x%04x)\n", hbitmap
);
73 if(!(bitmap
= (BITMAPOBJ
*) GDI_GetObjPtr(hbitmap
, BITMAP_MAGIC
)))
76 if(!(physBitmap
= TTYDRV_DC_AllocBitmap(bitmap
))) {
77 GDI_ReleaseObj(hbitmap
);
82 if(bitmap
->bitmap
.bmBits
) {
83 TTYDRV_DC_BitmapBits(hbitmap
, bitmap
->bitmap
.bmBits
,
84 bitmap
->bitmap
.bmHeight
* bitmap
->bitmap
.bmWidthBytes
,
88 GDI_ReleaseObj(hbitmap
);
93 /***********************************************************************
94 * TTYDRV_DC_BITMAP_DeleteObject
96 BOOL
TTYDRV_DC_BITMAP_DeleteObject(HBITMAP hbitmap
, BITMAPOBJ
*bitmap
)
98 TRACE("(0x%04x, %p)\n", hbitmap
, bitmap
);
100 HeapFree(GetProcessHeap(), 0, bitmap
->physBitmap
);
101 bitmap
->physBitmap
= NULL
;
102 bitmap
->funcs
= NULL
;
107 /***********************************************************************
108 * TTYDRV_DC_GetBitmapBits
110 static LONG
TTYDRV_DC_GetBitmapBits(BITMAPOBJ
*bitmap
, void *bits
, LONG count
)
112 FIXME("(%p, %p, %ld): stub\n", bitmap
, bits
, count
);
114 memset(bits
, 0, count
);
119 /***********************************************************************
120 * TTYDRV_DC_BITMAP_SelectObject
122 HBITMAP
TTYDRV_DC_BITMAP_SelectObject(DC
*dc
, HBITMAP hbitmap
, BITMAPOBJ
*bitmap
)
124 HBITMAP hPreviousBitmap
;
126 TRACE("(%p, 0x%04x, %p)\n", dc
, hbitmap
, bitmap
);
128 if(!(dc
->flags
& DC_MEMORY
))
131 /* Assure that the bitmap device dependent */
132 if(!bitmap
->physBitmap
&& !TTYDRV_DC_CreateBitmap(hbitmap
))
135 if(bitmap
->funcs
!= dc
->funcs
) {
136 ERR("Trying to select a non-TTY DDB into a TTY DC\n");
140 dc
->totalExtent
.left
= 0;
141 dc
->totalExtent
.top
= 0;
142 dc
->totalExtent
.right
= bitmap
->bitmap
.bmWidth
;
143 dc
->totalExtent
.bottom
= bitmap
->bitmap
.bmHeight
;
145 /* FIXME: Should be done in the common code instead */
147 SetRectRgn(dc
->hVisRgn
, 0, 0,
148 bitmap
->bitmap
.bmWidth
, bitmap
->bitmap
.bmHeight
);
152 if(!(hrgn
= CreateRectRgn(0, 0, bitmap
->bitmap
.bmWidth
, bitmap
->bitmap
.bmHeight
)))
158 hPreviousBitmap
= dc
->hBitmap
;
159 dc
->hBitmap
= hbitmap
;
161 return hPreviousBitmap
;
164 /***********************************************************************
165 * TTYDRV_DC_SetBitmapBits
167 static LONG
TTYDRV_DC_SetBitmapBits(BITMAPOBJ
*bitmap
, void *bits
, LONG count
)
169 FIXME("(%p, %p, %ld): semistub\n", bitmap
, bits
, count
);
174 /***********************************************************************
175 * TTYDRV_BITMAP_CreateDIBSection
177 HBITMAP
TTYDRV_BITMAP_CreateDIBSection(
178 DC
*dc
, BITMAPINFO
*bmi
, UINT usage
,
179 LPVOID
*bits
, HANDLE section
, DWORD offset
)
181 FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n",
182 dc
, bmi
, usage
, bits
, section
, offset
);
184 return (HBITMAP
) NULL
;
187 /**********************************************************************
188 * TTYDRV_BITMAP_CreateDIBSection16
190 HBITMAP16
TTYDRV_DIB_CreateDIBSection16(
191 DC
*dc
, BITMAPINFO
*bmi
, UINT16 usage
,
192 SEGPTR
*bits
, HANDLE section
, DWORD offset
)
194 FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n",
195 dc
, bmi
, usage
, bits
, section
, offset
);
197 return (HBITMAP16
) NULL
;
200 /***********************************************************************
201 * TTYDRV_BITMAP_DeleteDIBSection
203 void TTYDRV_BITMAP_DeleteDIBSection(BITMAPOBJ
*bmp
)
205 FIXME("(%p): stub\n", bmp
);
208 /***********************************************************************
209 * TTYDRV_BITMAP_SetDIBColorTable
211 UINT
TTYDRV_BITMAP_SetDIBColorTable(BITMAPOBJ
*bmp
, DC
*dc
, UINT start
, UINT count
, const RGBQUAD
*colors
)
213 FIXME("(%p): stub\n", bmp
);
217 /***********************************************************************
218 * TTYDRV_BITMAP_GetDIBColorTable
220 UINT
TTYDRV_BITMAP_GetDIBColorTable(BITMAPOBJ
*bmp
, DC
*dc
, UINT start
, UINT count
, RGBQUAD
*colors
)
222 FIXME("(%p): stub\n", bmp
);
226 /***********************************************************************
229 INT
TTYDRV_BITMAP_Lock(BITMAPOBJ
*bmp
, INT req
, BOOL lossy
)
231 FIXME("(%p): stub\n", bmp
);
232 return DIB_Status_None
;
235 /***********************************************************************
236 * TTYDRV_BITMAP_Unlock
238 void TTYDRV_BITMAP_Unlock(BITMAPOBJ
*bmp
, BOOL commit
)
240 FIXME("(%p): stub\n", bmp
);
243 /***********************************************************************
244 * TTYDRV_BITMAP_GetDIBits
246 INT
TTYDRV_BITMAP_GetDIBits(
247 BITMAPOBJ
*bmp
, DC
*dc
, UINT startscan
, UINT lines
,
248 LPVOID bits
, BITMAPINFO
*info
, UINT coloruse
, HBITMAP hbitmap
)
250 FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
251 bmp
, dc
, startscan
, lines
, bits
, info
, coloruse
, hbitmap
);
257 /***********************************************************************
258 * TTYDRV_BITMAP_SetDIBits
260 INT
TTYDRV_BITMAP_SetDIBits(
261 BITMAPOBJ
*bmp
, DC
*dc
, UINT startscan
, UINT lines
,
262 LPCVOID bits
, const BITMAPINFO
*info
, UINT coloruse
, HBITMAP hbitmap
)
264 FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
265 bmp
, dc
, startscan
, lines
, bits
, info
, coloruse
, hbitmap
);
270 /***********************************************************************
271 * TTYDRV_DC_SetDIBitsToDevice
273 INT
TTYDRV_DC_SetDIBitsToDevice(DC
*dc
, INT xDest
, INT yDest
, DWORD cx
,
274 DWORD cy
, INT xSrc
, INT ySrc
,
275 UINT startscan
, UINT lines
, LPCVOID bits
,
276 const BITMAPINFO
*info
, UINT coloruse
)
278 FIXME("(%p, %d, %d, %ld, %ld, %d, %d, %u, %u, %p, %p, %u): stub\n",
279 dc
, xDest
, yDest
, cx
, cy
, xSrc
, ySrc
, startscan
, lines
, bits
, info
, coloruse
);