Fixed opening of some drivers.
[wine.git] / objects / dc.c
blob83b3e9ab3a413c69663134399933a969f72b025e
1 /*
2 * GDI Device Context functions
4 * Copyright 1993 Alexandre Julliard
6 */
8 #include "config.h"
10 #include <stdlib.h>
11 #include <string.h>
12 #include "gdi.h"
13 #include "heap.h"
14 #include "debugtools.h"
15 #include "font.h"
16 #include "callback.h"
17 #include "winerror.h"
18 #include "windef.h"
19 #include "wingdi.h"
20 #include "wine/winuser16.h"
22 DEFAULT_DEBUG_CHANNEL(dc);
25 /***********************************************************************
26 * DC_AllocDC
28 DC *DC_AllocDC( const DC_FUNCTIONS *funcs )
30 HDC hdc;
31 DC *dc;
33 if (!(dc = GDI_AllocObject( sizeof(*dc), DC_MAGIC, &hdc ))) return NULL;
35 dc->hSelf = hdc;
36 dc->funcs = funcs;
37 dc->physDev = NULL;
38 dc->saveLevel = 0;
39 dc->dwHookData = 0;
40 dc->hookProc = NULL;
41 dc->hookThunk = NULL;
42 dc->wndOrgX = 0;
43 dc->wndOrgY = 0;
44 dc->wndExtX = 1;
45 dc->wndExtY = 1;
46 dc->vportOrgX = 0;
47 dc->vportOrgY = 0;
48 dc->vportExtX = 1;
49 dc->vportExtY = 1;
50 dc->flags = 0;
51 dc->devCaps = NULL;
52 dc->hClipRgn = 0;
53 dc->hVisRgn = 0;
54 dc->hGCClipRgn = 0;
55 dc->hPen = GetStockObject( BLACK_PEN );
56 dc->hBrush = GetStockObject( WHITE_BRUSH );
57 dc->hFont = GetStockObject( SYSTEM_FONT );
58 dc->hBitmap = 0;
59 dc->hDevice = 0;
60 dc->hPalette = GetStockObject( DEFAULT_PALETTE );
61 dc->ROPmode = R2_COPYPEN;
62 dc->polyFillMode = ALTERNATE;
63 dc->stretchBltMode = BLACKONWHITE;
64 dc->relAbsMode = ABSOLUTE;
65 dc->backgroundMode = OPAQUE;
66 dc->backgroundColor = RGB( 255, 255, 255 );
67 dc->textColor = RGB( 0, 0, 0 );
68 dc->brushOrgX = 0;
69 dc->brushOrgY = 0;
70 dc->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
71 dc->charExtra = 0;
72 dc->breakTotalExtra = 0;
73 dc->breakCount = 0;
74 dc->breakExtra = 0;
75 dc->breakRem = 0;
76 dc->totalExtent.left = 0;
77 dc->totalExtent.top = 0;
78 dc->totalExtent.right = 0;
79 dc->totalExtent.bottom = 0;
80 dc->bitsPerPixel = 1;
81 dc->MapMode = MM_TEXT;
82 dc->GraphicsMode = GM_COMPATIBLE;
83 dc->DCOrgX = 0;
84 dc->DCOrgY = 0;
85 dc->pAbortProc = NULL;
86 dc->CursPosX = 0;
87 dc->CursPosY = 0;
88 dc->ArcDirection = AD_COUNTERCLOCKWISE;
89 dc->xformWorld2Wnd.eM11 = 1.0f;
90 dc->xformWorld2Wnd.eM12 = 0.0f;
91 dc->xformWorld2Wnd.eM21 = 0.0f;
92 dc->xformWorld2Wnd.eM22 = 1.0f;
93 dc->xformWorld2Wnd.eDx = 0.0f;
94 dc->xformWorld2Wnd.eDy = 0.0f;
95 dc->xformWorld2Vport = dc->xformWorld2Wnd;
96 dc->xformVport2World = dc->xformWorld2Wnd;
97 dc->vport2WorldValid = TRUE;
98 PATH_InitGdiPath(&dc->path);
99 return dc;
104 /***********************************************************************
105 * DC_GetDCPtr
107 DC *DC_GetDCPtr( HDC hdc )
109 GDIOBJHDR *ptr = GDI_GetObjPtr( hdc, MAGIC_DONTCARE );
110 if (!ptr) return NULL;
111 if ((GDIMAGIC(ptr->wMagic) == DC_MAGIC) ||
112 (GDIMAGIC(ptr->wMagic) == METAFILE_DC_MAGIC) ||
113 (GDIMAGIC(ptr->wMagic) == ENHMETAFILE_DC_MAGIC))
114 return (DC *)ptr;
115 GDI_ReleaseObj( hdc );
116 SetLastError( ERROR_INVALID_HANDLE );
117 return NULL;
120 /***********************************************************************
121 * DC_GetDCUpdate
123 * Retrieve a DC ptr while making sure the visRgn is updated.
124 * This function may call up to USER so the GDI lock should _not_
125 * be held when calling it.
127 DC *DC_GetDCUpdate( HDC hdc )
129 DC *dc = DC_GetDCPtr( hdc );
130 if (!dc) return NULL;
131 while (dc->flags & DC_DIRTY)
133 dc->flags &= ~DC_DIRTY;
134 if (!(dc->flags & (DC_SAVED | DC_MEMORY)))
136 DCHOOKPROC proc = dc->hookThunk;
137 if (proc)
139 DWORD data = dc->dwHookData;
140 GDI_ReleaseObj( hdc );
141 proc( hdc, DCHC_INVALIDVISRGN, data, 0 );
142 if (!(dc = DC_GetDCPtr( hdc ))) break;
143 /* otherwise restart the loop in case it became dirty again in the meantime */
147 return dc;
150 /***********************************************************************
151 * DC_InitDC
153 * Setup device-specific DC values for a newly created DC.
155 void DC_InitDC( DC* dc )
157 RealizeDefaultPalette16( dc->hSelf );
158 SetTextColor( dc->hSelf, dc->textColor );
159 SetBkColor( dc->hSelf, dc->backgroundColor );
160 SelectObject( dc->hSelf, dc->hPen );
161 SelectObject( dc->hSelf, dc->hBrush );
162 SelectObject( dc->hSelf, dc->hFont );
163 CLIPPING_UpdateGCRegion( dc );
167 /***********************************************************************
168 * DC_InvertXform
170 * Computes the inverse of the transformation xformSrc and stores it to
171 * xformDest. Returns TRUE if successful or FALSE if the xformSrc matrix
172 * is singular.
174 static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
176 FLOAT determinant;
178 determinant = xformSrc->eM11*xformSrc->eM22 -
179 xformSrc->eM12*xformSrc->eM21;
180 if (determinant > -1e-12 && determinant < 1e-12)
181 return FALSE;
183 xformDest->eM11 = xformSrc->eM22 / determinant;
184 xformDest->eM12 = -xformSrc->eM12 / determinant;
185 xformDest->eM21 = -xformSrc->eM21 / determinant;
186 xformDest->eM22 = xformSrc->eM11 / determinant;
187 xformDest->eDx = -xformSrc->eDx * xformDest->eM11 -
188 xformSrc->eDy * xformDest->eM21;
189 xformDest->eDy = -xformSrc->eDx * xformDest->eM12 -
190 xformSrc->eDy * xformDest->eM22;
192 return TRUE;
196 /***********************************************************************
197 * DC_UpdateXforms
199 * Updates the xformWorld2Vport, xformVport2World and vport2WorldValid
200 * fields of the specified DC by creating a transformation that
201 * represents the current mapping mode and combining it with the DC's
202 * world transform. This function should be called whenever the
203 * parameters associated with the mapping mode (window and viewport
204 * extents and origins) or the world transform change.
206 void DC_UpdateXforms( DC *dc )
208 XFORM xformWnd2Vport;
209 FLOAT scaleX, scaleY;
211 /* Construct a transformation to do the window-to-viewport conversion */
212 scaleX = (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX;
213 scaleY = (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY;
214 xformWnd2Vport.eM11 = scaleX;
215 xformWnd2Vport.eM12 = 0.0;
216 xformWnd2Vport.eM21 = 0.0;
217 xformWnd2Vport.eM22 = scaleY;
218 xformWnd2Vport.eDx = (FLOAT)dc->vportOrgX -
219 scaleX * (FLOAT)dc->wndOrgX;
220 xformWnd2Vport.eDy = (FLOAT)dc->vportOrgY -
221 scaleY * (FLOAT)dc->wndOrgY;
223 /* Combine with the world transformation */
224 CombineTransform( &dc->xformWorld2Vport, &dc->xformWorld2Wnd,
225 &xformWnd2Vport );
227 /* Create inverse of world-to-viewport transformation */
228 dc->vport2WorldValid = DC_InvertXform( &dc->xformWorld2Vport,
229 &dc->xformVport2World );
233 /***********************************************************************
234 * GetDCState (GDI.179)
236 HDC16 WINAPI GetDCState16( HDC16 hdc )
238 DC * newdc, * dc;
239 HGDIOBJ handle;
241 if (!(dc = DC_GetDCUpdate( hdc ))) return 0;
242 if (!(newdc = GDI_AllocObject( sizeof(DC), DC_MAGIC, &handle )))
244 GDI_ReleaseObj( hdc );
245 return 0;
247 TRACE("(%04x): returning %04x\n", hdc, handle );
249 newdc->flags = dc->flags | DC_SAVED;
250 newdc->devCaps = dc->devCaps;
251 newdc->hPen = dc->hPen;
252 newdc->hBrush = dc->hBrush;
253 newdc->hFont = dc->hFont;
254 newdc->hBitmap = dc->hBitmap;
255 newdc->hDevice = dc->hDevice;
256 newdc->hPalette = dc->hPalette;
257 newdc->totalExtent = dc->totalExtent;
258 newdc->bitsPerPixel = dc->bitsPerPixel;
259 newdc->ROPmode = dc->ROPmode;
260 newdc->polyFillMode = dc->polyFillMode;
261 newdc->stretchBltMode = dc->stretchBltMode;
262 newdc->relAbsMode = dc->relAbsMode;
263 newdc->backgroundMode = dc->backgroundMode;
264 newdc->backgroundColor = dc->backgroundColor;
265 newdc->textColor = dc->textColor;
266 newdc->brushOrgX = dc->brushOrgX;
267 newdc->brushOrgY = dc->brushOrgY;
268 newdc->textAlign = dc->textAlign;
269 newdc->charExtra = dc->charExtra;
270 newdc->breakTotalExtra = dc->breakTotalExtra;
271 newdc->breakCount = dc->breakCount;
272 newdc->breakExtra = dc->breakExtra;
273 newdc->breakRem = dc->breakRem;
274 newdc->MapMode = dc->MapMode;
275 newdc->GraphicsMode = dc->GraphicsMode;
276 #if 0
277 /* Apparently, the DC origin is not changed by [GS]etDCState */
278 newdc->DCOrgX = dc->DCOrgX;
279 newdc->DCOrgY = dc->DCOrgY;
280 #endif
281 newdc->CursPosX = dc->CursPosX;
282 newdc->CursPosY = dc->CursPosY;
283 newdc->ArcDirection = dc->ArcDirection;
284 newdc->xformWorld2Wnd = dc->xformWorld2Wnd;
285 newdc->xformWorld2Vport = dc->xformWorld2Vport;
286 newdc->xformVport2World = dc->xformVport2World;
287 newdc->vport2WorldValid = dc->vport2WorldValid;
288 newdc->wndOrgX = dc->wndOrgX;
289 newdc->wndOrgY = dc->wndOrgY;
290 newdc->wndExtX = dc->wndExtX;
291 newdc->wndExtY = dc->wndExtY;
292 newdc->vportOrgX = dc->vportOrgX;
293 newdc->vportOrgY = dc->vportOrgY;
294 newdc->vportExtX = dc->vportExtX;
295 newdc->vportExtY = dc->vportExtY;
297 newdc->hSelf = (HDC)handle;
298 newdc->saveLevel = 0;
300 PATH_InitGdiPath( &newdc->path );
302 newdc->pAbortProc = NULL;
303 newdc->hookThunk = NULL;
304 newdc->hookProc = 0;
306 /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
308 newdc->hGCClipRgn = newdc->hVisRgn = 0;
309 if (dc->hClipRgn)
311 newdc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
312 CombineRgn( newdc->hClipRgn, dc->hClipRgn, 0, RGN_COPY );
314 else
315 newdc->hClipRgn = 0;
316 GDI_ReleaseObj( handle );
317 GDI_ReleaseObj( hdc );
318 return handle;
322 /***********************************************************************
323 * SetDCState (GDI.180)
325 void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
327 DC *dc, *dcs;
329 if (!(dc = GDI_GetObjPtr( hdc, DC_MAGIC ))) return;
330 if (!(dcs = GDI_GetObjPtr( hdcs, DC_MAGIC )))
332 GDI_ReleaseObj( hdc );
333 return;
335 if (!dcs->flags & DC_SAVED)
337 GDI_ReleaseObj( hdc );
338 GDI_ReleaseObj( hdcs );
339 return;
341 TRACE("%04x %04x\n", hdc, hdcs );
343 dc->flags = dcs->flags & ~DC_SAVED;
344 dc->devCaps = dcs->devCaps;
345 dc->hDevice = dcs->hDevice;
346 dc->totalExtent = dcs->totalExtent;
347 dc->ROPmode = dcs->ROPmode;
348 dc->polyFillMode = dcs->polyFillMode;
349 dc->stretchBltMode = dcs->stretchBltMode;
350 dc->relAbsMode = dcs->relAbsMode;
351 dc->backgroundMode = dcs->backgroundMode;
352 dc->backgroundColor = dcs->backgroundColor;
353 dc->textColor = dcs->textColor;
354 dc->brushOrgX = dcs->brushOrgX;
355 dc->brushOrgY = dcs->brushOrgY;
356 dc->textAlign = dcs->textAlign;
357 dc->charExtra = dcs->charExtra;
358 dc->breakTotalExtra = dcs->breakTotalExtra;
359 dc->breakCount = dcs->breakCount;
360 dc->breakExtra = dcs->breakExtra;
361 dc->breakRem = dcs->breakRem;
362 dc->MapMode = dcs->MapMode;
363 dc->GraphicsMode = dcs->GraphicsMode;
364 #if 0
365 /* Apparently, the DC origin is not changed by [GS]etDCState */
366 dc->DCOrgX = dcs->DCOrgX;
367 dc->DCOrgY = dcs->DCOrgY;
368 #endif
369 dc->CursPosX = dcs->CursPosX;
370 dc->CursPosY = dcs->CursPosY;
371 dc->ArcDirection = dcs->ArcDirection;
372 dc->xformWorld2Wnd = dcs->xformWorld2Wnd;
373 dc->xformWorld2Vport = dcs->xformWorld2Vport;
374 dc->xformVport2World = dcs->xformVport2World;
375 dc->vport2WorldValid = dcs->vport2WorldValid;
377 dc->wndOrgX = dcs->wndOrgX;
378 dc->wndOrgY = dcs->wndOrgY;
379 dc->wndExtX = dcs->wndExtX;
380 dc->wndExtY = dcs->wndExtY;
381 dc->vportOrgX = dcs->vportOrgX;
382 dc->vportOrgY = dcs->vportOrgY;
383 dc->vportExtX = dcs->vportExtX;
384 dc->vportExtY = dcs->vportExtY;
386 if (!(dc->flags & DC_MEMORY)) dc->bitsPerPixel = dcs->bitsPerPixel;
388 if (dcs->hClipRgn)
390 if (!dc->hClipRgn) dc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
391 CombineRgn( dc->hClipRgn, dcs->hClipRgn, 0, RGN_COPY );
393 else
395 if (dc->hClipRgn) DeleteObject16( dc->hClipRgn );
396 dc->hClipRgn = 0;
398 CLIPPING_UpdateGCRegion( dc );
400 SelectObject( hdc, dcs->hBitmap );
401 SelectObject( hdc, dcs->hBrush );
402 SelectObject( hdc, dcs->hFont );
403 SelectObject( hdc, dcs->hPen );
404 SetBkColor( hdc, dcs->backgroundColor);
405 SetTextColor( hdc, dcs->textColor);
406 GDISelectPalette16( hdc, dcs->hPalette, FALSE );
407 GDI_ReleaseObj( hdcs );
408 GDI_ReleaseObj( hdc );
412 /***********************************************************************
413 * SaveDC16 (GDI.30)
415 INT16 WINAPI SaveDC16( HDC16 hdc )
417 return (INT16)SaveDC( hdc );
421 /***********************************************************************
422 * SaveDC (GDI32.@)
424 INT WINAPI SaveDC( HDC hdc )
426 HDC hdcs;
427 DC * dc, * dcs;
428 INT ret;
430 dc = DC_GetDCUpdate( hdc );
431 if (!dc) return 0;
433 if(dc->funcs->pSaveDC)
435 ret = dc->funcs->pSaveDC( dc );
436 GDI_ReleaseObj( hdc );
437 return ret;
440 if (!(hdcs = GetDCState16( hdc )))
442 GDI_ReleaseObj( hdc );
443 return 0;
445 dcs = GDI_GetObjPtr( hdcs, DC_MAGIC );
447 /* Copy path. The reason why path saving / restoring is in SaveDC/
448 * RestoreDC and not in GetDCState/SetDCState is that the ...DCState
449 * functions are only in Win16 (which doesn't have paths) and that
450 * SetDCState doesn't allow us to signal an error (which can happen
451 * when copying paths).
453 if (!PATH_AssignGdiPath( &dcs->path, &dc->path ))
455 GDI_ReleaseObj( hdc );
456 GDI_ReleaseObj( hdcs );
457 DeleteDC( hdcs );
458 return 0;
461 dcs->header.hNext = dc->header.hNext;
462 dc->header.hNext = hdcs;
463 TRACE("(%04x): returning %d\n", hdc, dc->saveLevel+1 );
464 ret = ++dc->saveLevel;
465 GDI_ReleaseObj( hdcs );
466 GDI_ReleaseObj( hdc );
467 return ret;
471 /***********************************************************************
472 * RestoreDC16 (GDI.39)
474 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
476 return RestoreDC( hdc, level );
480 /***********************************************************************
481 * RestoreDC (GDI32.@)
483 BOOL WINAPI RestoreDC( HDC hdc, INT level )
485 DC * dc, * dcs;
486 BOOL success;
488 TRACE("%04x %d\n", hdc, level );
489 dc = DC_GetDCPtr( hdc );
490 if(!dc) return FALSE;
491 if(dc->funcs->pRestoreDC)
493 success = dc->funcs->pRestoreDC( dc, level );
494 GDI_ReleaseObj( hdc );
495 return success;
498 if (level == -1) level = dc->saveLevel;
499 if ((level < 1)
500 /* This pair of checks disagrees with MSDN "Platform SDK:
501 Windows GDI" July 2000 which says all negative values
502 for level will be interpreted as an instance relative
503 to the current state. Restricting it to just -1 does
504 not satisfy this */
505 || (level > dc->saveLevel))
507 GDI_ReleaseObj( hdc );
508 return FALSE;
511 success=TRUE;
512 while (dc->saveLevel >= level)
514 HDC16 hdcs = dc->header.hNext;
515 if (!(dcs = GDI_GetObjPtr( hdcs, DC_MAGIC )))
517 GDI_ReleaseObj( hdc );
518 return FALSE;
520 dc->header.hNext = dcs->header.hNext;
521 if (--dc->saveLevel < level)
523 SetDCState16( hdc, hdcs );
524 if (!PATH_AssignGdiPath( &dc->path, &dcs->path ))
525 /* FIXME: This might not be quite right, since we're
526 * returning FALSE but still destroying the saved DC state */
527 success=FALSE;
529 GDI_ReleaseObj( hdcs );
530 DeleteDC( hdcs );
532 GDI_ReleaseObj( hdc );
533 return success;
537 /***********************************************************************
538 * CreateDC16 (GDI.53)
540 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
541 const DEVMODEA *initData )
543 HDC hdc;
544 DC * dc;
545 const DC_FUNCTIONS *funcs;
546 char buf[300];
548 if (!device || !DRIVER_GetDriverName( device, buf, sizeof(buf) ))
549 strcpy(buf, driver);
551 if (!(funcs = DRIVER_FindDriver( buf ))) return 0;
552 if (!(dc = DC_AllocDC( funcs ))) return 0;
553 dc->flags = 0;
555 TRACE("(driver=%s, device=%s, output=%s): returning %04x\n",
556 debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf );
558 if (dc->funcs->pCreateDC &&
559 !dc->funcs->pCreateDC( dc, buf, device, output, initData ))
561 WARN("creation aborted by device\n" );
562 GDI_FreeObject( dc->hSelf, dc );
563 return 0;
566 DC_InitDC( dc );
567 hdc = dc->hSelf;
568 GDI_ReleaseObj( hdc );
569 return hdc;
573 /***********************************************************************
574 * CreateDCA (GDI32.@)
576 HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
577 const DEVMODEA *initData )
579 return CreateDC16( driver, device, output, (const DEVMODEA *)initData );
583 /***********************************************************************
584 * CreateDCW (GDI32.@)
586 HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
587 const DEVMODEW *initData )
589 LPSTR driverA = HEAP_strdupWtoA( GetProcessHeap(), 0, driver );
590 LPSTR deviceA = HEAP_strdupWtoA( GetProcessHeap(), 0, device );
591 LPSTR outputA = HEAP_strdupWtoA( GetProcessHeap(), 0, output );
592 HDC res = CreateDC16( driverA, deviceA, outputA,
593 (const DEVMODEA *)initData /*FIXME*/ );
594 HeapFree( GetProcessHeap(), 0, driverA );
595 HeapFree( GetProcessHeap(), 0, deviceA );
596 HeapFree( GetProcessHeap(), 0, outputA );
597 return res;
601 /***********************************************************************
602 * CreateIC16 (GDI.153)
604 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
605 const DEVMODEA* initData )
607 /* Nothing special yet for ICs */
608 return CreateDC16( driver, device, output, initData );
612 /***********************************************************************
613 * CreateICA (GDI32.@)
615 HDC WINAPI CreateICA( LPCSTR driver, LPCSTR device, LPCSTR output,
616 const DEVMODEA* initData )
618 /* Nothing special yet for ICs */
619 return CreateDCA( driver, device, output, initData );
623 /***********************************************************************
624 * CreateICW (GDI32.@)
626 HDC WINAPI CreateICW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
627 const DEVMODEW* initData )
629 /* Nothing special yet for ICs */
630 return CreateDCW( driver, device, output, initData );
634 /***********************************************************************
635 * CreateCompatibleDC16 (GDI.52)
637 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
639 return (HDC16)CreateCompatibleDC( hdc );
643 /***********************************************************************
644 * CreateCompatibleDC (GDI32.@)
646 HDC WINAPI CreateCompatibleDC( HDC hdc )
648 DC *dc, *origDC;
649 const DC_FUNCTIONS *funcs;
651 if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) funcs = origDC->funcs;
652 else funcs = DRIVER_FindDriver( "DISPLAY" );
654 if (!funcs || !(dc = DC_AllocDC( funcs )))
656 if (origDC) GDI_ReleaseObj( hdc );
657 return 0;
660 TRACE("(%04x): returning %04x\n",
661 hdc, dc->hSelf );
663 dc->flags = DC_MEMORY;
664 dc->bitsPerPixel = 1;
665 dc->hBitmap = hPseudoStockBitmap;
667 /* Copy the driver-specific physical device info into
668 * the new DC. The driver may use this read-only info
669 * while creating the compatible DC below. */
670 if (origDC)
671 dc->physDev = origDC->physDev;
673 if (dc->funcs->pCreateDC &&
674 !dc->funcs->pCreateDC( dc, NULL, NULL, NULL, NULL ))
676 WARN("creation aborted by device\n");
677 GDI_FreeObject( dc->hSelf, dc );
678 if (origDC) GDI_ReleaseObj( hdc );
679 return 0;
682 DC_InitDC( dc );
683 GDI_ReleaseObj( dc->hSelf );
684 if (origDC) GDI_ReleaseObj( hdc );
685 return dc->hSelf;
689 /***********************************************************************
690 * DeleteDC16 (GDI.68)
692 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
694 return DeleteDC( hdc );
698 /***********************************************************************
699 * DeleteDC (GDI32.@)
701 BOOL WINAPI DeleteDC( HDC hdc )
703 DC * dc = GDI_GetObjPtr( hdc, DC_MAGIC );
704 if (!dc) return FALSE;
706 TRACE("%04x\n", hdc );
708 /* Call hook procedure to check whether is it OK to delete this DC */
709 if (dc->hookThunk && !(dc->flags & (DC_SAVED | DC_MEMORY)))
711 DCHOOKPROC proc = dc->hookThunk;
712 if (proc)
714 DWORD data = dc->dwHookData;
715 GDI_ReleaseObj( hdc );
716 if (!proc( hdc, DCHC_DELETEDC, data, 0 )) return FALSE;
717 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
721 while (dc->saveLevel)
723 DC * dcs;
724 HDC16 hdcs = dc->header.hNext;
725 if (!(dcs = GDI_GetObjPtr( hdcs, DC_MAGIC ))) break;
726 dc->header.hNext = dcs->header.hNext;
727 dc->saveLevel--;
728 GDI_ReleaseObj( hdcs );
729 DeleteDC( hdcs );
732 if (!(dc->flags & DC_SAVED))
734 SelectObject( hdc, GetStockObject(BLACK_PEN) );
735 SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
736 SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
737 if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc);
740 if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
741 if (dc->hVisRgn) DeleteObject( dc->hVisRgn );
742 if (dc->hGCClipRgn) DeleteObject( dc->hGCClipRgn );
743 if (dc->pAbortProc) THUNK_Free( (FARPROC)dc->pAbortProc );
744 if (dc->hookThunk) THUNK_Free( (FARPROC)dc->hookThunk );
745 PATH_DestroyGdiPath(&dc->path);
747 return GDI_FreeObject( hdc, dc );
751 /***********************************************************************
752 * ResetDC16 (GDI.376)
754 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
756 FIXME("stub\n" );
757 return hdc;
761 /***********************************************************************
762 * ResetDCA (GDI32.@)
764 HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
766 FIXME("stub\n" );
767 return hdc;
771 /***********************************************************************
772 * ResetDCW (GDI32.@)
774 HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode )
776 FIXME("stub\n" );
777 return hdc;
781 /***********************************************************************
782 * GetDeviceCaps16 (GDI.80)
784 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
786 INT16 ret = GetDeviceCaps( hdc, cap );
787 /* some apps don't expect -1 and think it's a B&W screen */
788 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
789 return ret;
793 /***********************************************************************
794 * GetDeviceCaps (GDI32.@)
796 INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
798 DC *dc;
799 INT ret = 0;
800 POINT pt;
802 /* Device capabilities for the printer */
803 switch (cap)
805 case PHYSICALWIDTH:
806 if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) ret = pt.x;
807 break;
808 case PHYSICALHEIGHT:
809 if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) ret = pt.y;
810 break;
811 case PHYSICALOFFSETX:
812 if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) ret = pt.x;
813 break;
814 case PHYSICALOFFSETY:
815 if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) ret = pt.y;
816 break;
817 case SCALINGFACTORX:
818 if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) ret = pt.x;
819 break;
820 case SCALINGFACTORY:
821 if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) ret = pt.y;
822 break;
823 case CAPS1:
824 FIXME("(%04x,%d): DeviceCaps param CAPS1 is UNIMPLEMENTED, will yield 0!\n",
825 hdc,cap );
827 /* please see wingdi.h for the possible bit-flag values that need
828 to be returned.
830 also, see
831 http://msdn.microsoft.com/library/ddkdoc/win95ddk/graphcnt_1m0p.htm
833 the fall-through to 'default' is on purpose */
836 default:
837 if ((cap < 0) || (cap > sizeof(DeviceCaps)-sizeof(WORD))) break;
839 if (((cap>=46) && (cap<88)) || ((cap>=92) && (cap<104)))
840 FIXME("(%04x,%d): unsupported DeviceCaps capability, will yield 0!\n",
841 hdc,cap );
842 if ((dc = DC_GetDCPtr( hdc )))
844 if (dc->devCaps)
846 ret = *(WORD *)(((char *)dc->devCaps) + cap);
847 if ((cap == NUMCOLORS) && (ret == 0xffff)) ret = -1;
849 GDI_ReleaseObj( hdc );
851 break;
854 TRACE("(%04x,%d): returning %d\n", hdc, cap, ret );
855 return ret;
859 /***********************************************************************
860 * SetBkColor16 (GDI.1)
862 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
864 return SetBkColor( hdc, color );
868 /***********************************************************************
869 * SetBkColor (GDI32.@)
871 COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
873 COLORREF oldColor;
874 DC * dc = DC_GetDCPtr( hdc );
876 if (!dc) return 0x80000000;
877 if (dc->funcs->pSetBkColor)
878 oldColor = dc->funcs->pSetBkColor(dc, color);
879 else {
880 oldColor = dc->backgroundColor;
881 dc->backgroundColor = color;
883 GDI_ReleaseObj( hdc );
884 return oldColor;
888 /***********************************************************************
889 * SetTextColor16 (GDI.9)
891 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
893 return SetTextColor( hdc, color );
897 /***********************************************************************
898 * SetTextColor (GDI32.@)
900 COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
902 COLORREF oldColor;
903 DC * dc = DC_GetDCPtr( hdc );
905 if (!dc) return 0x80000000;
906 if (dc->funcs->pSetTextColor)
907 oldColor = dc->funcs->pSetTextColor(dc, color);
908 else {
909 oldColor = dc->textColor;
910 dc->textColor = color;
912 GDI_ReleaseObj( hdc );
913 return oldColor;
916 /***********************************************************************
917 * SetTextAlign16 (GDI.346)
919 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
921 return SetTextAlign( hdc, align );
925 /***********************************************************************
926 * SetTextAlign (GDI32.@)
928 UINT WINAPI SetTextAlign( HDC hdc, UINT align )
930 UINT prevAlign;
931 DC *dc = DC_GetDCPtr( hdc );
932 if (!dc) return 0x0;
933 if (dc->funcs->pSetTextAlign)
934 prevAlign = dc->funcs->pSetTextAlign(dc, align);
935 else {
936 prevAlign = dc->textAlign;
937 dc->textAlign = align;
939 GDI_ReleaseObj( hdc );
940 return prevAlign;
943 /***********************************************************************
944 * GetDCOrgEx (GDI32.@)
946 BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
948 DC * dc;
950 if (!lpp) return FALSE;
951 if (!(dc = DC_GetDCPtr( hDC ))) return FALSE;
953 lpp->x = lpp->y = 0;
954 if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc, lpp );
955 lpp->x += dc->DCOrgX;
956 lpp->y += dc->DCOrgY;
957 GDI_ReleaseObj( hDC );
958 return TRUE;
962 /***********************************************************************
963 * GetDCOrg (GDI.79)
965 DWORD WINAPI GetDCOrg16( HDC16 hdc )
967 POINT pt;
968 if( GetDCOrgEx( hdc, &pt) )
969 return MAKELONG( (WORD)pt.x, (WORD)pt.y );
970 return 0;
974 /***********************************************************************
975 * SetDCOrg (GDI.117)
977 DWORD WINAPI SetDCOrg16( HDC16 hdc, INT16 x, INT16 y )
979 DWORD prevOrg;
980 DC *dc = DC_GetDCPtr( hdc );
981 if (!dc) return 0;
982 prevOrg = dc->DCOrgX | (dc->DCOrgY << 16);
983 dc->DCOrgX = x;
984 dc->DCOrgY = y;
985 GDI_ReleaseObj( hdc );
986 return prevOrg;
990 /***********************************************************************
991 * SetGraphicsMode (GDI32.@)
993 INT WINAPI SetGraphicsMode( HDC hdc, INT mode )
995 INT ret = 0;
996 DC *dc = DC_GetDCPtr( hdc );
998 /* One would think that setting the graphics mode to GM_COMPATIBLE
999 * would also reset the world transformation matrix to the unity
1000 * matrix. However, in Windows, this is not the case. This doesn't
1001 * make a lot of sense to me, but that's the way it is.
1003 if (!dc) return 0;
1004 if ((mode > 0) || (mode <= GM_LAST))
1006 ret = dc->GraphicsMode;
1007 dc->GraphicsMode = mode;
1009 GDI_ReleaseObj( hdc );
1010 return ret;
1014 /***********************************************************************
1015 * SetArcDirection16 (GDI.525)
1017 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
1019 return SetArcDirection( (HDC)hdc, (INT)nDirection );
1023 /***********************************************************************
1024 * SetArcDirection (GDI32.@)
1026 INT WINAPI SetArcDirection( HDC hdc, INT nDirection )
1028 DC * dc;
1029 INT nOldDirection = 0;
1031 if (nDirection!=AD_COUNTERCLOCKWISE && nDirection!=AD_CLOCKWISE)
1033 SetLastError(ERROR_INVALID_PARAMETER);
1034 return 0;
1037 if ((dc = DC_GetDCPtr( hdc )))
1039 nOldDirection = dc->ArcDirection;
1040 dc->ArcDirection = nDirection;
1041 GDI_ReleaseObj( hdc );
1043 return nOldDirection;
1047 /***********************************************************************
1048 * GetWorldTransform (GDI32.@)
1050 BOOL WINAPI GetWorldTransform( HDC hdc, LPXFORM xform )
1052 DC * dc;
1053 if (!xform) return FALSE;
1054 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
1055 *xform = dc->xformWorld2Wnd;
1056 GDI_ReleaseObj( hdc );
1057 return TRUE;
1061 /***********************************************************************
1062 * SetWorldTransform (GDI32.@)
1064 BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
1066 BOOL ret = FALSE;
1067 DC *dc = DC_GetDCPtr( hdc );
1069 if (!dc) return FALSE;
1070 if (!xform) goto done;
1072 /* Check that graphics mode is GM_ADVANCED */
1073 if (dc->GraphicsMode!=GM_ADVANCED) goto done;
1075 dc->xformWorld2Wnd = *xform;
1076 DC_UpdateXforms( dc );
1077 ret = TRUE;
1078 done:
1079 GDI_ReleaseObj( hdc );
1080 return ret;
1084 /****************************************************************************
1085 * ModifyWorldTransform [GDI32.@]
1086 * Modifies the world transformation for a device context.
1088 * PARAMS
1089 * hdc [I] Handle to device context
1090 * xform [I] XFORM structure that will be used to modify the world
1091 * transformation
1092 * iMode [I] Specifies in what way to modify the world transformation
1093 * Possible values:
1094 * MWT_IDENTITY
1095 * Resets the world transformation to the identity matrix.
1096 * The parameter xform is ignored.
1097 * MWT_LEFTMULTIPLY
1098 * Multiplies xform into the world transformation matrix from
1099 * the left.
1100 * MWT_RIGHTMULTIPLY
1101 * Multiplies xform into the world transformation matrix from
1102 * the right.
1104 * RETURNS STD
1106 BOOL WINAPI ModifyWorldTransform( HDC hdc, const XFORM *xform,
1107 DWORD iMode )
1109 BOOL ret = FALSE;
1110 DC *dc = DC_GetDCPtr( hdc );
1112 /* Check for illegal parameters */
1113 if (!dc) return FALSE;
1114 if (!xform) goto done;
1116 /* Check that graphics mode is GM_ADVANCED */
1117 if (dc->GraphicsMode!=GM_ADVANCED) goto done;
1119 switch (iMode)
1121 case MWT_IDENTITY:
1122 dc->xformWorld2Wnd.eM11 = 1.0f;
1123 dc->xformWorld2Wnd.eM12 = 0.0f;
1124 dc->xformWorld2Wnd.eM21 = 0.0f;
1125 dc->xformWorld2Wnd.eM22 = 1.0f;
1126 dc->xformWorld2Wnd.eDx = 0.0f;
1127 dc->xformWorld2Wnd.eDy = 0.0f;
1128 break;
1129 case MWT_LEFTMULTIPLY:
1130 CombineTransform( &dc->xformWorld2Wnd, xform,
1131 &dc->xformWorld2Wnd );
1132 break;
1133 case MWT_RIGHTMULTIPLY:
1134 CombineTransform( &dc->xformWorld2Wnd, &dc->xformWorld2Wnd,
1135 xform );
1136 break;
1137 default:
1138 goto done;
1141 DC_UpdateXforms( dc );
1142 ret = TRUE;
1143 done:
1144 GDI_ReleaseObj( hdc );
1145 return ret;
1149 /****************************************************************************
1150 * CombineTransform [GDI32.@]
1151 * Combines two transformation matrices.
1153 * PARAMS
1154 * xformResult [O] Stores the result of combining the two matrices
1155 * xform1 [I] Specifies the first matrix to apply
1156 * xform2 [I] Specifies the second matrix to apply
1158 * REMARKS
1159 * The same matrix can be passed in for more than one of the parameters.
1161 * RETURNS STD
1163 BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1,
1164 const XFORM *xform2 )
1166 XFORM xformTemp;
1168 /* Check for illegal parameters */
1169 if (!xformResult || !xform1 || !xform2)
1170 return FALSE;
1172 /* Create the result in a temporary XFORM, since xformResult may be
1173 * equal to xform1 or xform2 */
1174 xformTemp.eM11 = xform1->eM11 * xform2->eM11 +
1175 xform1->eM12 * xform2->eM21;
1176 xformTemp.eM12 = xform1->eM11 * xform2->eM12 +
1177 xform1->eM12 * xform2->eM22;
1178 xformTemp.eM21 = xform1->eM21 * xform2->eM11 +
1179 xform1->eM22 * xform2->eM21;
1180 xformTemp.eM22 = xform1->eM21 * xform2->eM12 +
1181 xform1->eM22 * xform2->eM22;
1182 xformTemp.eDx = xform1->eDx * xform2->eM11 +
1183 xform1->eDy * xform2->eM21 +
1184 xform2->eDx;
1185 xformTemp.eDy = xform1->eDx * xform2->eM12 +
1186 xform1->eDy * xform2->eM22 +
1187 xform2->eDy;
1189 /* Copy the result to xformResult */
1190 *xformResult = xformTemp;
1192 return TRUE;
1196 /***********************************************************************
1197 * SetDCHook (GDI.190)
1200 /* ### start build ### */
1201 extern WORD CALLBACK GDI_CallTo16_word_wwll(FARPROC16,WORD,WORD,LONG,LONG);
1202 /* ### stop build ### */
1204 /**********************************************************************/
1206 BOOL16 WINAPI SetDCHook( HDC16 hdc, FARPROC16 hookProc, DWORD dwHookData )
1208 DC *dc = DC_GetDCPtr( hdc );
1209 if (!dc) return FALSE;
1212 * Note: We store the original SEGPTR 'hookProc' as we need to be
1213 * able to return it verbatim in GetDCHook,
1215 * On the other hand, we still call THUNK_Alloc and store the
1216 * 32-bit thunk into another DC member, because THUNK_Alloc
1217 * recognizes the (typical) case that the 'hookProc' is indeed
1218 * the 16-bit API entry point of a built-in routine (e.g. DCHook16)
1220 * We could perform that test every time the hook is about to
1221 * be called (or else we could live with the 32->16->32 detour),
1222 * but this way is the most efficient ...
1225 dc->hookProc = hookProc;
1226 dc->dwHookData = dwHookData;
1228 THUNK_Free( (FARPROC)dc->hookThunk );
1229 dc->hookThunk = (DCHOOKPROC)
1230 THUNK_Alloc( hookProc, (RELAY)GDI_CallTo16_word_wwll );
1232 GDI_ReleaseObj( hdc );
1233 return TRUE;
1237 /***********************************************************************
1238 * GetDCHook (GDI.191)
1240 DWORD WINAPI GetDCHook( HDC16 hdc, FARPROC16 *phookProc )
1242 DC *dc = DC_GetDCPtr( hdc );
1243 if (!dc) return 0;
1244 *phookProc = dc->hookProc;
1245 GDI_ReleaseObj( hdc );
1246 return dc->dwHookData;
1250 /***********************************************************************
1251 * SetHookFlags (GDI.192)
1253 WORD WINAPI SetHookFlags16(HDC16 hDC, WORD flags)
1255 DC *dc = DC_GetDCPtr( hDC );
1257 if( dc )
1259 WORD wRet = dc->flags & DC_DIRTY;
1261 /* "Undocumented Windows" info is slightly confusing.
1264 TRACE("hDC %04x, flags %04x\n",hDC,flags);
1266 if( flags & DCHF_INVALIDATEVISRGN )
1267 dc->flags |= DC_DIRTY;
1268 else if( flags & DCHF_VALIDATEVISRGN || !flags )
1269 dc->flags &= ~DC_DIRTY;
1270 GDI_ReleaseObj( hDC );
1271 return wRet;
1273 return 0;
1276 /***********************************************************************
1277 * SetICMMode (GDI32.@)
1279 INT WINAPI SetICMMode(HDC hdc, INT iEnableICM)
1281 /*FIXME Asuming that ICM is always off, and cannot be turned on */
1282 if (iEnableICM == ICM_OFF) return ICM_OFF;
1283 if (iEnableICM == ICM_ON) return 0;
1284 if (iEnableICM == ICM_QUERY) return ICM_OFF;
1285 return 0;
1288 /***********************************************************************
1289 * GetDeviceGammaRamp (GDI32.@)
1291 BOOL WINAPI GetDeviceGammaRamp(HDC hDC, LPVOID ptr)
1293 BOOL ret = FALSE;
1294 DC *dc = DC_GetDCPtr( hDC );
1296 if( dc )
1298 if (dc->funcs->pGetDeviceGammaRamp)
1299 ret = dc->funcs->pGetDeviceGammaRamp(dc, ptr);
1300 GDI_ReleaseObj( hDC );
1302 return ret;
1305 /***********************************************************************
1306 * SetDeviceGammaRamp (GDI32.@)
1308 BOOL WINAPI SetDeviceGammaRamp(HDC hDC, LPVOID ptr)
1310 BOOL ret = FALSE;
1311 DC *dc = DC_GetDCPtr( hDC );
1313 if( dc )
1315 if (dc->funcs->pSetDeviceGammaRamp)
1316 ret = dc->funcs->pSetDeviceGammaRamp(dc, ptr);
1317 GDI_ReleaseObj( hDC );
1319 return ret;
1322 /***********************************************************************
1323 * GetColorSpace (GDI32.@)
1325 HCOLORSPACE WINAPI GetColorSpace(HDC hdc)
1327 /*FIXME Need to to whatever GetColorSpace actually does */
1328 return 0;
1331 /***********************************************************************
1332 * CreateColorSpaceA (GDI32.@)
1334 HCOLORSPACE WINAPI CreateColorSpaceA( LPLOGCOLORSPACEA lpLogColorSpace )
1336 FIXME( "stub\n" );
1337 return 0;
1340 /***********************************************************************
1341 * CreateColorSpaceW (GDI32.@)
1343 HCOLORSPACE WINAPI CreateColorSpaceW( LPLOGCOLORSPACEW lpLogColorSpace )
1345 FIXME( "stub\n" );
1346 return 0;
1349 /***********************************************************************
1350 * DeleteColorSpace (GDI32.@)
1352 BOOL WINAPI DeleteColorSpace( HCOLORSPACE hColorSpace )
1354 FIXME( "stub\n" );
1356 return TRUE;
1359 /***********************************************************************
1360 * SetColorSpace (GDI32.@)
1362 HCOLORSPACE WINAPI SetColorSpace( HDC hDC, HCOLORSPACE hColorSpace )
1364 FIXME( "stub\n" );
1366 return hColorSpace;
1369 /***********************************************************************
1370 * GetBoundsRect16 (GDI.194)
1372 UINT16 WINAPI GetBoundsRect16(HDC16 hdc, LPRECT16 rect, UINT16 flags)
1374 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1377 /***********************************************************************
1378 * GetBoundsRect (GDI32.@)
1380 UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
1382 FIXME("(): stub\n");
1383 return DCB_RESET; /* bounding rectangle always empty */
1386 /***********************************************************************
1387 * SetBoundsRect16 (GDI.193)
1389 UINT16 WINAPI SetBoundsRect16(HDC16 hdc, const RECT16* rect, UINT16 flags)
1391 if ( (flags & DCB_ACCUMULATE) || (flags & DCB_ENABLE) )
1392 FIXME("(%04x, %p, %04x): stub\n", hdc, rect, flags );
1394 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1397 /***********************************************************************
1398 * SetBoundsRect (GDI32.@)
1400 UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
1402 FIXME("(): stub\n");
1403 return DCB_DISABLE; /* bounding rectangle always empty */
1407 /***********************************************************************
1408 * GetRelAbs (GDI32.@)
1410 INT WINAPI GetRelAbs( HDC hdc, DWORD dwIgnore )
1412 INT ret = 0;
1413 DC *dc = DC_GetDCPtr( hdc );
1414 if (dc) ret = dc->relAbsMode;
1415 GDI_ReleaseObj( hdc );
1416 return ret;
1419 /***********************************************************************
1420 * Death (GDI.121)
1422 * Disables GDI, switches back to text mode.
1423 * We don't have to do anything here,
1424 * just let console support handle everything
1426 void WINAPI Death16(HDC16 hDC)
1428 MESSAGE("Death(%04x) called. Application enters text mode...\n", hDC);
1431 /***********************************************************************
1432 * Resurrection (GDI.122)
1434 * Restores GDI functionality
1436 void WINAPI Resurrection16(HDC16 hDC,
1437 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1439 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n", hDC, w1, w2, w3, w4, w5, w6);
1442 /***********************************************************************
1443 * GetLayout (GDI32.@)
1445 * Gets left->right or right->left text layout flags of a dc.
1446 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1449 DWORD WINAPI GetLayout(HDC hdc)
1451 FIXME("(%08x): stub\n", hdc);
1452 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1453 return 0;
1456 /***********************************************************************
1457 * SetLayout (GDI32.@)
1459 * Sets left->right or right->left text layout flags of a dc.
1460 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1463 DWORD WINAPI SetLayout(HDC hdc, DWORD layout)
1465 FIXME("(%08x,%08lx): stub\n", hdc, layout);
1466 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1467 return 0;