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

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

use critical section in dib section class instead of vmutex

File size: 61.9 KB
Line 
1/* $Id: gdi32.cpp,v 1.79 2001-12-31 12:08:22 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 arg2)
952{
953 BOOL rc;
954
955 rc = O32_GetTextMetrics(hdc, arg2);
956 dprintf(("GDI32: GetTextMetricsA %x %x returned %d", hdc, arg2, rc));
957 return(rc);
958}
959//******************************************************************************
960//******************************************************************************
961BOOL WIN32API GetTextMetricsW( HDC arg1, LPTEXTMETRICW pwtm)
962{
963 BOOL rc;
964 TEXTMETRICA atm;
965
966 dprintf(("GDI32: GetTextMetricsW"));
967
968 rc = O32_GetTextMetrics(arg1, &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 return(rc);
990}
991//******************************************************************************
992//******************************************************************************
993BOOL WIN32API Pie(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
994 int nBottomRect, int nXRadial1, int nYRadial1, int nXRadial2,
995 int nYRadial2)
996{
997 dprintf(("GDI32: Pie %x (%d,%d)(%d,%d) (%d,%d) (%d,%d)", hdc, nLeftRect, nTopRect, nRightRect,
998 nBottomRect, nXRadial1, nYRadial1, nXRadial2, nYRadial2));
999
1000 //CB: bug in O32_Pie
1001 if (nXRadial1 == nXRadial2 && nYRadial1 == nYRadial2)
1002 return O32_Ellipse(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect);
1003 else
1004 return O32_Pie(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect,nXRadial1,nYRadial1,nXRadial2,nYRadial2);
1005}
1006//******************************************************************************
1007//******************************************************************************
1008BOOL WIN32API PolyBezier( HDC arg1, const POINT * arg2, DWORD arg3)
1009{
1010 dprintf(("GDI32: PolyBezier"));
1011 return O32_PolyBezier(arg1, arg2, (int)arg3);
1012}
1013//******************************************************************************
1014//******************************************************************************
1015BOOL WIN32API PolyBezierTo( HDC arg1, const POINT * arg2, DWORD arg3)
1016{
1017 dprintf(("GDI32: PolyBezierTo"));
1018 return O32_PolyBezierTo(arg1, arg2, arg3);
1019}
1020//******************************************************************************
1021//******************************************************************************
1022BOOL WIN32API PolyDraw( HDC arg1, const POINT * arg2, const BYTE * arg3, DWORD arg4)
1023{
1024 dprintf(("GDI32: PolyDraw"));
1025 return O32_PolyDraw(arg1, arg2, arg3, arg4);
1026}
1027//******************************************************************************
1028//******************************************************************************
1029BOOL WIN32API PolyPolygon( HDC arg1, const POINT * arg2, const INT * arg3, UINT arg4)
1030{
1031 dprintf(("GDI32: PolyPolygon"));
1032 return O32_PolyPolygon(arg1, arg2, arg3, arg4);
1033}
1034//******************************************************************************
1035//******************************************************************************
1036BOOL WIN32API PolyPolyline( HDC hdc, const POINT * lppt, const DWORD * lpdwPolyPoints, DWORD cCount)
1037{
1038 dprintf(("GDI32: PolyPolyline %x %x %x %d", hdc, lppt, lpdwPolyPoints, cCount));
1039
1040 return O32_PolyPolyline(hdc,lppt,lpdwPolyPoints,cCount);
1041}
1042//******************************************************************************
1043//******************************************************************************
1044BOOL WIN32API Polygon( HDC hdc, const POINT *lpPoints, int count)
1045{
1046 dprintf(("GDI32: Polygon %x %x %d", hdc, lpPoints, count));
1047 return O32_Polygon(hdc, lpPoints, count);
1048}
1049//******************************************************************************
1050//******************************************************************************
1051BOOL WIN32API PtVisible( HDC hdc, int x, int y)
1052{
1053 dprintf(("GDI32: PtVisible %x (%d,%d)", hdc, x, y));
1054 return O32_PtVisible(hdc, x, y);
1055}
1056//******************************************************************************
1057//******************************************************************************
1058BOOL WIN32API RectVisible( HDC hdc, const RECT *lpRect)
1059{
1060 if(lpRect == NULL) {
1061 dprintf(("WARNING: GDI32: RectVisible %x lpRect == NULL!"));
1062 return FALSE;
1063 }
1064 dprintf(("GDI32: RectVisible %x (%d,%d)(%d,%d)", hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom));
1065 return O32_RectVisible(hdc, lpRect);
1066}
1067//******************************************************************************
1068//******************************************************************************
1069HDC WIN32API ResetDCA( HDC arg1, const DEVMODEA * arg2)
1070{
1071 dprintf(("GDI32: ResetDCA\n"));
1072 return (HDC)O32_ResetDC(arg1, arg2);
1073}
1074//******************************************************************************
1075//******************************************************************************
1076HDC WIN32API ResetDCW( HDC arg1, const DEVMODEW * arg2)
1077{
1078 dprintf(("GDI32: ResetDCW\n"));
1079 // NOTE: This will not work as is (needs UNICODE support)
1080 return (HDC)O32_ResetDC(arg1, (const DEVMODEA *)arg2);
1081}
1082//******************************************************************************
1083//******************************************************************************
1084BOOL WIN32API RestoreDC(HDC hdc, int id)
1085{
1086 BOOL ret;
1087
1088 dprintf(("GDI32: RestoreDC %x %d", hdc, id));
1089
1090 ret = O32_RestoreDC(hdc, id);
1091 if(ret == FALSE) {
1092 dprintf(("ERROR: GDI32: RestoreDC %x %d FAILED", hdc, id));
1093 }
1094 return ret;
1095}
1096//******************************************************************************
1097//******************************************************************************
1098BOOL WIN32API RoundRect( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
1099{
1100 dprintf(("GDI32: RoundRect"));
1101 return O32_RoundRect(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
1102}
1103//******************************************************************************
1104//******************************************************************************
1105int WIN32API SaveDC( HDC hdc)
1106{
1107 int id;
1108
1109 dprintf(("GDI32: SaveDC %x", hdc));
1110 id = O32_SaveDC(hdc);
1111 if(id == 0) {
1112 dprintf(("ERROR: GDI32: SaveDC %x FAILED", hdc));
1113 }
1114 else dprintf(("GDI32: SaveDC %x returned %d", hdc, id));
1115 return id;
1116}
1117//******************************************************************************
1118//******************************************************************************
1119int WIN32API SetArcDirection( HDC arg1, int arg2)
1120{
1121 dprintf(("GDI32: SetArcDirection"));
1122 return O32_SetArcDirection(arg1, arg2);
1123}
1124//******************************************************************************
1125//******************************************************************************
1126UINT WIN32API SetBoundsRect( HDC arg1, const RECT * arg2, UINT arg3)
1127{
1128 dprintf(("GDI32: SetBoundsRect"));
1129 return O32_SetBoundsRect(arg1, arg2, arg3);
1130}
1131//******************************************************************************
1132//******************************************************************************
1133BOOL WIN32API SetBrushOrgEx( HDC arg1, int arg2, int arg3, PPOINT arg4)
1134{
1135 BOOL rc;
1136
1137 rc = O32_SetBrushOrgEx(arg1, arg2, arg3, arg4);
1138 dprintf(("GDI32: SetBrushOrgEx returned %d\n", rc));
1139 return(rc);
1140}
1141//******************************************************************************
1142//******************************************************************************
1143ODINFUNCTION2(DWORD, SetMapperFlags, HDC, hdc, DWORD, dwFlag)
1144{
1145 return O32_SetMapperFlags(hdc, dwFlag);
1146}
1147//******************************************************************************
1148//******************************************************************************
1149ODINFUNCTION3(BOOL, SetMiterLimit, HDC, hdc, float, eNewLimit, float* ,peOldLimit)
1150{
1151 return O32_SetMiterLimit(hdc, eNewLimit, peOldLimit);
1152}
1153//******************************************************************************
1154//******************************************************************************
1155ODINFUNCTION2(int, SetPolyFillMode, HDC, hdc, int, iPolyFillMode)
1156{
1157 return O32_SetPolyFillMode(hdc, iPolyFillMode);
1158}
1159//******************************************************************************
1160//******************************************************************************
1161ODINFUNCTION2(UINT, SetTextAlign, HDC, hdc, UINT, fMode)
1162{
1163 return O32_SetTextAlign(hdc, fMode);
1164}
1165//******************************************************************************
1166//******************************************************************************
1167ODINFUNCTION2(int, SetTextCharacterExtra, HDC, hdc, int, nCharExtra)
1168{
1169 return O32_SetTextCharacterExtra(hdc, nCharExtra);
1170}
1171//******************************************************************************
1172//******************************************************************************
1173ODINFUNCTION3(BOOL, SetTextJustification, HDC, hdc, int, nBreakExtra, int, nBreakCount)
1174{
1175 return O32_SetTextJustification(hdc, nBreakExtra, nBreakCount);
1176}
1177//******************************************************************************
1178//******************************************************************************
1179BOOL WIN32API WidenPath( HDC hdc)
1180{
1181 dprintf(("GDI32: WidenPath %x", hdc));
1182 return O32_WidenPath(hdc);
1183}
1184//******************************************************************************
1185//Selects the current path as a clipping region for a device context, combining
1186//any existing clipping region by using the specified mode
1187//TODO: Can be emulated with SelectClipRegion??
1188//******************************************************************************
1189BOOL WIN32API SelectClipPath(HDC hdc, int iMode)
1190{
1191 dprintf(("GDI32: SelectClipPath, not implemented!(TRUE)\n"));
1192 return(TRUE);
1193}
1194//******************************************************************************
1195//TODO: Sets the color adjustment values for a device context. (used to adjust
1196// the input color of the src bitmap for calls of StretchBlt & StretchDIBits
1197// functions when HALFTONE mode is set
1198//******************************************************************************
1199BOOL WIN32API SetColorAdjustment(HDC hdc, CONST COLORADJUSTMENT *lpca)
1200{
1201 dprintf(("GDI32: SetColorAdjustment, not implemented!(TRUE)\n"));
1202 return(TRUE);
1203}
1204//******************************************************************************
1205//Maps colors to system palette; faster way to update window (instead of redrawing)
1206//We just redraw
1207//******************************************************************************
1208BOOL WIN32API UpdateColors(HDC hdc)
1209{
1210 dprintf(("GDI32: UpdateColors\n"));
1211 return InvalidateRect(WindowFromDC(hdc), NULL, FALSE);
1212}
1213//******************************************************************************
1214//******************************************************************************
1215BOOL WIN32API GdiFlush()
1216{
1217 dprintf(("GDI32: GdiFlush, not implemented (TRUE)\n"));
1218 return(TRUE);
1219}
1220//******************************************************************************
1221//******************************************************************************
1222BOOL WIN32API GdiComment(HDC hdc, UINT cbSize, CONST BYTE *lpData)
1223{
1224 dprintf(("GDI32: GdiComment %x %d %x NOT IMPLEMENTED", hdc, cbSize, lpData));
1225// return O32_GdiComment(hdc, cbSize, lpData);
1226 return TRUE;
1227}
1228//******************************************************************************
1229//******************************************************************************
1230BOOL WIN32API GetCharWidthFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
1231{
1232 dprintf(("GDI32: GetCharWidthFloatA, not implemented\n"));
1233 return(FALSE);
1234}
1235//******************************************************************************
1236//******************************************************************************
1237BOOL WIN32API GetCharWidthFloatW(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBUffer)
1238{
1239 dprintf(("GDI32: GetCharWidthFloatW, not implemented\n"));
1240 return(FALSE);
1241}
1242//******************************************************************************
1243//******************************************************************************
1244BOOL WIN32API GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT pxBUffer)
1245{
1246 dprintf(("GDI32: GetCharABCWidthsFloatA, not implemented\n"));
1247 return(FALSE);
1248}
1249//******************************************************************************
1250//******************************************************************************
1251BOOL WIN32API GetCharABCWidthsFloatW(HDC hdc,
1252 UINT iFirstChar,
1253 UINT iLastChar,
1254 LPABCFLOAT pxBUffer)
1255{
1256 dprintf(("GDI32: GetCharABCWidthsFloatA, not implemented\n"));
1257 return(FALSE);
1258}
1259//******************************************************************************
1260//******************************************************************************
1261INT WIN32API ExtEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
1262 INT cbOutput, LPSTR lpszOutData)
1263{
1264 dprintf(("GDI32: ExtEscape, %x %x %d %x %d %x not implemented", hdc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData));
1265#ifdef DEBUG
1266 if(cbInput && lpszInData) {
1267 ULONG *tmp = (ULONG *)lpszInData;
1268 for(int i=0;i<cbInput/4;i++) {
1269 dprintf(("GDI32: ExtEscape par %d: %x", i, *tmp++));
1270 }
1271 }
1272#endif
1273 return(0);
1274}
1275//******************************************************************************
1276//******************************************************************************
1277int WIN32API DrawEscape(HDC hdc, int nEscape, int cbInput, LPCSTR lpszInData)
1278{
1279 dprintf(("GDI32: DrawEscape, not implemented\n"));
1280 return(0);
1281}
1282//******************************************************************************
1283//******************************************************************************
1284BOOL WIN32API GetColorAdjustment(HDC hdc, COLORADJUSTMENT *lpca)
1285{
1286 dprintf(("GDI32: GetColorAdjustment, not implemented\n"));
1287 return(FALSE);
1288}
1289//******************************************************************************
1290//******************************************************************************
1291DWORD WIN32API GetGlyphOutlineA(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
1292 DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
1293{
1294 dprintf(("GDI32: GetGlyphOutLineA, not implemented (GDI_ERROR)\n"));
1295 return(GDI_ERROR);
1296}
1297//******************************************************************************
1298
1299//******************************************************************************
1300/*KSO Thu 21.05.1998*/
1301DWORD WIN32API GetGlyphOutlineW(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
1302 DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
1303{
1304 dprintf(("GDI32: GetGlyphOutLineW, not implemented\n"));
1305 return(GDI_ERROR);
1306}
1307//******************************************************************************
1308
1309//******************************************************************************
1310
1311
1312/* Office 97 stubs - KSO Thu 21.05.1998*/
1313//******************************************************************************
1314BOOL WIN32API GetTextExtentExPointA(/*KSO Thu 21.05.1998*/
1315 HDC hdc,
1316 LPCSTR str,
1317 int count,
1318 int maxExt,
1319 LPINT lpnFit,
1320 LPINT alpDx,
1321 LPSIZE size)
1322{
1323 int index, nFit, extent;
1324 SIZE tSize;
1325
1326 dprintf(("GDI32: GetTextExtendExPointA\n"));
1327
1328 size->cx = size->cy = nFit = extent = 0;
1329 for(index = 0; index < count; index++)
1330 {
1331 if(!O32_GetTextExtentPoint( hdc, str, 1, &tSize )) return FALSE;
1332 if( extent+tSize.cx < maxExt )
1333 {
1334 extent+=tSize.cx;
1335 nFit++;
1336 str++;
1337 if( alpDx )
1338 alpDx[index] = extent;
1339 if( tSize.cy > size->cy ) size->cy = tSize.cy;
1340 }
1341 else break;
1342 }
1343 size->cx = extent;
1344
1345 if (lpnFit != NULL) // check if result is desired
1346 *lpnFit = nFit;
1347
1348 dprintf(("GDI32: GetTextExtendExPointA(%08x '%.*s' %d) returning %d %d %d\n",
1349 hdc,count,str,maxExt,nFit, size->cx,size->cy));
1350 return TRUE;
1351}
1352//******************************************************************************
1353//******************************************************************************
1354BOOL WIN32API GetTextExtentExPointW( /*KSO Thu 21.05.1998*/
1355 HDC arg1,
1356 LPCWSTR arg2,
1357 int arg3,
1358 int arg4,
1359 LPINT arg5,
1360 LPINT arg6,
1361 LPSIZE arg7
1362 )
1363{
1364 char *astring = UnicodeToAsciiString((LPWSTR)arg2);
1365 BOOL rc;
1366
1367 dprintf(("GDI32: GetTextExtendExPointW\n"));
1368 rc = GetTextExtentExPointA(arg1, astring, arg3, arg4, arg5, arg6, arg7);
1369 FreeAsciiString(astring);
1370 return rc;
1371}
1372//******************************************************************************
1373
1374
1375/*****************************************************************************
1376 * Name : BOOL CancelDC
1377 * Purpose : The CancelDC function cancels any pending operation on the
1378 * specified device context (DC).
1379 * Parameters: HDC hdc handle of device context
1380 * Variables :
1381 * Result : TRUE / FALSE
1382 * Remark :
1383 * Status : UNTESTED STUB
1384 *
1385 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1386 *****************************************************************************/
1387
1388BOOL WIN32API CancelDC(HDC hdc)
1389{
1390 dprintf(("GDI32: CancelDC(%08xh) not implemented.\n",
1391 hdc));
1392
1393 return (FALSE);
1394}
1395
1396
1397/*****************************************************************************
1398 * Name : BOOL CombineTransform
1399 * Purpose : The CombineTransform function concatenates two world-space to
1400 * page-space transformations.
1401 * Parameters: LLPXFORM lLPXFORMResult address of combined transformation
1402 * XFORM *lLPXFORM1 address of 1st transformation
1403 * XFORM *lLPXFORM2 address of 2nd transformation
1404 * Variables :
1405 * Result : TRUE / FALSE
1406 * Remark :
1407 * Status : COMPLETELY UNTESTED
1408 *
1409 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1410 * Markus Montkowski [Wen, 1999/01/12 20:18]
1411 *****************************************************************************/
1412
1413BOOL WIN32API CombineTransform(LPXFORM lLPXFORMResult,
1414 CONST XFORM *lLPXFORM1,
1415 CONST XFORM *lLPXFORM2)
1416{
1417 dprintf(("GDI32: CombineTransform(%08xh,%08xh,%08xh).\n",
1418 lLPXFORMResult,
1419 lLPXFORM1,
1420 lLPXFORM2));
1421
1422 XFORM xfrm;
1423 if( IsBadWritePtr( (void*)lLPXFORMResult, sizeof(XFORM)) ||
1424 IsBadReadPtr( (void*)lLPXFORM1, sizeof(XFORM)) ||
1425 IsBadWritePtr( (void*)lLPXFORM2, sizeof(XFORM)) )
1426 return (FALSE);
1427
1428 // Add the translations
1429 lLPXFORMResult->eDx = lLPXFORM1->eDx + lLPXFORM2->eDx;
1430 lLPXFORMResult->eDy = lLPXFORM1->eDy + lLPXFORM2->eDy;
1431
1432 // Multiply the matrixes
1433 xfrm.eM11 = lLPXFORM1->eM11 * lLPXFORM2->eM11 + lLPXFORM1->eM21 * lLPXFORM1->eM12;
1434 xfrm.eM12 = lLPXFORM1->eM11 * lLPXFORM2->eM12 + lLPXFORM1->eM12 * lLPXFORM1->eM22;
1435 xfrm.eM21 = lLPXFORM1->eM21 * lLPXFORM2->eM11 + lLPXFORM1->eM22 * lLPXFORM1->eM21;
1436 xfrm.eM22 = lLPXFORM1->eM21 * lLPXFORM2->eM12 + lLPXFORM1->eM22 * lLPXFORM1->eM22;
1437
1438 // Now copy to resulting XFROM as the pt must not be distinct
1439 lLPXFORMResult->eM11 = xfrm.eM11;
1440 lLPXFORMResult->eM12 = xfrm.eM12;
1441 lLPXFORMResult->eM21 = xfrm.eM21;
1442 lLPXFORMResult->eM22 = xfrm.eM22;
1443
1444 return (TRUE);
1445}
1446
1447
1448/*****************************************************************************
1449 * Name : BOOL FixBrushOrgEx
1450 * Purpose : The FixBrushOrgEx function is not implemented in the Win32 API.
1451 * It is provided for compatibility with Win32s. If called, the
1452 * function does nothing, and returns FALSE.
1453 * Parameters: HDC, int, int, LPPOINT
1454 * Variables :
1455 * Result : TRUE / FALSE
1456 * Remark : not implemented in Win32
1457 * Status : UNTESTED STUB
1458 *
1459 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1460 *****************************************************************************/
1461
1462BOOL WIN32API FixBrushOrgEx(HDC hdc,
1463 int iDummy1,
1464 int iDummy2,
1465 LPPOINT lpPoint)
1466{
1467 dprintf(("GDI32: FixBrushOrgEx(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1468 hdc,
1469 iDummy1,
1470 iDummy2,
1471 lpPoint));
1472
1473 return (FALSE);
1474}
1475
1476
1477/*****************************************************************************
1478 * Name : DWORD GdiGetBatchLimit
1479 * Purpose : The GdiGetBatchLimit function returns the maximum number of
1480 * function calls that can be accumulated in the calling thread's
1481 * current batch. The system flushes the current batch whenever
1482 * this limit is exceeded.
1483 * Parameters:
1484 * Variables :
1485 * Result : 1
1486 * Remark :
1487 * Status : UNTESTED STUB
1488 *
1489 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1490 *****************************************************************************/
1491
1492DWORD WIN32API GdiGetBatchLimit(VOID)
1493{
1494 dprintf(("GDI32: GdiGetBatchLimit() not implemented (1).\n"));
1495
1496 return (1);
1497}
1498
1499
1500/*****************************************************************************
1501 * Name : DWORD GdiSetBatchLimit
1502 * Purpose : The GdiSetBatchLimit function sets the maximum number of
1503 * functions that can be accumulated in the calling thread's current
1504 * batch. The system flushes the current batch whenever this limit
1505 * is exceeded.
1506 * Parameters: DWORD dwLimit
1507 * Variables :
1508 * Result :
1509 * Remark :
1510 * Status : UNTESTED STUB
1511 *
1512 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1513 *****************************************************************************/
1514
1515DWORD WIN32API GdiSetBatchLimit(DWORD dwLimit)
1516{
1517 dprintf(("GDI32: GdiSetBatchLimit(%08xh) not implemented (1).\n",
1518 dwLimit));
1519
1520 return (1);
1521}
1522
1523
1524/*****************************************************************************
1525 * Name : DWORD GetCharacterPlacementA
1526 * Purpose : The GetCharacterPlacementA function retrieves information about
1527 * a character string, such as character widths, caret positioning,
1528 * ordering within the string, and glyph rendering. The type of
1529 * information returned depends on the dwFlags parameter and is
1530 * based on the currently selected font in the given display context.
1531 * The function copies the information to the specified GCP_RESULTSA
1532 * structure or to one or more arrays specified by the structure.
1533 * Parameters: HDC hdc handle to device context
1534 * LPCSTR lpString pointer to string
1535 * int nCount number of characters in string
1536 * int nMaxExtent maximum extent for displayed string
1537 * LPGCP_RESULTSA *lpResults pointer to buffer for placement result
1538 * DWORD dwFlags placement flags
1539 * Variables :
1540 * Result :
1541 * Remark :
1542 * Status : UNTESTED STUB
1543 *
1544 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1545 *****************************************************************************/
1546
1547DWORD WIN32API GetCharacterPlacementA(HDC hdc,
1548 LPCSTR lpString,
1549 int nCount,
1550 int nMaxExtent,
1551 GCP_RESULTSA * lpResults,
1552 DWORD dwFlags)
1553{
1554 dprintf(("GDI32: GetCharacterPlacementA(%08xh,%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1555 hdc,
1556 lpString,
1557 nCount,
1558 nMaxExtent,
1559 lpResults,
1560 dwFlags));
1561
1562 return (0);
1563}
1564
1565
1566/*****************************************************************************
1567 * Name : DWORD GetCharacterPlacementW
1568 * Purpose : The GetCharacterPlacementW function retrieves information about
1569 * a character string, such as character widths, caret positioning,
1570 * ordering within the string, and glyph rendering. The type of
1571 * information returned depends on the dwFlags parameter and is
1572 * based on the currently selected font in the given display context.
1573 * The function copies the information to the specified GCP_RESULTSW
1574 * structure or to one or more arrays specified by the structure.
1575 * Parameters: HDC hdc handle to device context
1576 * LPCSTR lpString pointer to string
1577 * int nCount number of characters in string
1578 * int nMaxExtent maximum extent for displayed string
1579 * GCP_RESULTSW *lpResults pointer to buffer for placement result
1580 * DWORD dwFlags placement flags
1581 * Variables :
1582 * Result :
1583 * Remark :
1584 * Status : UNTESTED STUB
1585 *
1586 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1587 *****************************************************************************/
1588
1589DWORD WIN32API GetCharacterPlacementW(HDC hdc,
1590 LPCWSTR lpString,
1591 int nCount,
1592 int nMaxExtent,
1593 GCP_RESULTSW *lpResults,
1594 DWORD dwFlags)
1595{
1596 dprintf(("GDI32: GetCharacterPlacementW(%08xh,%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1597 hdc,
1598 lpString,
1599 nCount,
1600 nMaxExtent,
1601 lpResults,
1602 dwFlags));
1603
1604 return (0);
1605}
Note: See TracBrowser for help on using the repository browser.