4 * Copyright 1999 Patrik Stridvall
13 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(ttydrv);
17 /**********************************************************************/
19 extern HBITMAP TTYDRV_DC_BITMAP_SelectObject(DC *dc, HBITMAP hbitmap, BITMAPOBJ *bitmap);
20 extern BOOL TTYDRV_DC_BITMAP_DeleteObject(HBITMAP hbitmap, BITMAPOBJ *bitmap);
23 /***********************************************************************
24 * TTYDRV_DC_BRUSH_SelectObject
26 static HBRUSH TTYDRV_DC_BRUSH_SelectObject(DC *dc, HBRUSH hbrush, BRUSHOBJ *brush)
28 HBRUSH hPreviousBrush;
30 TRACE("(%p, 0x%04x, %p)\n", dc, hbrush, brush);
32 hPreviousBrush = dc->hBrush;
35 return hPreviousBrush;
38 /***********************************************************************
39 * TTYDRV_DC_FONT_SelectObject
41 static HFONT TTYDRV_DC_FONT_SelectObject(DC* dc, HFONT hfont, FONTOBJ *font)
45 TRACE("(%p, 0x%04x, %p)\n", dc, hfont, font);
47 hPreviousFont = dc->hFont;
53 /***********************************************************************
54 * TTYDRV_DC_PEN_SelectObject
56 static HPEN TTYDRV_DC_PEN_SelectObject(DC *dc, HBRUSH hpen, PENOBJ *pen)
60 TRACE("(%p, 0x%04x, %p)\n", dc, hpen, pen);
62 hPreviousPen = dc->hPen;
68 /***********************************************************************
69 * TTYDRV_DC_SelectObject
71 HGDIOBJ TTYDRV_DC_SelectObject(DC *dc, HGDIOBJ handle)
73 GDIOBJHDR *ptr = GDI_GetObjPtr(handle, MAGIC_DONTCARE);
78 switch(GDIMAGIC(ptr->wMagic))
81 result = TTYDRV_DC_BITMAP_SelectObject(dc, handle, (BITMAPOBJ *) ptr);
84 result = TTYDRV_DC_BRUSH_SelectObject(dc, handle, (BRUSHOBJ *) ptr);
87 result = TTYDRV_DC_FONT_SelectObject(dc, handle, (FONTOBJ *) ptr);
90 result = TTYDRV_DC_PEN_SelectObject(dc, handle, (PENOBJ *) ptr);
93 /* FIXME: Shouldn't be handled here */
94 result = (HGDIOBJ) SelectClipRgn(dc->hSelf, handle);
97 ERR("handle (0x%04x) has unknown magic (0x%04x)\n",
98 handle, GDIMAGIC(ptr->wMagic));
101 GDI_ReleaseObj(handle);
106 /***********************************************************************
107 * TTYDRV_DC_DeleteObject
109 BOOL TTYDRV_DC_DeleteObject(HGDIOBJ handle)
111 GDIOBJHDR *ptr = GDI_GetObjPtr(handle, MAGIC_DONTCARE);
114 if(!ptr) return FALSE;
116 switch(GDIMAGIC(ptr->wMagic))
119 result = TTYDRV_DC_BITMAP_DeleteObject(handle, (BITMAPOBJ *) ptr);
128 ERR("handle (0x%04x) has unknown magic (0x%04x)\n",
129 handle, GDIMAGIC(ptr->wMagic));
133 GDI_ReleaseObj(handle);