Added /g debug format to dump GUIDs.
[wine/multimedia.git] / objects / dc.c
blob6b99ad89c5a6c552cadfea89b129e8b1fa998952
1 /*
2 * GDI Device Context functions
4 * Copyright 1993 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include <stdlib.h>
24 #include <string.h>
25 #include "gdi.h"
26 #include "heap.h"
27 #include "wine/debug.h"
28 #include "font.h"
29 #include "winerror.h"
30 #include "windef.h"
31 #include "wingdi.h"
32 #include "wine/winuser16.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dc);
36 /* ### start build ### */
37 extern WORD CALLBACK GDI_CallTo16_word_wwll(FARPROC16,WORD,WORD,LONG,LONG);
38 /* ### stop build ### */
40 static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj );
42 static const struct gdi_obj_funcs dc_funcs =
44 NULL, /* pSelectObject */
45 NULL, /* pGetObject16 */
46 NULL, /* pGetObjectA */
47 NULL, /* pGetObjectW */
48 NULL, /* pUnrealizeObject */
49 DC_DeleteObject /* pDeleteObject */
52 /***********************************************************************
53 * DC_AllocDC
55 DC *DC_AllocDC( const DC_FUNCTIONS *funcs )
57 HDC hdc;
58 DC *dc;
60 if (!(dc = GDI_AllocObject( sizeof(*dc), DC_MAGIC, &hdc, &dc_funcs ))) return NULL;
62 dc->hSelf = hdc;
63 dc->funcs = funcs;
64 dc->physDev = NULL;
65 dc->saveLevel = 0;
66 dc->dwHookData = 0;
67 dc->hookProc = NULL;
68 dc->hookThunk = NULL;
69 dc->wndOrgX = 0;
70 dc->wndOrgY = 0;
71 dc->wndExtX = 1;
72 dc->wndExtY = 1;
73 dc->vportOrgX = 0;
74 dc->vportOrgY = 0;
75 dc->vportExtX = 1;
76 dc->vportExtY = 1;
77 dc->flags = 0;
78 dc->hClipRgn = 0;
79 dc->hVisRgn = 0;
80 dc->hGCClipRgn = 0;
81 dc->hPen = GetStockObject( BLACK_PEN );
82 dc->hBrush = GetStockObject( WHITE_BRUSH );
83 dc->hFont = GetStockObject( SYSTEM_FONT );
84 dc->hBitmap = 0;
85 dc->hDevice = 0;
86 dc->hPalette = GetStockObject( DEFAULT_PALETTE );
87 dc->gdiFont = 0;
88 dc->ROPmode = R2_COPYPEN;
89 dc->polyFillMode = ALTERNATE;
90 dc->stretchBltMode = BLACKONWHITE;
91 dc->relAbsMode = ABSOLUTE;
92 dc->backgroundMode = OPAQUE;
93 dc->backgroundColor = RGB( 255, 255, 255 );
94 dc->textColor = RGB( 0, 0, 0 );
95 dc->brushOrgX = 0;
96 dc->brushOrgY = 0;
97 dc->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
98 dc->charExtra = 0;
99 dc->breakTotalExtra = 0;
100 dc->breakCount = 0;
101 dc->breakExtra = 0;
102 dc->breakRem = 0;
103 dc->totalExtent.left = 0;
104 dc->totalExtent.top = 0;
105 dc->totalExtent.right = 0;
106 dc->totalExtent.bottom = 0;
107 dc->bitsPerPixel = 1;
108 dc->MapMode = MM_TEXT;
109 dc->GraphicsMode = GM_COMPATIBLE;
110 dc->pAbortProc = NULL;
111 dc->CursPosX = 0;
112 dc->CursPosY = 0;
113 dc->ArcDirection = AD_COUNTERCLOCKWISE;
114 dc->xformWorld2Wnd.eM11 = 1.0f;
115 dc->xformWorld2Wnd.eM12 = 0.0f;
116 dc->xformWorld2Wnd.eM21 = 0.0f;
117 dc->xformWorld2Wnd.eM22 = 1.0f;
118 dc->xformWorld2Wnd.eDx = 0.0f;
119 dc->xformWorld2Wnd.eDy = 0.0f;
120 dc->xformWorld2Vport = dc->xformWorld2Wnd;
121 dc->xformVport2World = dc->xformWorld2Wnd;
122 dc->vport2WorldValid = TRUE;
123 PATH_InitGdiPath(&dc->path);
124 return dc;
129 /***********************************************************************
130 * DC_GetDCPtr
132 DC *DC_GetDCPtr( HDC hdc )
134 GDIOBJHDR *ptr = GDI_GetObjPtr( hdc, MAGIC_DONTCARE );
135 if (!ptr) return NULL;
136 if ((GDIMAGIC(ptr->wMagic) == DC_MAGIC) ||
137 (GDIMAGIC(ptr->wMagic) == METAFILE_DC_MAGIC) ||
138 (GDIMAGIC(ptr->wMagic) == ENHMETAFILE_DC_MAGIC))
139 return (DC *)ptr;
140 GDI_ReleaseObj( hdc );
141 SetLastError( ERROR_INVALID_HANDLE );
142 return NULL;
145 /***********************************************************************
146 * DC_GetDCUpdate
148 * Retrieve a DC ptr while making sure the visRgn is updated.
149 * This function may call up to USER so the GDI lock should _not_
150 * be held when calling it.
152 DC *DC_GetDCUpdate( HDC hdc )
154 DC *dc = DC_GetDCPtr( hdc );
155 if (!dc) return NULL;
156 while (dc->flags & DC_DIRTY)
158 dc->flags &= ~DC_DIRTY;
159 if (!(dc->flags & (DC_SAVED | DC_MEMORY)))
161 DCHOOKPROC proc = dc->hookThunk;
162 if (proc)
164 DWORD data = dc->dwHookData;
165 GDI_ReleaseObj( hdc );
166 proc( hdc, DCHC_INVALIDVISRGN, data, 0 );
167 if (!(dc = DC_GetDCPtr( hdc ))) break;
168 /* otherwise restart the loop in case it became dirty again in the meantime */
172 return dc;
176 /***********************************************************************
177 * DC_DeleteObject
179 static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj )
181 GDI_ReleaseObj( handle );
182 return DeleteDC( handle );
186 /***********************************************************************
187 * DC_InitDC
189 * Setup device-specific DC values for a newly created DC.
191 void DC_InitDC( DC* dc )
193 RealizeDefaultPalette16( dc->hSelf );
194 SetTextColor( dc->hSelf, dc->textColor );
195 SetBkColor( dc->hSelf, dc->backgroundColor );
196 SelectObject( dc->hSelf, dc->hPen );
197 SelectObject( dc->hSelf, dc->hBrush );
198 SelectObject( dc->hSelf, dc->hFont );
199 CLIPPING_UpdateGCRegion( dc );
203 /***********************************************************************
204 * DC_InvertXform
206 * Computes the inverse of the transformation xformSrc and stores it to
207 * xformDest. Returns TRUE if successful or FALSE if the xformSrc matrix
208 * is singular.
210 static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
212 FLOAT determinant;
214 determinant = xformSrc->eM11*xformSrc->eM22 -
215 xformSrc->eM12*xformSrc->eM21;
216 if (determinant > -1e-12 && determinant < 1e-12)
217 return FALSE;
219 xformDest->eM11 = xformSrc->eM22 / determinant;
220 xformDest->eM12 = -xformSrc->eM12 / determinant;
221 xformDest->eM21 = -xformSrc->eM21 / determinant;
222 xformDest->eM22 = xformSrc->eM11 / determinant;
223 xformDest->eDx = -xformSrc->eDx * xformDest->eM11 -
224 xformSrc->eDy * xformDest->eM21;
225 xformDest->eDy = -xformSrc->eDx * xformDest->eM12 -
226 xformSrc->eDy * xformDest->eM22;
228 return TRUE;
232 /***********************************************************************
233 * DC_UpdateXforms
235 * Updates the xformWorld2Vport, xformVport2World and vport2WorldValid
236 * fields of the specified DC by creating a transformation that
237 * represents the current mapping mode and combining it with the DC's
238 * world transform. This function should be called whenever the
239 * parameters associated with the mapping mode (window and viewport
240 * extents and origins) or the world transform change.
242 void DC_UpdateXforms( DC *dc )
244 XFORM xformWnd2Vport;
245 FLOAT scaleX, scaleY;
247 /* Construct a transformation to do the window-to-viewport conversion */
248 scaleX = (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX;
249 scaleY = (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY;
250 xformWnd2Vport.eM11 = scaleX;
251 xformWnd2Vport.eM12 = 0.0;
252 xformWnd2Vport.eM21 = 0.0;
253 xformWnd2Vport.eM22 = scaleY;
254 xformWnd2Vport.eDx = (FLOAT)dc->vportOrgX -
255 scaleX * (FLOAT)dc->wndOrgX;
256 xformWnd2Vport.eDy = (FLOAT)dc->vportOrgY -
257 scaleY * (FLOAT)dc->wndOrgY;
259 /* Combine with the world transformation */
260 CombineTransform( &dc->xformWorld2Vport, &dc->xformWorld2Wnd,
261 &xformWnd2Vport );
263 /* Create inverse of world-to-viewport transformation */
264 dc->vport2WorldValid = DC_InvertXform( &dc->xformWorld2Vport,
265 &dc->xformVport2World );
269 /***********************************************************************
270 * GetDCState (GDI.179)
272 HDC16 WINAPI GetDCState16( HDC16 hdc )
274 DC * newdc, * dc;
275 HGDIOBJ handle;
277 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
278 if (!(newdc = GDI_AllocObject( sizeof(DC), DC_MAGIC, &handle, &dc_funcs )))
280 GDI_ReleaseObj( hdc );
281 return 0;
283 TRACE("(%04x): returning %04x\n", hdc, handle );
285 newdc->flags = dc->flags | DC_SAVED;
286 newdc->hPen = dc->hPen;
287 newdc->hBrush = dc->hBrush;
288 newdc->hFont = dc->hFont;
289 newdc->hBitmap = dc->hBitmap;
290 newdc->hDevice = dc->hDevice;
291 newdc->hPalette = dc->hPalette;
292 newdc->totalExtent = dc->totalExtent;
293 newdc->bitsPerPixel = dc->bitsPerPixel;
294 newdc->ROPmode = dc->ROPmode;
295 newdc->polyFillMode = dc->polyFillMode;
296 newdc->stretchBltMode = dc->stretchBltMode;
297 newdc->relAbsMode = dc->relAbsMode;
298 newdc->backgroundMode = dc->backgroundMode;
299 newdc->backgroundColor = dc->backgroundColor;
300 newdc->textColor = dc->textColor;
301 newdc->brushOrgX = dc->brushOrgX;
302 newdc->brushOrgY = dc->brushOrgY;
303 newdc->textAlign = dc->textAlign;
304 newdc->charExtra = dc->charExtra;
305 newdc->breakTotalExtra = dc->breakTotalExtra;
306 newdc->breakCount = dc->breakCount;
307 newdc->breakExtra = dc->breakExtra;
308 newdc->breakRem = dc->breakRem;
309 newdc->MapMode = dc->MapMode;
310 newdc->GraphicsMode = dc->GraphicsMode;
311 newdc->CursPosX = dc->CursPosX;
312 newdc->CursPosY = dc->CursPosY;
313 newdc->ArcDirection = dc->ArcDirection;
314 newdc->xformWorld2Wnd = dc->xformWorld2Wnd;
315 newdc->xformWorld2Vport = dc->xformWorld2Vport;
316 newdc->xformVport2World = dc->xformVport2World;
317 newdc->vport2WorldValid = dc->vport2WorldValid;
318 newdc->wndOrgX = dc->wndOrgX;
319 newdc->wndOrgY = dc->wndOrgY;
320 newdc->wndExtX = dc->wndExtX;
321 newdc->wndExtY = dc->wndExtY;
322 newdc->vportOrgX = dc->vportOrgX;
323 newdc->vportOrgY = dc->vportOrgY;
324 newdc->vportExtX = dc->vportExtX;
325 newdc->vportExtY = dc->vportExtY;
327 newdc->hSelf = (HDC)handle;
328 newdc->saveLevel = 0;
330 PATH_InitGdiPath( &newdc->path );
332 newdc->pAbortProc = NULL;
333 newdc->hookThunk = NULL;
334 newdc->hookProc = 0;
336 /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
338 newdc->hGCClipRgn = newdc->hVisRgn = 0;
339 if (dc->hClipRgn)
341 newdc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
342 CombineRgn( newdc->hClipRgn, dc->hClipRgn, 0, RGN_COPY );
344 else
345 newdc->hClipRgn = 0;
347 if(dc->gdiFont) {
348 newdc->gdiFont = dc->gdiFont;
349 } else
350 newdc->gdiFont = 0;
352 GDI_ReleaseObj( handle );
353 GDI_ReleaseObj( hdc );
354 return handle;
358 /***********************************************************************
359 * SetDCState (GDI.180)
361 void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
363 DC *dc, *dcs;
365 if (!(dc = DC_GetDCUpdate( hdc ))) return;
366 if (!(dcs = DC_GetDCPtr( hdcs )))
368 GDI_ReleaseObj( hdc );
369 return;
371 if (!dcs->flags & DC_SAVED)
373 GDI_ReleaseObj( hdc );
374 GDI_ReleaseObj( hdcs );
375 return;
377 TRACE("%04x %04x\n", hdc, hdcs );
379 dc->flags = dcs->flags & ~DC_SAVED;
380 dc->hDevice = dcs->hDevice;
381 dc->totalExtent = dcs->totalExtent;
382 dc->ROPmode = dcs->ROPmode;
383 dc->polyFillMode = dcs->polyFillMode;
384 dc->stretchBltMode = dcs->stretchBltMode;
385 dc->relAbsMode = dcs->relAbsMode;
386 dc->backgroundMode = dcs->backgroundMode;
387 dc->backgroundColor = dcs->backgroundColor;
388 dc->textColor = dcs->textColor;
389 dc->brushOrgX = dcs->brushOrgX;
390 dc->brushOrgY = dcs->brushOrgY;
391 dc->textAlign = dcs->textAlign;
392 dc->charExtra = dcs->charExtra;
393 dc->breakTotalExtra = dcs->breakTotalExtra;
394 dc->breakCount = dcs->breakCount;
395 dc->breakExtra = dcs->breakExtra;
396 dc->breakRem = dcs->breakRem;
397 dc->MapMode = dcs->MapMode;
398 dc->GraphicsMode = dcs->GraphicsMode;
399 dc->CursPosX = dcs->CursPosX;
400 dc->CursPosY = dcs->CursPosY;
401 dc->ArcDirection = dcs->ArcDirection;
402 dc->xformWorld2Wnd = dcs->xformWorld2Wnd;
403 dc->xformWorld2Vport = dcs->xformWorld2Vport;
404 dc->xformVport2World = dcs->xformVport2World;
405 dc->vport2WorldValid = dcs->vport2WorldValid;
407 dc->wndOrgX = dcs->wndOrgX;
408 dc->wndOrgY = dcs->wndOrgY;
409 dc->wndExtX = dcs->wndExtX;
410 dc->wndExtY = dcs->wndExtY;
411 dc->vportOrgX = dcs->vportOrgX;
412 dc->vportOrgY = dcs->vportOrgY;
413 dc->vportExtX = dcs->vportExtX;
414 dc->vportExtY = dcs->vportExtY;
416 if (!(dc->flags & DC_MEMORY)) dc->bitsPerPixel = dcs->bitsPerPixel;
418 if (dcs->hClipRgn)
420 if (!dc->hClipRgn) dc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
421 CombineRgn( dc->hClipRgn, dcs->hClipRgn, 0, RGN_COPY );
423 else
425 if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
426 dc->hClipRgn = 0;
428 CLIPPING_UpdateGCRegion( dc );
430 SelectObject( hdc, dcs->hBitmap );
431 SelectObject( hdc, dcs->hBrush );
432 SelectObject( hdc, dcs->hFont );
433 SelectObject( hdc, dcs->hPen );
434 SetBkColor( hdc, dcs->backgroundColor);
435 SetTextColor( hdc, dcs->textColor);
436 GDISelectPalette16( hdc, dcs->hPalette, FALSE );
437 GDI_ReleaseObj( hdcs );
438 GDI_ReleaseObj( hdc );
442 /***********************************************************************
443 * SaveDC (GDI.30)
445 INT16 WINAPI SaveDC16( HDC16 hdc )
447 return (INT16)SaveDC( hdc );
451 /***********************************************************************
452 * SaveDC (GDI32.@)
454 INT WINAPI SaveDC( HDC hdc )
456 HDC hdcs;
457 DC * dc, * dcs;
458 INT ret;
460 dc = DC_GetDCPtr( hdc );
461 if (!dc) return 0;
463 if(dc->funcs->pSaveDC)
465 ret = dc->funcs->pSaveDC( dc->physDev );
466 GDI_ReleaseObj( hdc );
467 return ret;
470 if (!(hdcs = GetDCState16( hdc )))
472 GDI_ReleaseObj( hdc );
473 return 0;
475 dcs = DC_GetDCPtr( hdcs );
477 /* Copy path. The reason why path saving / restoring is in SaveDC/
478 * RestoreDC and not in GetDCState/SetDCState is that the ...DCState
479 * functions are only in Win16 (which doesn't have paths) and that
480 * SetDCState doesn't allow us to signal an error (which can happen
481 * when copying paths).
483 if (!PATH_AssignGdiPath( &dcs->path, &dc->path ))
485 GDI_ReleaseObj( hdc );
486 GDI_ReleaseObj( hdcs );
487 DeleteDC( hdcs );
488 return 0;
491 dcs->header.hNext = dc->header.hNext;
492 dc->header.hNext = hdcs;
493 TRACE("(%04x): returning %d\n", hdc, dc->saveLevel+1 );
494 ret = ++dc->saveLevel;
495 GDI_ReleaseObj( hdcs );
496 GDI_ReleaseObj( hdc );
497 return ret;
501 /***********************************************************************
502 * RestoreDC (GDI.39)
504 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
506 return RestoreDC( hdc, level );
510 /***********************************************************************
511 * RestoreDC (GDI32.@)
513 BOOL WINAPI RestoreDC( HDC hdc, INT level )
515 DC * dc, * dcs;
516 BOOL success;
518 TRACE("%04x %d\n", hdc, level );
519 dc = DC_GetDCUpdate( hdc );
520 if(!dc) return FALSE;
521 if(dc->funcs->pRestoreDC)
523 success = dc->funcs->pRestoreDC( dc->physDev, level );
524 GDI_ReleaseObj( hdc );
525 return success;
528 if (level == -1) level = dc->saveLevel;
529 if ((level < 1)
530 /* This pair of checks disagrees with MSDN "Platform SDK:
531 Windows GDI" July 2000 which says all negative values
532 for level will be interpreted as an instance relative
533 to the current state. Restricting it to just -1 does
534 not satisfy this */
535 || (level > dc->saveLevel))
537 GDI_ReleaseObj( hdc );
538 return FALSE;
541 success=TRUE;
542 while (dc->saveLevel >= level)
544 HDC16 hdcs = dc->header.hNext;
545 if (!(dcs = DC_GetDCPtr( hdcs )))
547 GDI_ReleaseObj( hdc );
548 return FALSE;
550 dc->header.hNext = dcs->header.hNext;
551 if (--dc->saveLevel < level)
553 SetDCState16( hdc, hdcs );
554 if (!PATH_AssignGdiPath( &dc->path, &dcs->path ))
555 /* FIXME: This might not be quite right, since we're
556 * returning FALSE but still destroying the saved DC state */
557 success=FALSE;
559 GDI_ReleaseObj( hdcs );
560 GDI_ReleaseObj( hdc );
561 DeleteDC( hdcs );
562 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
564 GDI_ReleaseObj( hdc );
565 return success;
569 /***********************************************************************
570 * CreateDC (GDI.53)
572 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
573 const DEVMODEA *initData )
575 return CreateDCA( driver, device, output, initData );
578 /***********************************************************************
579 * CreateDCA (GDI32.@)
581 HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
582 const DEVMODEA *initData )
584 HDC hdc;
585 DC * dc;
586 const DC_FUNCTIONS *funcs;
587 char buf[300];
589 GDI_CheckNotLock();
591 if (!device || !DRIVER_GetDriverName( device, buf, sizeof(buf) ))
592 strcpy(buf, driver);
594 if (!(funcs = DRIVER_load_driver( buf )))
596 ERR( "no driver found for %s\n", buf );
597 return 0;
599 if (!(dc = DC_AllocDC( funcs )))
601 DRIVER_release_driver( funcs );
602 return 0;
605 dc->flags = 0;
607 TRACE("(driver=%s, device=%s, output=%s): returning %04x\n",
608 debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf );
610 if (dc->funcs->pCreateDC &&
611 !dc->funcs->pCreateDC( dc, &dc->physDev, buf, device, output, initData ))
613 WARN("creation aborted by device\n" );
614 GDI_FreeObject( dc->hSelf, dc );
615 DRIVER_release_driver( funcs );
616 return 0;
619 dc->totalExtent.left = 0;
620 dc->totalExtent.top = 0;
621 dc->totalExtent.right = GetDeviceCaps( dc->hSelf, HORZRES );
622 dc->totalExtent.bottom = GetDeviceCaps( dc->hSelf, VERTRES );
623 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
625 DC_InitDC( dc );
626 hdc = dc->hSelf;
627 GDI_ReleaseObj( hdc );
628 return hdc;
632 /***********************************************************************
633 * CreateDCW (GDI32.@)
635 HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
636 const DEVMODEW *initData )
638 LPSTR driverA = HEAP_strdupWtoA( GetProcessHeap(), 0, driver );
639 LPSTR deviceA = HEAP_strdupWtoA( GetProcessHeap(), 0, device );
640 LPSTR outputA = HEAP_strdupWtoA( GetProcessHeap(), 0, output );
641 HDC res = CreateDCA( driverA, deviceA, outputA,
642 (const DEVMODEA *)initData /*FIXME*/ );
643 HeapFree( GetProcessHeap(), 0, driverA );
644 HeapFree( GetProcessHeap(), 0, deviceA );
645 HeapFree( GetProcessHeap(), 0, outputA );
646 return res;
650 /***********************************************************************
651 * CreateIC (GDI.153)
653 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
654 const DEVMODEA* initData )
656 /* Nothing special yet for ICs */
657 return CreateDC16( driver, device, output, initData );
661 /***********************************************************************
662 * CreateICA (GDI32.@)
664 HDC WINAPI CreateICA( LPCSTR driver, LPCSTR device, LPCSTR output,
665 const DEVMODEA* initData )
667 /* Nothing special yet for ICs */
668 return CreateDCA( driver, device, output, initData );
672 /***********************************************************************
673 * CreateICW (GDI32.@)
675 HDC WINAPI CreateICW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
676 const DEVMODEW* initData )
678 /* Nothing special yet for ICs */
679 return CreateDCW( driver, device, output, initData );
683 /***********************************************************************
684 * CreateCompatibleDC (GDI.52)
686 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
688 return (HDC16)CreateCompatibleDC( hdc );
692 /***********************************************************************
693 * CreateCompatibleDC (GDI32.@)
695 HDC WINAPI CreateCompatibleDC( HDC hdc )
697 DC *dc, *origDC;
698 const DC_FUNCTIONS *funcs;
700 GDI_CheckNotLock();
702 if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC )))
704 funcs = origDC->funcs;
705 GDI_ReleaseObj( hdc ); /* can't hold the lock while loading the driver */
706 funcs = DRIVER_get_driver( funcs );
708 else funcs = DRIVER_load_driver( "DISPLAY" );
710 if (!funcs) return 0;
712 if (!(dc = DC_AllocDC( funcs )))
714 DRIVER_release_driver( funcs );
715 return 0;
718 TRACE("(%04x): returning %04x\n",
719 hdc, dc->hSelf );
721 dc->flags = DC_MEMORY;
722 dc->bitsPerPixel = 1;
723 dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
725 /* Copy the driver-specific physical device info into
726 * the new DC. The driver may use this read-only info
727 * while creating the compatible DC below. */
728 if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) dc->physDev = origDC->physDev;
730 if (dc->funcs->pCreateDC &&
731 !dc->funcs->pCreateDC( dc, &dc->physDev, NULL, NULL, NULL, NULL ))
733 WARN("creation aborted by device\n");
734 GDI_FreeObject( dc->hSelf, dc );
735 if (origDC) GDI_ReleaseObj( hdc );
736 DRIVER_release_driver( funcs );
737 return 0;
740 dc->totalExtent.left = 0;
741 dc->totalExtent.top = 0;
742 dc->totalExtent.right = 1; /* default bitmap is 1x1 */
743 dc->totalExtent.bottom = 1;
744 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
746 DC_InitDC( dc );
747 GDI_ReleaseObj( dc->hSelf );
748 if (origDC) GDI_ReleaseObj( hdc );
749 return dc->hSelf;
753 /***********************************************************************
754 * DeleteDC (GDI.68)
756 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
758 return DeleteDC( hdc );
762 /***********************************************************************
763 * DeleteDC (GDI32.@)
765 BOOL WINAPI DeleteDC( HDC hdc )
767 const DC_FUNCTIONS *funcs = NULL;
768 DC * dc;
770 TRACE("%04x\n", hdc );
772 GDI_CheckNotLock();
774 if (!(dc = GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
776 /* Call hook procedure to check whether is it OK to delete this DC */
777 if (dc->hookThunk && !(dc->flags & (DC_SAVED | DC_MEMORY)))
779 DCHOOKPROC proc = dc->hookThunk;
780 if (proc)
782 DWORD data = dc->dwHookData;
783 GDI_ReleaseObj( hdc );
784 if (!proc( hdc, DCHC_DELETEDC, data, 0 )) return FALSE;
785 if (!(dc = DC_GetDCPtr( hdc ))) return TRUE; /* deleted by the hook */
789 while (dc->saveLevel)
791 DC * dcs;
792 HDC16 hdcs = dc->header.hNext;
793 if (!(dcs = DC_GetDCPtr( hdcs ))) break;
794 dc->header.hNext = dcs->header.hNext;
795 dc->saveLevel--;
796 if (dcs->hClipRgn) DeleteObject( dcs->hClipRgn );
797 if (dcs->hVisRgn) DeleteObject( dcs->hVisRgn );
798 if (dcs->hGCClipRgn) DeleteObject( dcs->hGCClipRgn );
799 PATH_DestroyGdiPath(&dcs->path);
800 GDI_FreeObject( hdcs, dcs );
803 if (!(dc->flags & DC_SAVED))
805 SelectObject( hdc, GetStockObject(BLACK_PEN) );
806 SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
807 SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
808 SelectObject( hdc, GetStockObject(DEFAULT_BITMAP) );
809 funcs = dc->funcs;
810 if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc->physDev);
811 dc->physDev = NULL;
814 if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
815 if (dc->hVisRgn) DeleteObject( dc->hVisRgn );
816 if (dc->hGCClipRgn) DeleteObject( dc->hGCClipRgn );
817 PATH_DestroyGdiPath(&dc->path);
819 GDI_FreeObject( hdc, dc );
820 if (funcs) DRIVER_release_driver( funcs ); /* do that after releasing the GDI lock */
821 return TRUE;
825 /***********************************************************************
826 * ResetDC (GDI.376)
828 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
830 return ResetDCA(hdc, devmode);
834 /***********************************************************************
835 * ResetDCA (GDI32.@)
837 HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
839 DC *dc;
840 HDC ret = hdc;
842 if ((dc = DC_GetDCPtr( hdc )))
844 if (dc->funcs->pResetDC) ret = dc->funcs->pResetDC( dc->physDev, devmode );
845 GDI_ReleaseObj( hdc );
847 return ret;
851 /***********************************************************************
852 * ResetDCW (GDI32.@)
854 HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode )
856 return ResetDCA(hdc, (const DEVMODEA*)devmode); /* FIXME */
860 /***********************************************************************
861 * GetDeviceCaps (GDI.80)
863 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
865 INT16 ret = GetDeviceCaps( hdc, cap );
866 /* some apps don't expect -1 and think it's a B&W screen */
867 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
868 return ret;
872 /***********************************************************************
873 * GetDeviceCaps (GDI32.@)
875 INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
877 DC *dc;
878 INT ret = 0;
880 if ((dc = DC_GetDCPtr( hdc )))
882 if (dc->funcs->pGetDeviceCaps) ret = dc->funcs->pGetDeviceCaps( dc->physDev, cap );
883 GDI_ReleaseObj( hdc );
885 return ret;
889 /***********************************************************************
890 * SetBkColor (GDI.1)
892 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
894 return SetBkColor( hdc, color );
898 /***********************************************************************
899 * SetBkColor (GDI32.@)
901 COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
903 COLORREF oldColor;
904 DC * dc = DC_GetDCPtr( hdc );
906 if (!dc) return CLR_INVALID;
907 oldColor = dc->backgroundColor;
908 if (dc->funcs->pSetBkColor)
910 color = dc->funcs->pSetBkColor(dc->physDev, color);
911 if (color == CLR_INVALID) /* don't change it */
913 color = oldColor;
914 oldColor = CLR_INVALID;
917 dc->backgroundColor = color;
918 GDI_ReleaseObj( hdc );
919 return oldColor;
923 /***********************************************************************
924 * SetTextColor (GDI.9)
926 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
928 return SetTextColor( hdc, color );
932 /***********************************************************************
933 * SetTextColor (GDI32.@)
935 COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
937 COLORREF oldColor;
938 DC * dc = DC_GetDCPtr( hdc );
940 if (!dc) return CLR_INVALID;
941 oldColor = dc->textColor;
942 if (dc->funcs->pSetTextColor)
944 color = dc->funcs->pSetTextColor(dc->physDev, color);
945 if (color == CLR_INVALID) /* don't change it */
947 color = oldColor;
948 oldColor = CLR_INVALID;
951 dc->textColor = color;
952 GDI_ReleaseObj( hdc );
953 return oldColor;
956 /***********************************************************************
957 * SetTextAlign (GDI.346)
959 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
961 return SetTextAlign( hdc, align );
965 /***********************************************************************
966 * SetTextAlign (GDI32.@)
968 UINT WINAPI SetTextAlign( HDC hdc, UINT align )
970 UINT prevAlign;
971 DC *dc = DC_GetDCPtr( hdc );
972 if (!dc) return 0x0;
973 if (dc->funcs->pSetTextAlign)
974 prevAlign = dc->funcs->pSetTextAlign(dc->physDev, align);
975 else {
976 prevAlign = dc->textAlign;
977 dc->textAlign = align;
979 GDI_ReleaseObj( hdc );
980 return prevAlign;
983 /***********************************************************************
984 * GetDCOrgEx (GDI32.@)
986 BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
988 DC * dc;
990 if (!lpp) return FALSE;
991 if (!(dc = DC_GetDCPtr( hDC ))) return FALSE;
993 lpp->x = lpp->y = 0;
994 if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc->physDev, lpp );
995 GDI_ReleaseObj( hDC );
996 return TRUE;
1000 /***********************************************************************
1001 * GetDCOrg (GDI.79)
1003 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1005 POINT pt;
1006 if( GetDCOrgEx( hdc, &pt) )
1007 return MAKELONG( (WORD)pt.x, (WORD)pt.y );
1008 return 0;
1012 /***********************************************************************
1013 * SetDCOrg (GDI.117)
1015 DWORD WINAPI SetDCOrg16( HDC16 hdc, INT16 x, INT16 y )
1017 DWORD prevOrg = 0;
1018 DC *dc = DC_GetDCPtr( hdc );
1019 if (!dc) return 0;
1020 if (dc->funcs->pSetDCOrg) prevOrg = dc->funcs->pSetDCOrg( dc->physDev, x, y );
1021 GDI_ReleaseObj( hdc );
1022 return prevOrg;
1026 /***********************************************************************
1027 * SetGraphicsMode (GDI32.@)
1029 INT WINAPI SetGraphicsMode( HDC hdc, INT mode )
1031 INT ret = 0;
1032 DC *dc = DC_GetDCPtr( hdc );
1034 /* One would think that setting the graphics mode to GM_COMPATIBLE
1035 * would also reset the world transformation matrix to the unity
1036 * matrix. However, in Windows, this is not the case. This doesn't
1037 * make a lot of sense to me, but that's the way it is.
1039 if (!dc) return 0;
1040 if ((mode > 0) || (mode <= GM_LAST))
1042 ret = dc->GraphicsMode;
1043 dc->GraphicsMode = mode;
1045 GDI_ReleaseObj( hdc );
1046 return ret;
1050 /***********************************************************************
1051 * SetArcDirection (GDI.525)
1053 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
1055 return SetArcDirection( (HDC)hdc, (INT)nDirection );
1059 /***********************************************************************
1060 * SetArcDirection (GDI32.@)
1062 INT WINAPI SetArcDirection( HDC hdc, INT nDirection )
1064 DC * dc;
1065 INT nOldDirection = 0;
1067 if (nDirection!=AD_COUNTERCLOCKWISE && nDirection!=AD_CLOCKWISE)
1069 SetLastError(ERROR_INVALID_PARAMETER);
1070 return 0;
1073 if ((dc = DC_GetDCPtr( hdc )))
1075 nOldDirection = dc->ArcDirection;
1076 dc->ArcDirection = nDirection;
1077 GDI_ReleaseObj( hdc );
1079 return nOldDirection;
1083 /***********************************************************************
1084 * GetWorldTransform (GDI32.@)
1086 BOOL WINAPI GetWorldTransform( HDC hdc, LPXFORM xform )
1088 DC * dc;
1089 if (!xform) return FALSE;
1090 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
1091 *xform = dc->xformWorld2Wnd;
1092 GDI_ReleaseObj( hdc );
1093 return TRUE;
1097 /***********************************************************************
1098 * SetWorldTransform (GDI32.@)
1100 BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
1102 BOOL ret = FALSE;
1103 DC *dc = DC_GetDCPtr( hdc );
1105 if (!dc) return FALSE;
1106 if (!xform) goto done;
1108 /* Check that graphics mode is GM_ADVANCED */
1109 if (dc->GraphicsMode!=GM_ADVANCED) goto done;
1111 dc->xformWorld2Wnd = *xform;
1112 DC_UpdateXforms( dc );
1113 ret = TRUE;
1114 done:
1115 GDI_ReleaseObj( hdc );
1116 return ret;
1120 /****************************************************************************
1121 * ModifyWorldTransform [GDI32.@]
1122 * Modifies the world transformation for a device context.
1124 * PARAMS
1125 * hdc [I] Handle to device context
1126 * xform [I] XFORM structure that will be used to modify the world
1127 * transformation
1128 * iMode [I] Specifies in what way to modify the world transformation
1129 * Possible values:
1130 * MWT_IDENTITY
1131 * Resets the world transformation to the identity matrix.
1132 * The parameter xform is ignored.
1133 * MWT_LEFTMULTIPLY
1134 * Multiplies xform into the world transformation matrix from
1135 * the left.
1136 * MWT_RIGHTMULTIPLY
1137 * Multiplies xform into the world transformation matrix from
1138 * the right.
1140 * RETURNS STD
1142 BOOL WINAPI ModifyWorldTransform( HDC hdc, const XFORM *xform,
1143 DWORD iMode )
1145 BOOL ret = FALSE;
1146 DC *dc = DC_GetDCPtr( hdc );
1148 /* Check for illegal parameters */
1149 if (!dc) return FALSE;
1150 if (!xform) goto done;
1152 /* Check that graphics mode is GM_ADVANCED */
1153 if (dc->GraphicsMode!=GM_ADVANCED) goto done;
1155 switch (iMode)
1157 case MWT_IDENTITY:
1158 dc->xformWorld2Wnd.eM11 = 1.0f;
1159 dc->xformWorld2Wnd.eM12 = 0.0f;
1160 dc->xformWorld2Wnd.eM21 = 0.0f;
1161 dc->xformWorld2Wnd.eM22 = 1.0f;
1162 dc->xformWorld2Wnd.eDx = 0.0f;
1163 dc->xformWorld2Wnd.eDy = 0.0f;
1164 break;
1165 case MWT_LEFTMULTIPLY:
1166 CombineTransform( &dc->xformWorld2Wnd, xform,
1167 &dc->xformWorld2Wnd );
1168 break;
1169 case MWT_RIGHTMULTIPLY:
1170 CombineTransform( &dc->xformWorld2Wnd, &dc->xformWorld2Wnd,
1171 xform );
1172 break;
1173 default:
1174 goto done;
1177 DC_UpdateXforms( dc );
1178 ret = TRUE;
1179 done:
1180 GDI_ReleaseObj( hdc );
1181 return ret;
1185 /****************************************************************************
1186 * CombineTransform [GDI32.@]
1187 * Combines two transformation matrices.
1189 * PARAMS
1190 * xformResult [O] Stores the result of combining the two matrices
1191 * xform1 [I] Specifies the first matrix to apply
1192 * xform2 [I] Specifies the second matrix to apply
1194 * REMARKS
1195 * The same matrix can be passed in for more than one of the parameters.
1197 * RETURNS STD
1199 BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1,
1200 const XFORM *xform2 )
1202 XFORM xformTemp;
1204 /* Check for illegal parameters */
1205 if (!xformResult || !xform1 || !xform2)
1206 return FALSE;
1208 /* Create the result in a temporary XFORM, since xformResult may be
1209 * equal to xform1 or xform2 */
1210 xformTemp.eM11 = xform1->eM11 * xform2->eM11 +
1211 xform1->eM12 * xform2->eM21;
1212 xformTemp.eM12 = xform1->eM11 * xform2->eM12 +
1213 xform1->eM12 * xform2->eM22;
1214 xformTemp.eM21 = xform1->eM21 * xform2->eM11 +
1215 xform1->eM22 * xform2->eM21;
1216 xformTemp.eM22 = xform1->eM21 * xform2->eM12 +
1217 xform1->eM22 * xform2->eM22;
1218 xformTemp.eDx = xform1->eDx * xform2->eM11 +
1219 xform1->eDy * xform2->eM21 +
1220 xform2->eDx;
1221 xformTemp.eDy = xform1->eDx * xform2->eM12 +
1222 xform1->eDy * xform2->eM22 +
1223 xform2->eDy;
1225 /* Copy the result to xformResult */
1226 *xformResult = xformTemp;
1228 return TRUE;
1232 /***********************************************************************
1233 * SetDCHook (GDI32.@)
1235 * Note: this doesn't exist in Win32, we add it here because user32 needs it.
1237 BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD dwHookData )
1239 DC *dc = DC_GetDCPtr( hdc );
1241 if (!dc) return FALSE;
1242 dc->dwHookData = dwHookData;
1243 dc->hookThunk = hookProc;
1244 GDI_ReleaseObj( hdc );
1245 return TRUE;
1249 /* relay function to call the 16-bit DC hook proc */
1250 static BOOL16 WINAPI call_dc_hook16( HDC16 hdc, WORD code, DWORD data, LPARAM lParam )
1252 FARPROC16 proc = NULL;
1253 DC *dc = DC_GetDCPtr( hdc );
1254 if (!dc) return FALSE;
1255 proc = dc->hookProc;
1256 GDI_ReleaseObj( hdc );
1257 if (!proc) return FALSE;
1258 return GDI_CallTo16_word_wwll( proc, hdc, code, data, lParam );
1261 /***********************************************************************
1262 * SetDCHook (GDI.190)
1264 BOOL16 WINAPI SetDCHook16( HDC16 hdc, FARPROC16 hookProc, DWORD dwHookData )
1266 DC *dc = DC_GetDCPtr( hdc );
1267 if (!dc) return FALSE;
1269 dc->hookProc = hookProc;
1270 GDI_ReleaseObj( hdc );
1271 return SetDCHook( hdc, call_dc_hook16, dwHookData );
1275 /***********************************************************************
1276 * GetDCHook (GDI.191)
1278 DWORD WINAPI GetDCHook( HDC16 hdc, FARPROC16 *phookProc )
1280 DC *dc = DC_GetDCPtr( hdc );
1281 if (!dc) return 0;
1282 *phookProc = dc->hookProc;
1283 GDI_ReleaseObj( hdc );
1284 return dc->dwHookData;
1288 /***********************************************************************
1289 * SetHookFlags (GDI.192)
1291 WORD WINAPI SetHookFlags16(HDC16 hDC, WORD flags)
1293 DC *dc = DC_GetDCPtr( hDC );
1295 if( dc )
1297 WORD wRet = dc->flags & DC_DIRTY;
1299 /* "Undocumented Windows" info is slightly confusing.
1302 TRACE("hDC %04x, flags %04x\n",hDC,flags);
1304 if( flags & DCHF_INVALIDATEVISRGN )
1305 dc->flags |= DC_DIRTY;
1306 else if( flags & DCHF_VALIDATEVISRGN || !flags )
1307 dc->flags &= ~DC_DIRTY;
1308 GDI_ReleaseObj( hDC );
1309 return wRet;
1311 return 0;
1314 /***********************************************************************
1315 * SetICMMode (GDI32.@)
1317 INT WINAPI SetICMMode(HDC hdc, INT iEnableICM)
1319 /*FIXME Asuming that ICM is always off, and cannot be turned on */
1320 if (iEnableICM == ICM_OFF) return ICM_OFF;
1321 if (iEnableICM == ICM_ON) return 0;
1322 if (iEnableICM == ICM_QUERY) return ICM_OFF;
1323 return 0;
1326 /***********************************************************************
1327 * GetDeviceGammaRamp (GDI32.@)
1329 BOOL WINAPI GetDeviceGammaRamp(HDC hDC, LPVOID ptr)
1331 BOOL ret = FALSE;
1332 DC *dc = DC_GetDCPtr( hDC );
1334 if( dc )
1336 if (dc->funcs->pGetDeviceGammaRamp)
1337 ret = dc->funcs->pGetDeviceGammaRamp(dc->physDev, ptr);
1338 GDI_ReleaseObj( hDC );
1340 return ret;
1343 /***********************************************************************
1344 * SetDeviceGammaRamp (GDI32.@)
1346 BOOL WINAPI SetDeviceGammaRamp(HDC hDC, LPVOID ptr)
1348 BOOL ret = FALSE;
1349 DC *dc = DC_GetDCPtr( hDC );
1351 if( dc )
1353 if (dc->funcs->pSetDeviceGammaRamp)
1354 ret = dc->funcs->pSetDeviceGammaRamp(dc->physDev, ptr);
1355 GDI_ReleaseObj( hDC );
1357 return ret;
1360 /***********************************************************************
1361 * GetColorSpace (GDI32.@)
1363 HCOLORSPACE WINAPI GetColorSpace(HDC hdc)
1365 /*FIXME Need to to whatever GetColorSpace actually does */
1366 return 0;
1369 /***********************************************************************
1370 * CreateColorSpaceA (GDI32.@)
1372 HCOLORSPACE WINAPI CreateColorSpaceA( LPLOGCOLORSPACEA lpLogColorSpace )
1374 FIXME( "stub\n" );
1375 return 0;
1378 /***********************************************************************
1379 * CreateColorSpaceW (GDI32.@)
1381 HCOLORSPACE WINAPI CreateColorSpaceW( LPLOGCOLORSPACEW lpLogColorSpace )
1383 FIXME( "stub\n" );
1384 return 0;
1387 /***********************************************************************
1388 * DeleteColorSpace (GDI32.@)
1390 BOOL WINAPI DeleteColorSpace( HCOLORSPACE hColorSpace )
1392 FIXME( "stub\n" );
1394 return TRUE;
1397 /***********************************************************************
1398 * SetColorSpace (GDI32.@)
1400 HCOLORSPACE WINAPI SetColorSpace( HDC hDC, HCOLORSPACE hColorSpace )
1402 FIXME( "stub\n" );
1404 return hColorSpace;
1407 /***********************************************************************
1408 * GetBoundsRect (GDI.194)
1410 UINT16 WINAPI GetBoundsRect16(HDC16 hdc, LPRECT16 rect, UINT16 flags)
1412 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1415 /***********************************************************************
1416 * GetBoundsRect (GDI32.@)
1418 UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
1420 FIXME("(): stub\n");
1421 return DCB_RESET; /* bounding rectangle always empty */
1424 /***********************************************************************
1425 * SetBoundsRect (GDI.193)
1427 UINT16 WINAPI SetBoundsRect16(HDC16 hdc, const RECT16* rect, UINT16 flags)
1429 if ( (flags & DCB_ACCUMULATE) || (flags & DCB_ENABLE) )
1430 FIXME("(%04x, %p, %04x): stub\n", hdc, rect, flags );
1432 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1435 /***********************************************************************
1436 * SetBoundsRect (GDI32.@)
1438 UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
1440 FIXME("(): stub\n");
1441 return DCB_DISABLE; /* bounding rectangle always empty */
1445 /***********************************************************************
1446 * GetRelAbs (GDI32.@)
1448 INT WINAPI GetRelAbs( HDC hdc, DWORD dwIgnore )
1450 INT ret = 0;
1451 DC *dc = DC_GetDCPtr( hdc );
1452 if (dc) ret = dc->relAbsMode;
1453 GDI_ReleaseObj( hdc );
1454 return ret;
1457 /***********************************************************************
1458 * Death (GDI.121)
1460 * Disables GDI, switches back to text mode.
1461 * We don't have to do anything here,
1462 * just let console support handle everything
1464 void WINAPI Death16(HDC16 hDC)
1466 MESSAGE("Death(%04x) called. Application enters text mode...\n", hDC);
1469 /***********************************************************************
1470 * Resurrection (GDI.122)
1472 * Restores GDI functionality
1474 void WINAPI Resurrection16(HDC16 hDC,
1475 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1477 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n", hDC, w1, w2, w3, w4, w5, w6);
1480 /***********************************************************************
1481 * GetLayout (GDI32.@)
1483 * Gets left->right or right->left text layout flags of a dc.
1484 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1487 DWORD WINAPI GetLayout(HDC hdc)
1489 FIXME("(%08x): stub\n", hdc);
1490 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1491 return 0;
1494 /***********************************************************************
1495 * SetLayout (GDI32.@)
1497 * Sets left->right or right->left text layout flags of a dc.
1498 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1501 DWORD WINAPI SetLayout(HDC hdc, DWORD layout)
1503 FIXME("(%08x,%08lx): stub\n", hdc, layout);
1504 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1505 return 0;