Don't create the WINEPREFIX directory if it doesn't exist.
[wine/multimedia.git] / dlls / ttydrv / dc.c
bloba9dafb873311ab03b567f13e54225323e755e67e
1 /*
2 * TTY DC driver
4 * Copyright 1999 Patrik Stridvall
5 */
7 #include "config.h"
9 #include "gdi.h"
10 #include "bitmap.h"
11 #include "palette.h"
12 #include "ttydrv.h"
13 #include "winbase.h"
14 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(ttydrv);
18 /**********************************************************************/
20 BITMAP_DRIVER TTYDRV_BITMAP_Driver =
22 TTYDRV_BITMAP_SetDIBits,
23 TTYDRV_BITMAP_GetDIBits,
24 TTYDRV_BITMAP_DeleteDIBSection,
25 TTYDRV_BITMAP_SetDIBColorTable,
26 TTYDRV_BITMAP_GetDIBColorTable,
27 TTYDRV_BITMAP_Lock,
28 TTYDRV_BITMAP_Unlock
31 PALETTE_DRIVER TTYDRV_PALETTE_Driver =
33 TTYDRV_PALETTE_SetMapping,
34 TTYDRV_PALETTE_UpdateMapping,
35 TTYDRV_PALETTE_IsDark
38 const DC_FUNCTIONS *TTYDRV_DC_Funcs = NULL; /* hack */
40 /**********************************************************************
41 * TTYDRV_GDI_Initialize
43 BOOL TTYDRV_GDI_Initialize(void)
45 BITMAP_Driver = &TTYDRV_BITMAP_Driver;
46 PALETTE_Driver = &TTYDRV_PALETTE_Driver;
48 return TTYDRV_PALETTE_Initialize();
51 /***********************************************************************
52 * TTYDRV_DC_CreateDC
54 BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
55 LPCSTR output, const DEVMODEA *initData)
57 TTYDRV_PDEVICE *physDev;
58 BITMAPOBJ *bmp;
60 TRACE("(%p, %s, %s, %s, %p)\n",
61 dc, debugstr_a(driver), debugstr_a(device),
62 debugstr_a(output), initData);
64 if (!TTYDRV_DC_Funcs) TTYDRV_DC_Funcs = dc->funcs; /* hack */
66 dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
67 sizeof(TTYDRV_PDEVICE));
68 if(!dc->physDev) {
69 ERR("Can't allocate physDev\n");
70 return FALSE;
72 physDev = (TTYDRV_PDEVICE *) dc->physDev;
74 if(dc->flags & DC_MEMORY){
75 physDev->window = NULL;
76 physDev->cellWidth = 1;
77 physDev->cellHeight = 1;
79 TTYDRV_DC_CreateBitmap(dc->hBitmap);
80 bmp = (BITMAPOBJ *) GDI_GetObjPtr(dc->hBitmap, BITMAP_MAGIC);
82 dc->bitsPerPixel = bmp->bitmap.bmBitsPixel;
84 dc->totalExtent.left = 0;
85 dc->totalExtent.top = 0;
86 dc->totalExtent.right = bmp->bitmap.bmWidth;
87 dc->totalExtent.bottom = bmp->bitmap.bmHeight;
88 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
90 GDI_ReleaseObj( dc->hBitmap );
91 } else {
92 physDev->window = root_window;
93 physDev->cellWidth = cell_width;
94 physDev->cellHeight = cell_height;
96 dc->bitsPerPixel = 1;
97 dc->totalExtent.left = 0;
98 dc->totalExtent.top = 0;
99 dc->totalExtent.right = cell_width * screen_cols;
100 dc->totalExtent.bottom = cell_height * screen_rows;
101 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
104 return TRUE;
107 /***********************************************************************
108 * TTYDRV_DC_DeleteDC
110 BOOL TTYDRV_DC_DeleteDC(DC *dc)
112 TRACE("(%p)\n", dc);
114 HeapFree( GetProcessHeap(), 0, dc->physDev );
115 dc->physDev = NULL;
117 return TRUE;
121 /***********************************************************************
122 * GetDeviceCaps (TTYDRV.@)
124 INT TTYDRV_GetDeviceCaps( DC *dc, INT cap )
126 switch(cap)
128 case DRIVERVERSION:
129 return 0x300;
130 case TECHNOLOGY:
131 return DT_RASDISPLAY;
132 case HORZSIZE:
133 return 0; /* FIXME: Screen width in mm */
134 case VERTSIZE:
135 return 0; /* FIXME: Screen height in mm */
136 case HORZRES:
137 return 640; /* FIXME: Screen width in pixel */
138 case VERTRES:
139 return 480; /* FIXME: Screen height in pixel */
140 case BITSPIXEL:
141 return 1; /* FIXME */
142 case PLANES:
143 return 1;
144 case NUMBRUSHES:
145 return 16 + 6;
146 case NUMPENS:
147 return 16;
148 case NUMMARKERS:
149 return 0;
150 case NUMFONTS:
151 return 0;
152 case NUMCOLORS:
153 return 100;
154 case PDEVICESIZE:
155 return sizeof(TTYDRV_PDEVICE);
156 case CURVECAPS:
157 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
158 CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
159 case LINECAPS:
160 return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
161 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
162 case POLYGONALCAPS:
163 return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
164 PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
165 case TEXTCAPS:
166 return 0;
167 case CLIPCAPS:
168 return CP_REGION;
169 case RASTERCAPS:
170 return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
171 RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS);
172 case ASPECTX:
173 case ASPECTY:
174 return 36;
175 case ASPECTXY:
176 return 51;
177 case LOGPIXELSX:
178 case LOGPIXELSY:
179 return 72; /* FIXME */
180 case SIZEPALETTE:
181 return 256; /* FIXME */
182 case NUMRESERVED:
183 return 0;
184 case COLORRES:
185 return 0;
186 case PHYSICALWIDTH:
187 case PHYSICALHEIGHT:
188 case PHYSICALOFFSETX:
189 case PHYSICALOFFSETY:
190 case SCALINGFACTORX:
191 case SCALINGFACTORY:
192 case VREFRESH:
193 case DESKTOPVERTRES:
194 case DESKTOPHORZRES:
195 case BTLALIGNMENT:
196 return 0;
197 default:
198 FIXME("(%04x): unsupported capability %d, will return 0\n", dc->hSelf, cap );
199 return 0;
204 /***********************************************************************
205 * TTYDRV_DC_SetDeviceClipping
207 void TTYDRV_DC_SetDeviceClipping(DC *dc)
209 TRACE("(%p)\n", dc);