source: trunk/src/gdi32/gdi32.cpp@ 7721

Last change on this file since 7721 was 7721, checked in by sandervl, 24 years ago

better logging for some functions

File size: 62.0 KB
Line 
1/* $Id: gdi32.cpp,v 1.80 2002-01-02 18:36:00 sandervl Exp $ */
2
3/*
4 * GDI32 apis
5 *
6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
7 * Copyright 1998 Patrick Haller
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12#include <os2win.h>
13#include <stdlib.h>
14#include <stdarg.h>
15#include <string.h>
16#include <odinwrap.h>
17#include <misc.h>
18#include "callback.h"
19#include "unicode.h"
20#include "dibsect.h"
21#include <codepage.h>
22#include "oslibgpi.h"
23#include "oslibgdi.h"
24#include <dcdata.h>
25#include <winuser32.h>
26#include "font.h"
27#include <stats.h>
28
29#define DBG_LOCALLOG DBG_gdi32
30#include "dbglocal.h"
31
32ODINDEBUGCHANNEL(GDI32-GDI32)
33
34//******************************************************************************
35//******************************************************************************
36//******************************************************************************
37//******************************************************************************
38COLORREF WIN32API SetBkColor(HDC hdc, COLORREF crColor)
39{
40 dprintf(("GDI32: SetBkColor %x to %x", hdc, crColor));
41 return(O32_SetBkColor(hdc, crColor));
42}
43//******************************************************************************
44//******************************************************************************
45COLORREF WIN32API SetTextColor(HDC hdc, COLORREF crColor)
46{
47 COLORREF clr;
48
49 dprintf(("GDI32: SetTextColor %x to %x", hdc, crColor));
50 clr = O32_SetTextColor(hdc, crColor);
51 return(clr);
52}
53//******************************************************************************
54//******************************************************************************
55HGDIOBJ WIN32API GetStockObject(int arg1)
56{
57 HGDIOBJ obj;
58
59 switch(arg1)
60 {
61 case DEFAULT_GUI_FONT:
62 if(NULL==hFntDefaultGui)
63 hFntDefaultGui = CreateFontA( -9, 0, 0, 0, FW_MEDIUM, FALSE,
64 FALSE, FALSE, ANSI_CHARSET,
65 OUT_DEFAULT_PRECIS,
66 CLIP_DEFAULT_PRECIS,
67 DEFAULT_QUALITY,
68 FIXED_PITCH|FF_MODERN, "WarpSans");
69 obj = hFntDefaultGui;
70 break;
71 default:
72 obj = O32_GetStockObject(arg1);
73 break;
74 }
75 dprintf(("GDI32: GetStockObject %d returned %X\n", arg1, obj));
76 return(obj);
77}
78//******************************************************************************
79//******************************************************************************
80ODINFUNCTION3(HPEN, CreatePen, int, fnPenStyle, int, nWidth, COLORREF, crColor)
81{
82 HPEN hPen;
83
84 //CB: todo: PS_DOT is different in Win32 (. . . . and not - - - -)
85 // Open32 looks like LINETYPE_SHORTDASH instead of LINETYPE_DOT!!!
86 // -> difficult to fix without performance decrease!
87
88 hPen = O32_CreatePen(fnPenStyle,nWidth,crColor);
89 if(hPen) STATS_CreatePen(hPen, fnPenStyle,nWidth,crColor);
90 return hPen;
91}
92//******************************************************************************
93//******************************************************************************
94HPEN WIN32API CreatePenIndirect(const LOGPEN * lplgpn)
95{
96 HPEN hPen;
97
98 dprintf(("GDI32: CreatePenIndirect %x", lplgpn));
99 hPen = O32_CreatePenIndirect(lplgpn);
100 if(hPen) STATS_CreatePenIndirect(hPen, lplgpn);
101 return hPen;
102}
103//******************************************************************************
104//******************************************************************************
105HPEN WIN32API ExtCreatePen(DWORD dwPenStyle, DWORD dwWidth, const LOGBRUSH *lplb,
106 DWORD dwStyleCount, const DWORD *lpStyle)
107{
108 HPEN hPen;
109
110 hPen = O32_ExtCreatePen(dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle);
111 dprintf(("GDI32: ExtCreatePen %x %x %x %x %x returned %x", dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle, hPen));
112 if(hPen) STATS_ExtCreatePen(hPen, dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle);
113 return hPen;
114}
115//******************************************************************************
116//******************************************************************************
117HBRUSH WIN32API CreatePatternBrush(HBITMAP hBitmap)
118{
119 HBRUSH hBrush;
120
121 hBrush = O32_CreatePatternBrush(hBitmap);
122 if(hBrush) STATS_CreatePatternBrush(hBrush, hBitmap);
123
124 dprintf(("GDI32: CreatePatternBrush from bitmap %X returned %X\n", hBitmap, hBrush));
125 return(hBrush);
126}
127//******************************************************************************
128//******************************************************************************
129ODINFUNCTION1(HBRUSH, CreateSolidBrush, COLORREF, color)
130{
131 HBRUSH hBrush;
132
133 hBrush = O32_CreateSolidBrush(color);
134 if(hBrush) STATS_CreateSolidBrush(hBrush, color);
135 return(hBrush);
136}
137//******************************************************************************
138//******************************************************************************
139HBRUSH WIN32API CreateBrushIndirect( const LOGBRUSH *pLogBrush)
140{
141 HBRUSH hBrush;
142
143 hBrush = O32_CreateBrushIndirect((LPLOGBRUSH)pLogBrush);
144 dprintf(("GDI32: CreateBrushIndirect %x %x %x returned %x", pLogBrush->lbStyle, pLogBrush->lbColor, pLogBrush->lbHatch, hBrush));
145 if(hBrush) STATS_CreateBrushIndirect(hBrush, (LPLOGBRUSH)pLogBrush);
146 return hBrush;
147}
148//******************************************************************************
149//******************************************************************************
150HBRUSH WIN32API CreateHatchBrush(int fnStyle, COLORREF clrref)
151{
152 HBRUSH hBrush;
153
154 dprintf(("GDI32: CreateHatchBrush %x %x", fnStyle, clrref));
155 hBrush = O32_CreateHatchBrush(fnStyle, clrref);
156 if(hBrush) STATS_CreateHatchBrush(hBrush, fnStyle, clrref);
157 return hBrush;
158}
159//******************************************************************************
160//******************************************************************************
161HBRUSH WIN32API CreateDIBPatternBrushPt( const VOID * buffer, UINT usage)
162{
163 HBRUSH hBrush;
164
165 dprintf(("GDI32: CreateDIBPatternBrushPt %x %x", buffer, usage));
166 hBrush = O32_CreateDIBPatternBrushPt(buffer, usage);
167 if(hBrush) STATS_CreateDIBPatternBrushPt(hBrush, buffer, usage);
168 return hBrush;
169}
170/*****************************************************************************
171 * Name : HBRUSH CreateDIBPatternBrush
172 * Purpose : The CreateDIBPatternBrush function creates a logical brush that
173 * has the pattern specified by the specified device-independent
174 * bitmap (DIB). The brush can subsequently be selected into any
175 * device context that is associated with a device that supports
176 * raster operations.
177 *
178 * This function is provided only for compatibility with applications
179 * written for versions of Windows earlier than 3.0. For Win32-based
180 * applications, use the CreateDIBPatternBrushPt function.
181 * Parameters: HGLOBAL hglbDIBPacked Identifies a global memory object containing
182 * a packed DIB, which consists of a BITMAPINFO structure immediately
183 * followed by an array of bytes defining the pixels of the bitmap.
184 * UINT fuColorSpec color table data
185 * Variables :
186 * Result : TRUE / FALSE
187 * Remark :
188 * Status : ODIN32 COMPLETELY UNTESTED
189 *
190 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
191 * Markus Montkowski [Wen, 1999/01/12 20:00]
192 *****************************************************************************/
193
194HBRUSH WIN32API CreateDIBPatternBrush( HGLOBAL hglbDIBPacked,
195 UINT fuColorSpec)
196{
197 BITMAPINFO *lpMem;
198 HBRUSH ret = 0;
199
200 lpMem = (BITMAPINFO *)GlobalLock(hglbDIBPacked);
201 if(NULL!=lpMem)
202 {
203 dprintf(("GDI32: CreateDIBPatternBrush (%08xh, %08xh) %x (%d,%d) bpp %d",
204 hglbDIBPacked, fuColorSpec, lpMem, lpMem->bmiHeader.biWidth,
205 lpMem->bmiHeader.biHeight, lpMem->bmiHeader.biBitCount));
206
207 ret = CreateDIBPatternBrushPt( lpMem,
208 fuColorSpec);
209 GlobalUnlock(hglbDIBPacked);
210 }
211 else {
212 dprintf(("!ERROR!: CreateDIBPatternBrush (%08xh, %08xh) -> INVALID memory handle!!",
213 hglbDIBPacked, fuColorSpec));
214 }
215 return (ret);
216}
217//******************************************************************************
218//******************************************************************************
219HDC WIN32API CreateCompatibleDC( HDC hdc)
220{
221 HDC newHdc;
222
223 newHdc = O32_CreateCompatibleDC(hdc);
224 ULONG oldcp = OSLibGpiQueryCp(hdc);
225 if (!oldcp) /* If new DC is to be created */
226 oldcp = GetDisplayCodepage();
227
228 if(newHdc) STATS_CreateCompatibleDC(hdc, newHdc);
229 OSLibGpiSetCp(newHdc, oldcp);
230 dprintf(("CreateCompatibleDC %X returned %x", hdc, newHdc));
231 return newHdc;
232}
233//******************************************************************************
234//******************************************************************************
235ODINFUNCTION1(BOOL, DeleteDC, HDC, hdc)
236{
237 pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
238 if(!pHps)
239 {
240 dprintf(("WARNING: DeleteDC %x; invalid hdc!", hdc));
241 SetLastError(ERROR_INVALID_HANDLE);
242 return 0;
243 }
244 SetLastError(ERROR_SUCCESS);
245
246 DIBSection *dsect = DIBSection::findHDC(hdc);
247 if(dsect)
248 {
249 //remove previously selected dibsection
250 dprintf(("DeleteDC %x, unselect DIB section %x", hdc, dsect->GetBitmapHandle()));
251 dsect->UnSelectDIBObject();
252 }
253
254 //Must call ReleaseDC for window dcs
255 if(pHps->hdcType == TYPE_1) {
256 return ReleaseDC(OS2ToWin32Handle(pHps->hwnd), hdc);
257 }
258
259 STATS_DeleteDC(hdc);
260 return O32_DeleteDC(hdc);
261}
262//******************************************************************************
263//******************************************************************************
264BOOL WIN32API StrokeAndFillPath(HDC hdc)
265{
266 dprintf(("GDI32: StrokeAndFillPath %x", hdc));
267 return O32_StrokeAndFillPath(hdc);
268}
269//******************************************************************************
270//******************************************************************************
271BOOL WIN32API StrokePath(HDC hdc)
272{
273 dprintf(("GDI32: StrokePath %x", hdc));
274 return O32_StrokePath(hdc);
275}
276//******************************************************************************
277//******************************************************************************
278int WIN32API SetBkMode( HDC hdc, int mode)
279{
280 dprintf(("GDI32: SetBkMode %x %d (old %d)", hdc, mode, O32_GetBkMode(hdc)));
281 return O32_SetBkMode(hdc, mode);
282}
283//******************************************************************************
284//******************************************************************************
285COLORREF WIN32API GetPixel( HDC hdc, int x, int y)
286{
287 COLORREF color;
288
289 color = O32_GetPixel(hdc, x, y);
290 dprintf2(("GDI32: GetPixel %x (%d,%d) -> %x", hdc, x, y, color));
291 return color;
292}
293//******************************************************************************
294//******************************************************************************
295COLORREF WIN32API SetPixel( HDC hdc, int x, int y, COLORREF color)
296{
297 dprintf2(("GDI32: SetPixel %x (%d,%d) %x", hdc, x, y, color));
298 return O32_SetPixel(hdc, x, y, color);
299}
300//******************************************************************************
301//Faster version of SetPixel (since it doesn't need to return the original color)
302//Just use SetPixel for now
303//******************************************************************************
304BOOL WIN32API SetPixelV(HDC arg1, int arg2, int arg3, COLORREF arg4)
305{
306 COLORREF rc;
307
308//// dprintf(("GDI32: SetPixelV\n"));
309 rc = O32_SetPixel(arg1, arg2, arg3, arg4);
310 if(rc == GDI_ERROR) // || rc == COLOR_INVALID)
311 return(FALSE);
312 return(TRUE);
313}
314//******************************************************************************
315//******************************************************************************
316BOOL WIN32API GetDCOrgEx(HDC hdc, PPOINT lpPoint)
317{
318 if(lpPoint == NULL) {
319 dprintf(("WARNING: GDI32: GetDCOrgEx %x NULL", hdc));
320 return FALSE;
321 }
322 dprintf(("GDI32: GetDCOrgEx %x (%d,%d)", hdc, lpPoint));
323 return O32_GetDCOrgEx(hdc, lpPoint);
324}
325//******************************************************************************
326//******************************************************************************
327BOOL WIN32API AbortPath(HDC hdc)
328{
329 dprintf(("GDI32: AbortPath %x", hdc));
330 return O32_AbortPath(hdc);
331}
332//******************************************************************************
333//******************************************************************************
334BOOL WIN32API AngleArc( HDC arg1, int arg2, int arg3, DWORD arg4, float arg5, float arg6)
335{
336 dprintf(("GDI32: AngleArc"));
337 return O32_AngleArc(arg1, arg2, arg3, arg4, arg5, arg6);
338}
339//******************************************************************************
340//******************************************************************************
341BOOL WIN32API Arc( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
342{
343 dprintf(("GDI32: Arc"));
344 return O32_Arc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
345}
346//******************************************************************************
347//******************************************************************************
348BOOL WIN32API ArcTo( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
349{
350 dprintf(("GDI32: ArcTo"));
351 return O32_ArcTo(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
352}
353//******************************************************************************
354//******************************************************************************
355BOOL WIN32API BeginPath(HDC hdc)
356{
357 dprintf(("GDI32: BeginPath $x", hdc));
358 return O32_BeginPath(hdc);
359}
360//******************************************************************************
361//******************************************************************************
362BOOL WIN32API Chord( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
363{
364 dprintf(("GDI32: Chord"));
365 return O32_Chord(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
366}
367//******************************************************************************
368//******************************************************************************
369BOOL WIN32API CloseFigure(HDC hdc)
370{
371 dprintf(("GDI32: CloseFigure %x", hdc));
372 return O32_CloseFigure(hdc);
373}
374//******************************************************************************
375//******************************************************************************
376HDC WIN32API CreateDCA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, const DEVMODEA *lpInitData)
377{
378 HDC hdc;
379
380 // 2001-05-28 PH
381 // Ziff Davis Benchmarks come in here with "display".
382 // Obviously, Windows does accept case-insensitive driver names,
383 // whereas Open32 doesn't.
384 if (*lpszDriver == 'd') // quick check
385 {
386 // then do a double-check and use the uppercase constant
387 // instead
388 if (stricmp(lpszDriver, "DISPLAY") == 0)
389 lpszDriver = "DISPLAY";
390 }
391
392 hdc = O32_CreateDC(lpszDriver, lpszDevice, lpszOutput, lpInitData);
393 if(hdc) {
394 OSLibGpiSetCp(hdc, GetDisplayCodepage());
395 STATS_CreateDCA(hdc, lpszDriver, lpszDevice, lpszOutput, lpInitData);
396 }
397
398 dprintf(("GDI32: CreateDCA %s %s %s %x returned %x", lpszDriver, lpszDevice, lpszOutput, lpInitData, hdc));
399 return hdc;
400}
401//******************************************************************************
402//******************************************************************************
403HDC WIN32API CreateDCW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
404{
405 char *astring4, *astring5;
406
407 char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
408 char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
409 char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
410
411 if(arg4)
412 {
413 astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
414 astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
415 }
416
417 HDC rc;
418 DEVMODEA devmode;
419
420 dprintf(("GDI32: CreateDCW"));
421
422 if(arg4)
423 {
424 strcpy((char*)devmode.dmDeviceName, astring4);
425 strcpy((char*)devmode.dmFormName, astring5);
426
427 devmode.dmSpecVersion = arg4->dmSpecVersion;
428 devmode.dmDriverVersion = arg4->dmDriverVersion;
429 devmode.dmSize = arg4->dmSize;
430 devmode.dmDriverExtra = arg4->dmDriverExtra;
431 devmode.dmFields = arg4->dmFields;
432 devmode.dmOrientation = arg4->dmOrientation;
433 devmode.dmPaperSize = arg4->dmPaperSize;
434 devmode.dmPaperLength = arg4->dmPaperLength;
435 devmode.dmPaperWidth = arg4->dmPaperWidth;
436 devmode.dmScale = arg4->dmScale;
437 devmode.dmCopies = arg4->dmCopies;
438 devmode.dmDefaultSource = arg4->dmDefaultSource;
439 devmode.dmPrintQuality = arg4->dmPrintQuality;
440 devmode.dmColor = arg4->dmColor;
441 devmode.dmDuplex = arg4->dmDuplex;
442 devmode.dmYResolution = arg4->dmYResolution;
443 devmode.dmTTOption = arg4->dmTTOption;
444 devmode.dmCollate = arg4->dmCollate;
445 devmode.dmLogPixels = arg4->dmLogPixels;
446 devmode.dmBitsPerPel = arg4->dmBitsPerPel;
447 devmode.dmPelsWidth = arg4->dmPelsWidth;
448 devmode.dmPelsHeight = arg4->dmPelsHeight;
449 devmode.dmDisplayFlags = arg4->dmDisplayFlags;
450 devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
451 devmode.dmICMMethod = arg4->dmICMMethod;
452 devmode.dmICMIntent = arg4->dmICMIntent;
453 devmode.dmMediaType = arg4->dmMediaType;
454 devmode.dmDitherType = arg4->dmDitherType;
455 devmode.dmReserved1 = arg4->dmReserved1;
456 devmode.dmReserved2 = arg4->dmReserved2;
457 rc = CreateDCA(astring1,astring2,astring3,&devmode);
458 }
459 else
460 rc = CreateDCA(astring1,astring2,astring3, NULL);
461
462 FreeAsciiString(astring1);
463 FreeAsciiString(astring2);
464 FreeAsciiString(astring3);
465
466 if(arg4)
467 {
468 FreeAsciiString(astring4);
469 FreeAsciiString(astring5);
470 }
471
472 return rc;
473}
474//******************************************************************************
475//******************************************************************************
476HDC WIN32API CreateICA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
477 const DEVMODEA *lpdvmInit)
478{
479 static char *szDisplay = "DISPLAY";
480 HDC hdc;
481
482 dprintf(("GDI32: CreateICA"));
483 //SvL: Open32 tests for "DISPLAY"
484 if(lpszDriver && !strcmp(lpszDriver, "display")) {
485 lpszDriver = szDisplay;
486 }
487 //SvL: Open32 tests lpszDriver for NULL even though it's ignored
488 if(lpszDriver == NULL) {
489 lpszDriver = lpszDevice;
490 }
491 hdc = O32_CreateIC(lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
492 if(hdc) STATS_CreateICA(hdc, lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
493 return hdc;
494}
495//******************************************************************************
496//******************************************************************************
497HDC WIN32API CreateICW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
498{
499 char *astring4, *astring5;
500
501 char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
502 char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
503 char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
504 if(arg4)
505 {
506 astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
507 astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
508 }
509
510 HDC rc;
511 DEVMODEA devmode;
512
513 dprintf(("GDI32: CreateICW"));
514
515 if(arg4)
516 {
517 strcpy((char*)devmode.dmDeviceName, astring4);
518 strcpy((char*)devmode.dmFormName, astring5);
519
520 devmode.dmSpecVersion = arg4->dmSpecVersion;
521 devmode.dmDriverVersion = arg4->dmDriverVersion;
522 devmode.dmSize = arg4->dmSize;
523 devmode.dmDriverExtra = arg4->dmDriverExtra;
524 devmode.dmFields = arg4->dmFields;
525 devmode.dmOrientation = arg4->dmOrientation;
526 devmode.dmPaperSize = arg4->dmPaperSize;
527 devmode.dmPaperLength = arg4->dmPaperLength;
528 devmode.dmPaperWidth = arg4->dmPaperWidth;
529 devmode.dmScale = arg4->dmScale;
530 devmode.dmCopies = arg4->dmCopies;
531 devmode.dmDefaultSource = arg4->dmDefaultSource;
532 devmode.dmPrintQuality = arg4->dmPrintQuality;
533 devmode.dmColor = arg4->dmColor;
534 devmode.dmDuplex = arg4->dmDuplex;
535 devmode.dmYResolution = arg4->dmYResolution;
536 devmode.dmTTOption = arg4->dmTTOption;
537 devmode.dmCollate = arg4->dmCollate;
538 devmode.dmLogPixels = arg4->dmLogPixels;
539 devmode.dmBitsPerPel = arg4->dmBitsPerPel;
540 devmode.dmPelsWidth = arg4->dmPelsWidth;
541 devmode.dmPelsHeight = arg4->dmPelsHeight;
542 devmode.dmDisplayFlags = arg4->dmDisplayFlags;
543 devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
544 devmode.dmICMMethod = arg4->dmICMMethod;
545 devmode.dmICMIntent = arg4->dmICMIntent;
546 devmode.dmMediaType = arg4->dmMediaType;
547 devmode.dmDitherType = arg4->dmDitherType;
548 devmode.dmReserved1 = arg4->dmReserved1;
549 devmode.dmReserved2 = arg4->dmReserved2;
550
551 rc = CreateICA(astring1,astring2,astring3,&devmode);
552 }
553 else
554 rc = CreateICA(astring1,astring2,astring3, NULL);
555
556 FreeAsciiString(astring1);
557 FreeAsciiString(astring2);
558 FreeAsciiString(astring3);
559 if(arg4)
560 {
561 FreeAsciiString(astring4);
562 FreeAsciiString(astring5);
563 }
564
565 return rc;
566}
567//******************************************************************************
568//******************************************************************************
569BOOL WIN32API Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
570 int nBottomRect)
571{
572 dprintf(("GDI32: Ellipse %x (%d,%d)(%d,%d)", nLeftRect, nTopRect, nRightRect, nBottomRect));
573 return O32_Ellipse(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
574}
575//******************************************************************************
576//******************************************************************************
577BOOL WIN32API EndPath( HDC hdc)
578{
579 dprintf(("GDI32: EndPath %x", hdc));
580 return O32_EndPath(hdc);
581}
582//******************************************************************************
583//******************************************************************************
584ODINFUNCTION5(BOOL, Rectangle, HDC, hdc, int, left, int, top, int, right, int, bottom)
585{
586 return O32_Rectangle(hdc, left, top, right, bottom);
587}
588//******************************************************************************
589//******************************************************************************
590VOID dumpROP2(INT rop2)
591{
592 CHAR *name;
593
594 switch (rop2)
595 {
596 case R2_BLACK:
597 name = "R2_BLACK";
598 break;
599
600 case R2_COPYPEN:
601 name = "R2_COPYPEN";
602 break;
603
604 case R2_MASKNOTPEN:
605 name = "R2_MASKNOTPEN";
606 break;
607
608 case R2_MASKPEN:
609 name = "R2_MASKPEN";
610 break;
611
612 case R2_MASKPENNOT:
613 name = "R2_MASKPENNOT";
614 break;
615
616 case R2_MERGENOTPEN:
617 name = "R2_MERGENOTPEN";
618 break;
619
620 case R2_MERGEPEN:
621 name = "R2_MERGEPEN";
622 break;
623
624 case R2_MERGEPENNOT:
625 name = "R2_MERGEPENNOT";
626 break;
627
628 case R2_NOP:
629 name = "R2_NOP";
630 break;
631
632 case R2_NOT:
633 name = "R2_NOT";
634 break;
635
636 case R2_NOTCOPYPEN:
637 name = "R2_NOTCOPYPEN";
638 break;
639
640 case R2_NOTMASKPEN:
641 name = "R2_NOTMASKPEN";
642 break;
643
644 case R2_NOTMERGEPEN:
645 name = "R2_NOTMERGEPEN";
646 break;
647
648 case R2_WHITE:
649 name = "R2_WHITE";
650 break;
651
652 case R2_XORPEN:
653 name = "R2_XORPEN";
654 break;
655
656 default:
657 name = "unknown mode!!!";
658 break;
659 }
660
661 dprintf((" ROP2 mode = %s",name));
662}
663//******************************************************************************
664//******************************************************************************
665int WIN32API SetROP2( HDC hdc, int rop2)
666{
667 dprintf(("GDI32: SetROP2 %x %x", hdc, rop2));
668 #ifdef DEBUG
669 dumpROP2(rop2);
670 #endif
671 return O32_SetROP2(hdc, rop2);
672}
673//******************************************************************************
674//******************************************************************************
675int WIN32API Escape( HDC hdc, int nEscape, int cbInput, LPCSTR lpvInData, PVOID lpvOutData)
676{
677 int rc;
678
679 rc = O32_Escape(hdc, nEscape, cbInput, lpvInData, lpvOutData);
680 if(rc == 0) {
681 dprintf(("GDI32: Escape %x %d %d %x %x returned %d (WARNING: might not be implemented!!) ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
682 }
683 else dprintf(("GDI32: Escape %x %d %d %x %x returned %d ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
684
685 return rc;
686}
687//******************************************************************************
688//******************************************************************************
689BOOL WIN32API ExtFloodFill( HDC arg1, int arg2, int arg3, COLORREF arg4, UINT arg5)
690{
691 dprintf(("GDI32: ExtFloodFill"));
692 return O32_ExtFloodFill(arg1, arg2, arg3, arg4, arg5);
693}
694//******************************************************************************
695//******************************************************************************
696BOOL WIN32API FillPath( HDC arg1)
697{
698 dprintf(("GDI32: FillPath"));
699 return O32_FillPath(arg1);
700}
701//******************************************************************************
702//******************************************************************************
703BOOL WIN32API FlattenPath( HDC arg1)
704{
705 dprintf(("GDI32: FlattenPath"));
706 return O32_FlattenPath(arg1);
707}
708//******************************************************************************
709//******************************************************************************
710BOOL WIN32API FloodFill(HDC arg1, int arg2, int arg3, COLORREF arg4)
711{
712 dprintf(("GDI32: FloodFill"));
713 return O32_FloodFill(arg1, arg2, arg3, arg4);
714}
715//******************************************************************************
716//******************************************************************************
717int WIN32API GetArcDirection( HDC arg1)
718{
719 dprintf(("GDI32: GetArcDirection"));
720 return O32_GetArcDirection(arg1);
721}
722//******************************************************************************
723//******************************************************************************
724BOOL WIN32API GetAspectRatioFilterEx( HDC arg1, PSIZE arg2)
725{
726 dprintf(("GDI32: GetAspectRatioFilterEx"));
727 return O32_GetAspectRatioFilterEx(arg1, arg2);
728}
729//******************************************************************************
730//******************************************************************************
731COLORREF WIN32API GetBkColor(HDC hdc)
732{
733 COLORREF color;
734
735 color = O32_GetBkColor(hdc);
736 dprintf(("GDI32: GetBkColor %x returned %x", hdc, color));
737 return color;
738}
739//******************************************************************************
740//******************************************************************************
741int WIN32API GetBkMode(HDC hdc)
742{
743 int bkmode;
744
745 bkmode = O32_GetBkMode(hdc);
746 dprintf(("GDI32: GetBkMode %x returned %d", hdc, bkmode));
747 return bkmode;
748}
749//******************************************************************************
750//******************************************************************************
751UINT WIN32API GetBoundsRect( HDC arg1, PRECT arg2, UINT arg3)
752{
753 dprintf(("GDI32: GetBoundsRect"));
754 return O32_GetBoundsRect(arg1, arg2, arg3);
755}
756//******************************************************************************
757//******************************************************************************
758BOOL WIN32API GetBrushOrgEx( HDC arg1, PPOINT arg2)
759{
760 dprintf(("GDI32: GetBrushOrgEx"));
761 return O32_GetBrushOrgEx(arg1, arg2);
762}
763//******************************************************************************
764//******************************************************************************
765BOOL WIN32API GetCharABCWidthsA( HDC arg1, UINT arg2, UINT arg3, LPABC arg4)
766{
767 dprintf(("GDI32: GetCharABCWidthsA"));
768 return O32_GetCharABCWidths(arg1, arg2, arg3, arg4);
769}
770//******************************************************************************
771//******************************************************************************
772BOOL WIN32API GetCharABCWidthsW( HDC arg1, UINT arg2, UINT arg3, LPABC arg4)
773{
774 dprintf(("GDI32: GetCharABCWidthsW not properly implemented."));
775 // NOTE: This will not work as is (needs UNICODE support)
776 return O32_GetCharABCWidths(arg1, arg2, arg3, arg4);
777}
778//******************************************************************************
779//******************************************************************************
780BOOL WIN32API GetCharWidth32A( HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray)
781{
782 BOOL ret;
783
784 dprintf(("GDI32: GetCharWidth32A %x %x %x %x", hdc, iFirstChar, iLastChar, pWidthArray));
785 ret = O32_GetCharWidth(hdc, iFirstChar, iLastChar, pWidthArray);
786 dprintf(("GDI32: GetCharWidth32A returned %d", ret));
787#ifdef DEBUG
788 if(ret) {
789 for(int i=iFirstChar;i<iLastChar;i++) {
790 if((i >= 'a' && i <= 'z') || (i >= 'A' && i <= 'Z')) {
791 dprintf2(("Char %c -> width %d", i, pWidthArray[i]));
792 }
793 else dprintf2(("Char %x -> width %d", i, pWidthArray[i]));
794 }
795 }
796#endif
797 return ret;
798}
799//******************************************************************************
800//TODO: Cut off Unicode chars?
801//******************************************************************************
802BOOL WIN32API GetCharWidth32W(HDC hdc, UINT iFirstChar, UINT iLastChar, PINT pWidthArray)
803{
804 dprintf(("GDI32: GetCharWidth32W might not work properly %x %x %x %x", hdc, iFirstChar, iLastChar, pWidthArray));
805 return O32_GetCharWidth(hdc, iFirstChar, iLastChar, pWidthArray);
806}
807//******************************************************************************
808//******************************************************************************
809BOOL WIN32API GetCurrentPositionEx( HDC hdc, PPOINT lpPoint)
810{
811 BOOL rc;
812
813 dprintf(("GDI32: GetCurrentPositionEx %x", hdc));
814 rc = O32_GetCurrentPositionEx(hdc, lpPoint);
815 dprintf(("GDI32: GetCurrentPositionEx returned %d (%d,%d)", rc, lpPoint->x, lpPoint->y));
816 return rc;
817}
818//******************************************************************************
819//******************************************************************************
820int WIN32API GetDeviceCaps(HDC hdc, int nIndex)
821{
822 int rc;
823
824 rc = O32_GetDeviceCaps(hdc, nIndex);
825 dprintf(("GDI32: GetDeviceCaps %X, %d returned %d\n", hdc, nIndex, rc));
826 //SvL: 13-9-'98: NT returns -1 when using 16 bits colors, NOT 65536!
827 if(nIndex == NUMCOLORS && rc > 256)
828 return -1;
829
830 return(rc);
831}
832//******************************************************************************
833//******************************************************************************
834DWORD WIN32API GetKerningPairsA( HDC arg1, DWORD arg2, LPKERNINGPAIR arg3)
835{
836 dprintf(("GDI32: GetKerningPairsA"));
837 return O32_GetKerningPairs(arg1, arg2, arg3);
838}
839//******************************************************************************
840//******************************************************************************
841DWORD WIN32API GetKerningPairsW( HDC arg1, DWORD arg2, LPKERNINGPAIR arg3)
842{
843 dprintf(("GDI32: GetKerningPairsW"));
844 // NOTE: This will not work as is (needs UNICODE support)
845 return O32_GetKerningPairs(arg1, arg2, arg3);
846}
847//******************************************************************************
848//******************************************************************************
849BOOL WIN32API GetMiterLimit( HDC arg1, float * arg2)
850{
851 dprintf(("GDI32: GetMiterLimit"));
852 return O32_GetMiterLimit(arg1, arg2);
853}
854//******************************************************************************
855//******************************************************************************
856COLORREF WIN32API GetNearestColor( HDC arg1, COLORREF arg2)
857{
858 dprintf(("GDI32: GetNearestColor\n"));
859 return O32_GetNearestColor(arg1, arg2);
860}
861//******************************************************************************
862//******************************************************************************
863UINT WIN32API GetOutlineTextMetricsA( HDC arg1, UINT arg2, LPOUTLINETEXTMETRICA arg3)
864{
865 dprintf(("GDI32: GetOutlineTextMetricsA"));
866 return O32_GetOutlineTextMetrics(arg1, arg2, arg3);
867}
868//******************************************************************************
869//******************************************************************************
870UINT WIN32API GetOutlineTextMetricsW( HDC arg1, UINT arg2, LPOUTLINETEXTMETRICW arg3)
871{
872 dprintf(("GDI32: GetOutlineTextMetricsW STUB"));
873 // NOTE: This will not work as is (needs UNICODE support)
874// return O32_GetOutlineTextMetrics(arg1, arg2, arg3);
875 return 0;
876}
877//******************************************************************************
878//******************************************************************************
879INT WIN32API GetPath( HDC hdc, PPOINT arg2, PBYTE arg3, int arg4)
880{
881 dprintf(("GDI32: GetPath %x", hdc));
882 return O32_GetPath(hdc, arg2, arg3, arg4);
883}
884//******************************************************************************
885//******************************************************************************
886int WIN32API GetPolyFillMode( HDC hdc)
887{
888 dprintf(("GDI32: GetPolyFillMode", hdc));
889 return O32_GetPolyFillMode(hdc);
890}
891//******************************************************************************
892//******************************************************************************
893int WIN32API GetROP2( HDC hdc)
894{
895 dprintf(("GDI32: GetROP2 %x", hdc));
896 return O32_GetROP2(hdc);
897}
898//******************************************************************************
899//******************************************************************************
900BOOL WIN32API GetRasterizerCaps(LPRASTERIZER_STATUS arg1, UINT arg2)
901{
902 dprintf(("GDI32: GetRasterizerCaps"));
903 return O32_GetRasterizerCaps(arg1, arg2);
904}
905//******************************************************************************
906//******************************************************************************
907UINT WIN32API GetTextAlign( HDC hdc)
908{
909 dprintf(("GDI32: GetTextAlign %x", hdc));
910 return O32_GetTextAlign(hdc);
911}
912//******************************************************************************
913//******************************************************************************
914int WIN32API GetTextCharacterExtra( HDC hdc)
915{
916 dprintf(("GDI32: GetTextCharacterExtra", hdc));
917 return O32_GetTextCharacterExtra(hdc);
918}
919//******************************************************************************
920//******************************************************************************
921COLORREF WIN32API GetTextColor( HDC hdc)
922{
923 COLORREF color;
924
925 color = O32_GetTextColor(hdc);
926 dprintf(("GDI32: GetTextColor %x -> %x", hdc, color));
927 return color;
928}
929//******************************************************************************
930//******************************************************************************
931int WIN32API GetTextFaceA( HDC hdc, int arg2, LPSTR arg3)
932{
933 dprintf(("GDI32: GetTextFaceA %x %d %x", hdc, arg2, arg3));
934 return O32_GetTextFace(hdc, arg2, arg3);
935}
936//******************************************************************************
937//******************************************************************************
938int WIN32API GetTextFaceW( HDC arg1, int arg2, LPWSTR arg3)
939{
940 char *astring = (char *)malloc(arg2+1);
941 int rc;
942
943 dprintf(("GDI32: GetTextFaceW"));
944 rc = GetTextFaceA(arg1, arg2, astring);
945 AsciiToUnicode(astring, arg3);
946 free(astring);
947 return rc;
948}
949//******************************************************************************
950//******************************************************************************
951BOOL WIN32API GetTextMetricsA( HDC hdc, LPTEXTMETRICA pwtm)
952{
953 BOOL rc;
954
955 rc = O32_GetTextMetrics(hdc, pwtm);
956 dprintf(("GDI32: GetTextMetricsA %x %x returned %d", hdc, pwtm, rc));
957 return(rc);
958}
959//******************************************************************************
960//******************************************************************************
961BOOL WIN32API GetTextMetricsW( HDC hdc, LPTEXTMETRICW pwtm)
962{
963 BOOL rc;
964 TEXTMETRICA atm;
965
966 dprintf(("GDI32: GetTextMetricsW"));
967
968 rc = O32_GetTextMetrics(hdc, &atm);
969 pwtm->tmHeight = atm.tmHeight;
970 pwtm->tmAscent = atm.tmAscent;
971 pwtm->tmDescent = atm.tmDescent;
972 pwtm->tmInternalLeading = atm.tmInternalLeading;
973 pwtm->tmExternalLeading = atm.tmExternalLeading;
974 pwtm->tmAveCharWidth = atm.tmAveCharWidth;
975 pwtm->tmMaxCharWidth = atm.tmMaxCharWidth;
976 pwtm->tmWeight = atm.tmWeight;
977 pwtm->tmOverhang = atm.tmOverhang;
978 pwtm->tmDigitizedAspectX = atm.tmDigitizedAspectX;
979 pwtm->tmDigitizedAspectY = atm.tmDigitizedAspectY;
980 pwtm->tmFirstChar = atm.tmFirstChar;
981 pwtm->tmLastChar = atm.tmLastChar;
982 pwtm->tmDefaultChar = atm.tmDefaultChar;
983 pwtm->tmBreakChar = atm.tmBreakChar;
984 pwtm->tmItalic = atm.tmItalic;
985 pwtm->tmUnderlined = atm.tmUnderlined;
986 pwtm->tmStruckOut = atm.tmStruckOut;
987 pwtm->tmPitchAndFamily = atm.tmPitchAndFamily;
988 pwtm->tmCharSet = atm.tmCharSet;
989
990 dprintf(("GDI32: GetTextMetricsW %x %x returned %d", hdc, pwtm, rc));
991 return(rc);
992}
993//******************************************************************************
994//******************************************************************************
995BOOL WIN32API Pie(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
996 int nBottomRect, int nXRadial1, int nYRadial1, int nXRadial2,
997 int nYRadial2)
998{
999 dprintf(("GDI32: Pie %x (%d,%d)(%d,%d) (%d,%d) (%d,%d)", hdc, nLeftRect, nTopRect, nRightRect,
1000 nBottomRect, nXRadial1, nYRadial1, nXRadial2, nYRadial2));
1001
1002 //CB: bug in O32_Pie
1003 if (nXRadial1 == nXRadial2 && nYRadial1 == nYRadial2)
1004 return O32_Ellipse(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect);
1005 else
1006 return O32_Pie(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect,nXRadial1,nYRadial1,nXRadial2,nYRadial2);
1007}
1008//******************************************************************************
1009//******************************************************************************
1010BOOL WIN32API PolyBezier( HDC arg1, const POINT * arg2, DWORD arg3)
1011{
1012 dprintf(("GDI32: PolyBezier"));
1013 return O32_PolyBezier(arg1, arg2, (int)arg3);
1014}
1015//******************************************************************************
1016//******************************************************************************
1017BOOL WIN32API PolyBezierTo( HDC arg1, const POINT * arg2, DWORD arg3)
1018{
1019 dprintf(("GDI32: PolyBezierTo"));
1020 return O32_PolyBezierTo(arg1, arg2, arg3);
1021}
1022//******************************************************************************
1023//******************************************************************************
1024BOOL WIN32API PolyDraw( HDC arg1, const POINT * arg2, const BYTE * arg3, DWORD arg4)
1025{
1026 dprintf(("GDI32: PolyDraw"));
1027 return O32_PolyDraw(arg1, arg2, arg3, arg4);
1028}
1029//******************************************************************************
1030//******************************************************************************
1031BOOL WIN32API PolyPolygon( HDC arg1, const POINT * arg2, const INT * arg3, UINT arg4)
1032{
1033 dprintf(("GDI32: PolyPolygon"));
1034 return O32_PolyPolygon(arg1, arg2, arg3, arg4);
1035}
1036//******************************************************************************
1037//******************************************************************************
1038BOOL WIN32API PolyPolyline( HDC hdc, const POINT * lppt, const DWORD * lpdwPolyPoints, DWORD cCount)
1039{
1040 dprintf(("GDI32: PolyPolyline %x %x %x %d", hdc, lppt, lpdwPolyPoints, cCount));
1041
1042 return O32_PolyPolyline(hdc,lppt,lpdwPolyPoints,cCount);
1043}
1044//******************************************************************************
1045//******************************************************************************
1046BOOL WIN32API Polygon( HDC hdc, const POINT *lpPoints, int count)
1047{
1048 dprintf(("GDI32: Polygon %x %x %d", hdc, lpPoints, count));
1049 return O32_Polygon(hdc, lpPoints, count);
1050}
1051//******************************************************************************
1052//******************************************************************************
1053BOOL WIN32API PtVisible( HDC hdc, int x, int y)
1054{
1055 dprintf(("GDI32: PtVisible %x (%d,%d)", hdc, x, y));
1056 return O32_PtVisible(hdc, x, y);
1057}
1058//******************************************************************************
1059//******************************************************************************
1060BOOL WIN32API RectVisible( HDC hdc, const RECT *lpRect)
1061{
1062 if(lpRect == NULL) {
1063 dprintf(("WARNING: GDI32: RectVisible %x lpRect == NULL!"));
1064 return FALSE;
1065 }
1066 dprintf(("GDI32: RectVisible %x (%d,%d)(%d,%d)", hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom));
1067 return O32_RectVisible(hdc, lpRect);
1068}
1069//******************************************************************************
1070//******************************************************************************
1071HDC WIN32API ResetDCA( HDC arg1, const DEVMODEA * arg2)
1072{
1073 dprintf(("GDI32: ResetDCA\n"));
1074 return (HDC)O32_ResetDC(arg1, arg2);
1075}
1076//******************************************************************************
1077//******************************************************************************
1078HDC WIN32API ResetDCW( HDC arg1, const DEVMODEW * arg2)
1079{
1080 dprintf(("GDI32: ResetDCW\n"));
1081 // NOTE: This will not work as is (needs UNICODE support)
1082 return (HDC)O32_ResetDC(arg1, (const DEVMODEA *)arg2);
1083}
1084//******************************************************************************
1085//******************************************************************************
1086BOOL WIN32API RestoreDC(HDC hdc, int id)
1087{
1088 BOOL ret;
1089
1090 dprintf(("GDI32: RestoreDC %x %d", hdc, id));
1091
1092 ret = O32_RestoreDC(hdc, id);
1093 if(ret == FALSE) {
1094 dprintf(("ERROR: GDI32: RestoreDC %x %d FAILED", hdc, id));
1095 }
1096 return ret;
1097}
1098//******************************************************************************
1099//******************************************************************************
1100BOOL WIN32API RoundRect( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
1101{
1102 dprintf(("GDI32: RoundRect"));
1103 return O32_RoundRect(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
1104}
1105//******************************************************************************
1106//******************************************************************************
1107int WIN32API SaveDC( HDC hdc)
1108{
1109 int id;
1110
1111 dprintf(("GDI32: SaveDC %x", hdc));
1112 id = O32_SaveDC(hdc);
1113 if(id == 0) {
1114 dprintf(("ERROR: GDI32: SaveDC %x FAILED", hdc));
1115 }
1116 else dprintf(("GDI32: SaveDC %x returned %d", hdc, id));
1117 return id;
1118}
1119//******************************************************************************
1120//******************************************************************************
1121int WIN32API SetArcDirection( HDC arg1, int arg2)
1122{
1123 dprintf(("GDI32: SetArcDirection"));
1124 return O32_SetArcDirection(arg1, arg2);
1125}
1126//******************************************************************************
1127//******************************************************************************
1128UINT WIN32API SetBoundsRect( HDC arg1, const RECT * arg2, UINT arg3)
1129{
1130 dprintf(("GDI32: SetBoundsRect"));
1131 return O32_SetBoundsRect(arg1, arg2, arg3);
1132}
1133//******************************************************************************
1134//******************************************************************************
1135BOOL WIN32API SetBrushOrgEx( HDC arg1, int arg2, int arg3, PPOINT arg4)
1136{
1137 BOOL rc;
1138
1139 rc = O32_SetBrushOrgEx(arg1, arg2, arg3, arg4);
1140 dprintf(("GDI32: SetBrushOrgEx returned %d\n", rc));
1141 return(rc);
1142}
1143//******************************************************************************
1144//******************************************************************************
1145ODINFUNCTION2(DWORD, SetMapperFlags, HDC, hdc, DWORD, dwFlag)
1146{
1147 return O32_SetMapperFlags(hdc, dwFlag);
1148}
1149//******************************************************************************
1150//******************************************************************************
1151ODINFUNCTION3(BOOL, SetMiterLimit, HDC, hdc, float, eNewLimit, float* ,peOldLimit)
1152{
1153 return O32_SetMiterLimit(hdc, eNewLimit, peOldLimit);
1154}
1155//******************************************************************************
1156//******************************************************************************
1157ODINFUNCTION2(int, SetPolyFillMode, HDC, hdc, int, iPolyFillMode)
1158{
1159 return O32_SetPolyFillMode(hdc, iPolyFillMode);
1160}
1161//******************************************************************************
1162//******************************************************************************
1163ODINFUNCTION2(UINT, SetTextAlign, HDC, hdc, UINT, fMode)
1164{
1165 return O32_SetTextAlign(hdc, fMode);
1166}
1167//******************************************************************************
1168//******************************************************************************
1169ODINFUNCTION2(int, SetTextCharacterExtra, HDC, hdc, int, nCharExtra)
1170{
1171 return O32_SetTextCharacterExtra(hdc, nCharExtra);
1172}
1173//******************************************************************************
1174//******************************************************************************
1175ODINFUNCTION3(BOOL, SetTextJustification, HDC, hdc, int, nBreakExtra, int, nBreakCount)
1176{
1177 return O32_SetTextJustification(hdc, nBreakExtra, nBreakCount);
1178}
1179//******************************************************************************
1180//******************************************************************************
1181BOOL WIN32API WidenPath( HDC hdc)
1182{
1183 dprintf(("GDI32: WidenPath %x", hdc));
1184 return O32_WidenPath(hdc);
1185}
1186//******************************************************************************
1187//Selects the current path as a clipping region for a device context, combining
1188//any existing clipping region by using the specified mode
1189//TODO: Can be emulated with SelectClipRegion??
1190//******************************************************************************
1191BOOL WIN32API SelectClipPath(HDC hdc, int iMode)
1192{
1193 dprintf(("GDI32: SelectClipPath, not implemented!(TRUE)\n"));
1194 return(TRUE);
1195}
1196//******************************************************************************
1197//TODO: Sets the color adjustment values for a device context. (used to adjust
1198// the input color of the src bitmap for calls of StretchBlt & StretchDIBits
1199// functions when HALFTONE mode is set
1200//******************************************************************************
1201BOOL WIN32API SetColorAdjustment(HDC hdc, CONST COLORADJUSTMENT *lpca)
1202{
1203 dprintf(("GDI32: SetColorAdjustment, not implemented!(TRUE)\n"));
1204 return(TRUE);
1205}
1206//******************************************************************************
1207//Maps colors to system palette; faster way to update window (instead of redrawing)
1208//We just redraw
1209//******************************************************************************
1210BOOL WIN32API UpdateColors(HDC hdc)
1211{
1212 dprintf(("GDI32: UpdateColors\n"));
1213 return InvalidateRect(WindowFromDC(hdc), NULL, FALSE);
1214}
1215//******************************************************************************
1216//******************************************************************************
1217BOOL WIN32API GdiFlush()
1218{
1219 dprintf(("GDI32: GdiFlush, not implemented (TRUE)\n"));
1220 return(TRUE);
1221}
1222//******************************************************************************
1223//******************************************************************************
1224BOOL WIN32API GdiComment(HDC hdc, UINT cbSize, CONST BYTE *lpData)
1225{
1226 dprintf(("GDI32: GdiComment %x %d %x NOT IMPLEMENTED", hdc, cbSize, lpData));
1227// return O32_GdiComment(hdc, cbSize, lpData);
1228 return TRUE;
1229}
1230//******************************************************************************
1231//******************************************************************************
1232BOOL WIN32API GetCharWidthFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
1233{
1234 dprintf(("GDI32: GetCharWidthFloatA, not implemented\n"));
1235 return(FALSE);
1236}
1237//******************************************************************************
1238//******************************************************************************
1239BOOL WIN32API GetCharWidthFloatW(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
1240{
1241 dprintf(("GDI32: GetCharWidthFloatW, not implemented\n"));
1242 return(FALSE);
1243}
1244//******************************************************************************
1245//******************************************************************************
1246BOOL WIN32API GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT pxBUffer)
1247{
1248 dprintf(("GDI32: GetCharABCWidthsFloatA, not implemented\n"));
1249 return(FALSE);
1250}
1251//******************************************************************************
1252//******************************************************************************
1253BOOL WIN32API GetCharABCWidthsFloatW(HDC hdc,
1254 UINT iFirstChar,
1255 UINT iLastChar,
1256 LPABCFLOAT pxBUffer)
1257{
1258 dprintf(("GDI32: GetCharABCWidthsFloatA, not implemented\n"));
1259 return(FALSE);
1260}
1261//******************************************************************************
1262//******************************************************************************
1263INT WIN32API ExtEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
1264 INT cbOutput, LPSTR lpszOutData)
1265{
1266 dprintf(("GDI32: ExtEscape, %x %x %d %x %d %x not implemented", hdc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData));
1267#ifdef DEBUG
1268 if(cbInput && lpszInData) {
1269 ULONG *tmp = (ULONG *)lpszInData;
1270 for(int i=0;i<cbInput/4;i++) {
1271 dprintf(("GDI32: ExtEscape par %d: %x", i, *tmp++));
1272 }
1273 }
1274#endif
1275 return(0);
1276}
1277//******************************************************************************
1278//******************************************************************************
1279int WIN32API DrawEscape(HDC hdc, int nEscape, int cbInput, LPCSTR lpszInData)
1280{
1281 dprintf(("GDI32: DrawEscape, not implemented\n"));
1282 return(0);
1283}
1284//******************************************************************************
1285//******************************************************************************
1286BOOL WIN32API GetColorAdjustment(HDC hdc, COLORADJUSTMENT *lpca)
1287{
1288 dprintf(("GDI32: GetColorAdjustment, not implemented\n"));
1289 return(FALSE);
1290}
1291//******************************************************************************
1292//******************************************************************************
1293DWORD WIN32API GetGlyphOutlineA(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
1294 DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
1295{
1296 dprintf(("GDI32: GetGlyphOutLineA, not implemented (GDI_ERROR)\n"));
1297 return(GDI_ERROR);
1298}
1299//******************************************************************************
1300
1301//******************************************************************************
1302/*KSO Thu 21.05.1998*/
1303DWORD WIN32API GetGlyphOutlineW(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
1304 DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
1305{
1306 dprintf(("GDI32: GetGlyphOutLineW, not implemented\n"));
1307 return(GDI_ERROR);
1308}
1309//******************************************************************************
1310
1311//******************************************************************************
1312
1313
1314/* Office 97 stubs - KSO Thu 21.05.1998*/
1315//******************************************************************************
1316BOOL WIN32API GetTextExtentExPointA(/*KSO Thu 21.05.1998*/
1317 HDC hdc,
1318 LPCSTR str,
1319 int count,
1320 int maxExt,
1321 LPINT lpnFit,
1322 LPINT alpDx,
1323 LPSIZE size)
1324{
1325 int index, nFit, extent;
1326 SIZE tSize;
1327
1328 dprintf(("GDI32: GetTextExtendExPointA\n"));
1329
1330 size->cx = size->cy = nFit = extent = 0;
1331 for(index = 0; index < count; index++)
1332 {
1333 if(!O32_GetTextExtentPoint( hdc, str, 1, &tSize )) return FALSE;
1334 if( extent+tSize.cx < maxExt )
1335 {
1336 extent+=tSize.cx;
1337 nFit++;
1338 str++;
1339 if( alpDx )
1340 alpDx[index] = extent;
1341 if( tSize.cy > size->cy ) size->cy = tSize.cy;
1342 }
1343 else break;
1344 }
1345 size->cx = extent;
1346
1347 if (lpnFit != NULL) // check if result is desired
1348 *lpnFit = nFit;
1349
1350 dprintf(("GDI32: GetTextExtendExPointA(%08x '%.*s' %d) returning %d %d %d\n",
1351 hdc,count,str,maxExt,nFit, size->cx,size->cy));
1352 return TRUE;
1353}
1354//******************************************************************************
1355//******************************************************************************
1356BOOL WIN32API GetTextExtentExPointW( /*KSO Thu 21.05.1998*/
1357 HDC arg1,
1358 LPCWSTR arg2,
1359 int arg3,
1360 int arg4,
1361 LPINT arg5,
1362 LPINT arg6,
1363 LPSIZE arg7
1364 )
1365{
1366 char *astring = UnicodeToAsciiString((LPWSTR)arg2);
1367 BOOL rc;
1368
1369 dprintf(("GDI32: GetTextExtendExPointW\n"));
1370 rc = GetTextExtentExPointA(arg1, astring, arg3, arg4, arg5, arg6, arg7);
1371 FreeAsciiString(astring);
1372 return rc;
1373}
1374//******************************************************************************
1375
1376
1377/*****************************************************************************
1378 * Name : BOOL CancelDC
1379 * Purpose : The CancelDC function cancels any pending operation on the
1380 * specified device context (DC).
1381 * Parameters: HDC hdc handle of device context
1382 * Variables :
1383 * Result : TRUE / FALSE
1384 * Remark :
1385 * Status : UNTESTED STUB
1386 *
1387 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1388 *****************************************************************************/
1389
1390BOOL WIN32API CancelDC(HDC hdc)
1391{
1392 dprintf(("GDI32: CancelDC(%08xh) not implemented.\n",
1393 hdc));
1394
1395 return (FALSE);
1396}
1397
1398
1399/*****************************************************************************
1400 * Name : BOOL CombineTransform
1401 * Purpose : The CombineTransform function concatenates two world-space to
1402 * page-space transformations.
1403 * Parameters: LLPXFORM lLPXFORMResult address of combined transformation
1404 * XFORM *lLPXFORM1 address of 1st transformation
1405 * XFORM *lLPXFORM2 address of 2nd transformation
1406 * Variables :
1407 * Result : TRUE / FALSE
1408 * Remark :
1409 * Status : COMPLETELY UNTESTED
1410 *
1411 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1412 * Markus Montkowski [Wen, 1999/01/12 20:18]
1413 *****************************************************************************/
1414
1415BOOL WIN32API CombineTransform(LPXFORM lLPXFORMResult,
1416 CONST XFORM *lLPXFORM1,
1417 CONST XFORM *lLPXFORM2)
1418{
1419 dprintf(("GDI32: CombineTransform(%08xh,%08xh,%08xh).\n",
1420 lLPXFORMResult,
1421 lLPXFORM1,
1422 lLPXFORM2));
1423
1424 XFORM xfrm;
1425 if( IsBadWritePtr( (void*)lLPXFORMResult, sizeof(XFORM)) ||
1426 IsBadReadPtr( (void*)lLPXFORM1, sizeof(XFORM)) ||
1427 IsBadWritePtr( (void*)lLPXFORM2, sizeof(XFORM)) )
1428 return (FALSE);
1429
1430 // Add the translations
1431 lLPXFORMResult->eDx = lLPXFORM1->eDx + lLPXFORM2->eDx;
1432 lLPXFORMResult->eDy = lLPXFORM1->eDy + lLPXFORM2->eDy;
1433
1434 // Multiply the matrixes
1435 xfrm.eM11 = lLPXFORM1->eM11 * lLPXFORM2->eM11 + lLPXFORM1->eM21 * lLPXFORM1->eM12;
1436 xfrm.eM12 = lLPXFORM1->eM11 * lLPXFORM2->eM12 + lLPXFORM1->eM12 * lLPXFORM1->eM22;
1437 xfrm.eM21 = lLPXFORM1->eM21 * lLPXFORM2->eM11 + lLPXFORM1->eM22 * lLPXFORM1->eM21;
1438 xfrm.eM22 = lLPXFORM1->eM21 * lLPXFORM2->eM12 + lLPXFORM1->eM22 * lLPXFORM1->eM22;
1439
1440 // Now copy to resulting XFROM as the pt must not be distinct
1441 lLPXFORMResult->eM11 = xfrm.eM11;
1442 lLPXFORMResult->eM12 = xfrm.eM12;
1443 lLPXFORMResult->eM21 = xfrm.eM21;
1444 lLPXFORMResult->eM22 = xfrm.eM22;
1445
1446 return (TRUE);
1447}
1448
1449
1450/*****************************************************************************
1451 * Name : BOOL FixBrushOrgEx
1452 * Purpose : The FixBrushOrgEx function is not implemented in the Win32 API.
1453 * It is provided for compatibility with Win32s. If called, the
1454 * function does nothing, and returns FALSE.
1455 * Parameters: HDC, int, int, LPPOINT
1456 * Variables :
1457 * Result : TRUE / FALSE
1458 * Remark : not implemented in Win32
1459 * Status : UNTESTED STUB
1460 *
1461 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1462 *****************************************************************************/
1463
1464BOOL WIN32API FixBrushOrgEx(HDC hdc,
1465 int iDummy1,
1466 int iDummy2,
1467 LPPOINT lpPoint)
1468{
1469 dprintf(("GDI32: FixBrushOrgEx(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1470 hdc,
1471 iDummy1,
1472 iDummy2,
1473 lpPoint));
1474
1475 return (FALSE);
1476}
1477
1478
1479/*****************************************************************************
1480 * Name : DWORD GdiGetBatchLimit
1481 * Purpose : The GdiGetBatchLimit function returns the maximum number of
1482 * function calls that can be accumulated in the calling thread's
1483 * current batch. The system flushes the current batch whenever
1484 * this limit is exceeded.
1485 * Parameters:
1486 * Variables :
1487 * Result : 1
1488 * Remark :
1489 * Status : UNTESTED STUB
1490 *
1491 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1492 *****************************************************************************/
1493
1494DWORD WIN32API GdiGetBatchLimit(VOID)
1495{
1496 dprintf(("GDI32: GdiGetBatchLimit() not implemented (1).\n"));
1497
1498 return (1);
1499}
1500
1501
1502/*****************************************************************************
1503 * Name : DWORD GdiSetBatchLimit
1504 * Purpose : The GdiSetBatchLimit function sets the maximum number of
1505 * functions that can be accumulated in the calling thread's current
1506 * batch. The system flushes the current batch whenever this limit
1507 * is exceeded.
1508 * Parameters: DWORD dwLimit
1509 * Variables :
1510 * Result :
1511 * Remark :
1512 * Status : UNTESTED STUB
1513 *
1514 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1515 *****************************************************************************/
1516
1517DWORD WIN32API GdiSetBatchLimit(DWORD dwLimit)
1518{
1519 dprintf(("GDI32: GdiSetBatchLimit(%08xh) not implemented (1).\n",
1520 dwLimit));
1521
1522 return (1);
1523}
1524
1525
1526/*****************************************************************************
1527 * Name : DWORD GetCharacterPlacementA
1528 * Purpose : The GetCharacterPlacementA function retrieves information about
1529 * a character string, such as character widths, caret positioning,
1530 * ordering within the string, and glyph rendering. The type of
1531 * information returned depends on the dwFlags parameter and is
1532 * based on the currently selected font in the given display context.
1533 * The function copies the information to the specified GCP_RESULTSA
1534 * structure or to one or more arrays specified by the structure.
1535 * Parameters: HDC hdc handle to device context
1536 * LPCSTR lpString pointer to string
1537 * int nCount number of characters in string
1538 * int nMaxExtent maximum extent for displayed string
1539 * LPGCP_RESULTSA *lpResults pointer to buffer for placement result
1540 * DWORD dwFlags placement flags
1541 * Variables :
1542 * Result :
1543 * Remark :
1544 * Status : UNTESTED STUB
1545 *
1546 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1547 *****************************************************************************/
1548
1549DWORD WIN32API GetCharacterPlacementA(HDC hdc,
1550 LPCSTR lpString,
1551 int nCount,
1552 int nMaxExtent,
1553 GCP_RESULTSA * lpResults,
1554 DWORD dwFlags)
1555{
1556 dprintf(("GDI32: GetCharacterPlacementA(%08xh,%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1557 hdc,
1558 lpString,
1559 nCount,
1560 nMaxExtent,
1561 lpResults,
1562 dwFlags));
1563
1564 return (0);
1565}
1566
1567
1568/*****************************************************************************
1569 * Name : DWORD GetCharacterPlacementW
1570 * Purpose : The GetCharacterPlacementW function retrieves information about
1571 * a character string, such as character widths, caret positioning,
1572 * ordering within the string, and glyph rendering. The type of
1573 * information returned depends on the dwFlags parameter and is
1574 * based on the currently selected font in the given display context.
1575 * The function copies the information to the specified GCP_RESULTSW
1576 * structure or to one or more arrays specified by the structure.
1577 * Parameters: HDC hdc handle to device context
1578 * LPCSTR lpString pointer to string
1579 * int nCount number of characters in string
1580 * int nMaxExtent maximum extent for displayed string
1581 * GCP_RESULTSW *lpResults pointer to buffer for placement result
1582 * DWORD dwFlags placement flags
1583 * Variables :
1584 * Result :
1585 * Remark :
1586 * Status : UNTESTED STUB
1587 *
1588 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1589 *****************************************************************************/
1590
1591DWORD WIN32API GetCharacterPlacementW(HDC hdc,
1592 LPCWSTR lpString,
1593 int nCount,
1594 int nMaxExtent,
1595 GCP_RESULTSW *lpResults,
1596 DWORD dwFlags)
1597{
1598 dprintf(("GDI32: GetCharacterPlacementW(%08xh,%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1599 hdc,
1600 lpString,
1601 nCount,
1602 nMaxExtent,
1603 lpResults,
1604 dwFlags));
1605
1606 return (0);
1607}
Note: See TracBrowser for help on using the repository browser.