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

Last change on this file since 10594 was 10594, checked in by sandervl, 21 years ago

drawSingleLinePoint: wrong pen style checks; logging updates

File size: 38.1 KB
Line 
1/* $Id: gdi32.cpp,v 1.94 2004-04-30 13:27:18 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#include <objhandle.h>
29#include <winspool.h>
30
31#define DBG_LOCALLOG DBG_gdi32
32#include "dbglocal.h"
33
34ODINDEBUGCHANNEL(GDI32-GDI32)
35
36//******************************************************************************
37//******************************************************************************
38BOOL WIN32API GdiFlush()
39{
40 //NOP: DIB synchronization is done using exceptions
41 return TRUE;
42}
43//******************************************************************************
44//******************************************************************************
45int WIN32API FillRect(HDC hDC, const RECT * lprc, HBRUSH hbr)
46{
47 int ret;
48
49 //SvL: brush 0 means current selected brush (verified in NT4)
50 if(hbr == 0) {
51 hbr = GetCurrentObject(hDC, OBJ_BRUSH);
52 }
53 else
54 if (hbr <= (HBRUSH) (COLOR_MAX + 1)) {
55 hbr = GetSysColorBrush( (INT) hbr - 1 );
56 }
57 dprintf(("USER32: FillRect %x (%d,%d)(%d,%d) brush %X", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom, hbr));
58 DIBSECTION_CHECK_IF_DIRTY(hDC);
59 ret = O32_FillRect(hDC,lprc,hbr);
60 DIBSECTION_MARK_INVALID(hDC);
61 return ret;
62}
63//******************************************************************************
64//******************************************************************************
65int WIN32API FrameRect( HDC hDC, const RECT * lprc, HBRUSH hbr)
66{
67 int ret;
68
69 dprintf(("USER32: FrameRect %x (%d,%d)(%d,%d) brush %x", hDC, lprc->top, lprc->left, lprc->bottom, lprc->right, hbr));
70 DIBSECTION_CHECK_IF_DIRTY(hDC);
71 ret = O32_FrameRect(hDC,lprc,hbr);
72 DIBSECTION_MARK_INVALID(hDC);
73 return ret;
74}
75//******************************************************************************
76//******************************************************************************
77BOOL WIN32API InvertRect( HDC hDC, const RECT * lprc)
78{
79 int ret;
80
81 if(lprc) {
82 dprintf(("USER32: InvertRect %x (%d,%d)(%d,%d)", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom));
83 }
84 else dprintf(("USER32: InvertRect %x NULL", hDC));
85 DIBSECTION_CHECK_IF_DIRTY(hDC);
86 ret = O32_InvertRect(hDC,lprc);
87 DIBSECTION_MARK_INVALID(hDC);
88 return ret;
89}
90//******************************************************************************
91//******************************************************************************
92BOOL WIN32API StrokeAndFillPath(HDC hdc)
93{
94 DIBSECTION_CHECK_IF_DIRTY(hdc);
95 BOOL ret = O32_StrokeAndFillPath(hdc);
96 DIBSECTION_MARK_INVALID(hdc);
97 return ret;
98}
99//******************************************************************************
100//******************************************************************************
101BOOL WIN32API StrokePath(HDC hdc)
102{
103 DIBSECTION_CHECK_IF_DIRTY(hdc);
104 BOOL ret = O32_StrokePath(hdc);
105 DIBSECTION_MARK_INVALID(hdc);
106 return ret;
107}
108//******************************************************************************
109//******************************************************************************
110COLORREF WIN32API SetBkColor(HDC hdc, COLORREF crColor)
111{
112 return(O32_SetBkColor(hdc, crColor));
113}
114//******************************************************************************
115//******************************************************************************
116COLORREF WIN32API SetTextColor(HDC hdc, COLORREF crColor)
117{
118 return O32_SetTextColor(hdc, crColor);
119}
120//******************************************************************************
121//******************************************************************************
122HGDIOBJ WIN32API GetStockObject(int arg1)
123{
124 HGDIOBJ obj;
125
126 switch(arg1)
127 {
128 case DEFAULT_GUI_FONT:
129 if(NULL==hFntDefaultGui) {
130 hFntDefaultGui = CreateFontA( -9, 0, 0, 0, FW_MEDIUM, FALSE,
131 FALSE, FALSE, ANSI_CHARSET,
132 OUT_DEFAULT_PRECIS,
133 CLIP_DEFAULT_PRECIS,
134 DEFAULT_QUALITY,
135 FIXED_PITCH|FF_MODERN, "WarpSans");
136 //This object can't be deleted by applications
137 ObjSetHandleFlag(hFntDefaultGui, OBJHANDLE_FLAG_NODELETE, TRUE);
138 }
139 obj = hFntDefaultGui;
140 break;
141 default:
142 obj = O32_GetStockObject(arg1);
143 break;
144 }
145 return(obj);
146}
147//******************************************************************************
148//******************************************************************************
149HPEN WIN32API CreatePen(int fnPenStyle, int nWidth, COLORREF crColor)
150{
151 HPEN hPen;
152
153 //CB: todo: PS_DOT is different in Win32 (. . . . and not - - - -)
154 // Open32 looks like LINETYPE_SHORTDASH instead of LINETYPE_DOT!!!
155 // -> difficult to fix without performance decrease!
156
157 hPen = O32_CreatePen(fnPenStyle,nWidth,crColor);
158 if(hPen) STATS_CreatePen(hPen, fnPenStyle,nWidth,crColor);
159 return hPen;
160}
161//******************************************************************************
162//******************************************************************************
163HPEN WIN32API CreatePenIndirect(const LOGPEN * lplgpn)
164{
165 HPEN hPen;
166
167 hPen = O32_CreatePenIndirect(lplgpn);
168 if(hPen) STATS_CreatePenIndirect(hPen, lplgpn);
169 return hPen;
170}
171//******************************************************************************
172//******************************************************************************
173HPEN WIN32API ExtCreatePen(DWORD dwPenStyle, DWORD dwWidth, const LOGBRUSH *lplb,
174 DWORD dwStyleCount, const DWORD *lpStyle)
175{
176 HPEN hPen;
177
178 if(lplb) {
179 dprintf(("lbStyle %x", lplb->lbStyle));
180 dprintf(("lbColor %x", lplb->lbColor));
181 dprintf(("lbHatch %x", lplb->lbHatch));
182 }
183 hPen = O32_ExtCreatePen(dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle);
184 if(hPen) STATS_ExtCreatePen(hPen, dwPenStyle, dwWidth, lplb, dwStyleCount, lpStyle);
185 return hPen;
186}
187//******************************************************************************
188//******************************************************************************
189HBRUSH WIN32API CreatePatternBrush(HBITMAP hBitmap)
190{
191 HBRUSH hBrush;
192
193 hBrush = O32_CreatePatternBrush(hBitmap);
194 if(hBrush) STATS_CreatePatternBrush(hBrush, hBitmap);
195 return(hBrush);
196}
197//******************************************************************************
198//******************************************************************************
199HBRUSH WIN32API CreateSolidBrush(COLORREF color)
200{
201 HBRUSH hBrush;
202
203 hBrush = O32_CreateSolidBrush(color);
204 if(hBrush) STATS_CreateSolidBrush(hBrush, color);
205 return(hBrush);
206}
207//******************************************************************************
208//******************************************************************************
209HBRUSH WIN32API CreateBrushIndirect( const LOGBRUSH *pLogBrush)
210{
211 HBRUSH hBrush;
212
213 hBrush = O32_CreateBrushIndirect((LPLOGBRUSH)pLogBrush);
214 dprintf(("GDI32: CreateBrushIndirect %x %x %x returned %x", pLogBrush->lbStyle, pLogBrush->lbColor, pLogBrush->lbHatch, hBrush));
215 if(hBrush) STATS_CreateBrushIndirect(hBrush, (LPLOGBRUSH)pLogBrush);
216 return hBrush;
217}
218//******************************************************************************
219//******************************************************************************
220HBRUSH WIN32API CreateHatchBrush(int fnStyle, COLORREF clrref)
221{
222 HBRUSH hBrush;
223
224 hBrush = O32_CreateHatchBrush(fnStyle, clrref);
225 if(hBrush) STATS_CreateHatchBrush(hBrush, fnStyle, clrref);
226 return hBrush;
227}
228//******************************************************************************
229//******************************************************************************
230HBRUSH WIN32API CreateDIBPatternBrushPt( const VOID * buffer, UINT usage)
231{
232 HBRUSH hBrush;
233
234 hBrush = O32_CreateDIBPatternBrushPt(buffer, usage);
235 if(hBrush) STATS_CreateDIBPatternBrushPt(hBrush, buffer, usage);
236 return hBrush;
237}
238/*****************************************************************************
239 * Name : HBRUSH CreateDIBPatternBrush
240 * Purpose : The CreateDIBPatternBrush function creates a logical brush that
241 * has the pattern specified by the specified device-independent
242 * bitmap (DIB). The brush can subsequently be selected into any
243 * device context that is associated with a device that supports
244 * raster operations.
245 *
246 * This function is provided only for compatibility with applications
247 * written for versions of Windows earlier than 3.0. For Win32-based
248 * applications, use the CreateDIBPatternBrushPt function.
249 * Parameters: HGLOBAL hglbDIBPacked Identifies a global memory object containing
250 * a packed DIB, which consists of a BITMAPINFO structure immediately
251 * followed by an array of bytes defining the pixels of the bitmap.
252 * UINT fuColorSpec color table data
253 * Variables :
254 * Result : TRUE / FALSE
255 * Remark :
256 * Status : ODIN32 COMPLETELY UNTESTED
257 *
258 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
259 * Markus Montkowski [Wen, 1999/01/12 20:00]
260 *****************************************************************************/
261
262HBRUSH WIN32API CreateDIBPatternBrush( HGLOBAL hglbDIBPacked,
263 UINT fuColorSpec)
264{
265 BITMAPINFO *lpMem;
266 HBRUSH ret = 0;
267
268 lpMem = (BITMAPINFO *)GlobalLock(hglbDIBPacked);
269 if(NULL!=lpMem)
270 {
271 dprintf(("GDI32: CreateDIBPatternBrush (%08xh, %08xh) %x (%d,%d) bpp %d",
272 hglbDIBPacked, fuColorSpec, lpMem, lpMem->bmiHeader.biWidth,
273 lpMem->bmiHeader.biHeight, lpMem->bmiHeader.biBitCount));
274
275 ret = CreateDIBPatternBrushPt( lpMem,
276 fuColorSpec);
277 GlobalUnlock(hglbDIBPacked);
278 }
279 else {
280 dprintf(("!ERROR!: CreateDIBPatternBrush (%08xh, %08xh) -> INVALID memory handle!!",
281 hglbDIBPacked, fuColorSpec));
282 }
283 return (ret);
284}
285//******************************************************************************
286//******************************************************************************
287int WIN32API SetBkMode( HDC hdc, int mode)
288{
289 return O32_SetBkMode(hdc, mode);
290}
291//******************************************************************************
292//******************************************************************************
293COLORREF WIN32API GetPixel( HDC hdc, int x, int y)
294{
295 return O32_GetPixel(hdc, x, y);
296}
297//******************************************************************************
298//******************************************************************************
299COLORREF WIN32API SetPixel( HDC hdc, int x, int y, COLORREF color)
300{
301 return O32_SetPixel(hdc, x, y, color);
302}
303//******************************************************************************
304//Faster version of SetPixel (since it doesn't need to return the original color)
305//Just use SetPixel for now
306//******************************************************************************
307BOOL WIN32API SetPixelV(HDC arg1, int arg2, int arg3, COLORREF arg4)
308{
309 COLORREF rc;
310
311 rc = O32_SetPixel(arg1, arg2, arg3, arg4);
312 if(rc == GDI_ERROR) // || rc == COLOR_INVALID)
313 return(FALSE);
314 return(TRUE);
315}
316//******************************************************************************
317//******************************************************************************
318BOOL WIN32API GetDCOrgEx(HDC hdc, PPOINT lpPoint)
319{
320 if(lpPoint == NULL) {
321 dprintf(("WARNING: GDI32: GetDCOrgEx %x NULL", hdc));
322 return FALSE;
323 }
324 return O32_GetDCOrgEx(hdc, lpPoint);
325}
326//******************************************************************************
327//******************************************************************************
328BOOL WIN32API AbortPath(HDC hdc)
329{
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 return O32_AngleArc(arg1, arg2, arg3, arg4, arg5, arg6);
337}
338//******************************************************************************
339//******************************************************************************
340BOOL WIN32API Arc( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
341{
342 return O32_Arc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
343}
344//******************************************************************************
345//******************************************************************************
346BOOL WIN32API ArcTo( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
347{
348 return O32_ArcTo(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
349}
350//******************************************************************************
351//******************************************************************************
352BOOL WIN32API BeginPath(HDC hdc)
353{
354 return O32_BeginPath(hdc);
355}
356//******************************************************************************
357//******************************************************************************
358BOOL WIN32API Chord( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9)
359{
360 return O32_Chord(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
361}
362//******************************************************************************
363//******************************************************************************
364BOOL WIN32API CloseFigure(HDC hdc)
365{
366 return O32_CloseFigure(hdc);
367}
368//******************************************************************************
369//******************************************************************************
370BOOL WIN32API Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
371 int nBottomRect)
372{
373 dprintf(("GDI32: Ellipse %x (%d,%d)(%d,%d)", nLeftRect, nTopRect, nRightRect, nBottomRect));
374 return O32_Ellipse(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
375}
376//******************************************************************************
377//******************************************************************************
378BOOL WIN32API EndPath( HDC hdc)
379{
380 return O32_EndPath(hdc);
381}
382//******************************************************************************
383//******************************************************************************
384BOOL WIN32API Rectangle(HDC hdc, int left, int top, int right, int bottom)
385{
386 return O32_Rectangle(hdc, left, top, right, bottom);
387}
388//******************************************************************************
389//******************************************************************************
390#ifdef DEBUG
391VOID dumpROP2(INT rop2)
392{
393 CHAR *name;
394
395 switch (rop2)
396 {
397 case R2_BLACK:
398 name = "R2_BLACK";
399 break;
400
401 case R2_COPYPEN:
402 name = "R2_COPYPEN";
403 break;
404
405 case R2_MASKNOTPEN:
406 name = "R2_MASKNOTPEN";
407 break;
408
409 case R2_MASKPEN:
410 name = "R2_MASKPEN";
411 break;
412
413 case R2_MASKPENNOT:
414 name = "R2_MASKPENNOT";
415 break;
416
417 case R2_MERGENOTPEN:
418 name = "R2_MERGENOTPEN";
419 break;
420
421 case R2_MERGEPEN:
422 name = "R2_MERGEPEN";
423 break;
424
425 case R2_MERGEPENNOT:
426 name = "R2_MERGEPENNOT";
427 break;
428
429 case R2_NOP:
430 name = "R2_NOP";
431 break;
432
433 case R2_NOT:
434 name = "R2_NOT";
435 break;
436
437 case R2_NOTCOPYPEN:
438 name = "R2_NOTCOPYPEN";
439 break;
440
441 case R2_NOTMASKPEN:
442 name = "R2_NOTMASKPEN";
443 break;
444
445 case R2_NOTMERGEPEN:
446 name = "R2_NOTMERGEPEN";
447 break;
448
449 case R2_WHITE:
450 name = "R2_WHITE";
451 break;
452
453 case R2_XORPEN:
454 name = "R2_XORPEN";
455 break;
456
457 case R2_NOTXORPEN:
458 name = "R2_NOTXORPEN";
459 break;
460
461 default:
462 name = "unknown mode!!!";
463 break;
464 }
465
466 dprintf((" ROP2 mode = %s",name));
467}
468#endif
469//******************************************************************************
470//******************************************************************************
471int WIN32API SetROP2( HDC hdc, int rop2)
472{
473 #ifdef DEBUG
474 dumpROP2(rop2);
475 #endif
476 return O32_SetROP2(hdc, rop2);
477}
478//******************************************************************************
479//******************************************************************************
480BOOL WIN32API ExtFloodFill( HDC arg1, int arg2, int arg3, COLORREF arg4, UINT arg5)
481{
482 return O32_ExtFloodFill(arg1, arg2, arg3, arg4, arg5);
483}
484//******************************************************************************
485//******************************************************************************
486BOOL WIN32API FillPath( HDC arg1)
487{
488 return O32_FillPath(arg1);
489}
490//******************************************************************************
491//******************************************************************************
492BOOL WIN32API FlattenPath( HDC arg1)
493{
494 return O32_FlattenPath(arg1);
495}
496//******************************************************************************
497//******************************************************************************
498BOOL WIN32API FloodFill(HDC arg1, int arg2, int arg3, COLORREF arg4)
499{
500 return O32_FloodFill(arg1, arg2, arg3, arg4);
501}
502//******************************************************************************
503//******************************************************************************
504int WIN32API GetArcDirection( HDC arg1)
505{
506 return O32_GetArcDirection(arg1);
507}
508//******************************************************************************
509//******************************************************************************
510BOOL WIN32API GetAspectRatioFilterEx( HDC arg1, PSIZE arg2)
511{
512 return O32_GetAspectRatioFilterEx(arg1, arg2);
513}
514//******************************************************************************
515//******************************************************************************
516COLORREF WIN32API GetBkColor(HDC hdc)
517{
518 return O32_GetBkColor(hdc);
519}
520//******************************************************************************
521//******************************************************************************
522int WIN32API GetBkMode(HDC hdc)
523{
524 return O32_GetBkMode(hdc);
525}
526//******************************************************************************
527//******************************************************************************
528UINT WIN32API GetBoundsRect( HDC arg1, PRECT arg2, UINT arg3)
529{
530 return O32_GetBoundsRect(arg1, arg2, arg3);
531}
532//******************************************************************************
533//******************************************************************************
534BOOL WIN32API GetBrushOrgEx( HDC arg1, PPOINT arg2)
535{
536 return O32_GetBrushOrgEx(arg1, arg2);
537}
538//******************************************************************************
539//******************************************************************************
540BOOL WIN32API GetCurrentPositionEx( HDC hdc, PPOINT lpPoint)
541{
542 BOOL rc;
543
544 rc = O32_GetCurrentPositionEx(hdc, lpPoint);
545 dprintf(("GDI32: GetCurrentPositionEx returned %d (%d,%d)", rc, lpPoint->x, lpPoint->y));
546 return rc;
547}
548#ifdef DEBUG_LOGGING
549//******************************************************************************
550//******************************************************************************
551char *GetDeviceCapsString(int nIndex)
552{
553 switch(nIndex) {
554 case DRIVERVERSION:
555 return "DRIVERVERSION";
556 case TECHNOLOGY:
557 return "TECHNOLOGY";
558 case HORZSIZE:
559 return "HORZSIZE";
560 case VERTSIZE:
561 return "VERTSIZE";
562 case HORZRES:
563 return "HORZRES";
564 case VERTRES:
565 return "VERTRES";
566 case BITSPIXEL:
567 return "BITSPIXEL";
568 case PLANES:
569 return "PLANES";
570 case NUMBRUSHES:
571 return "NUMBRUSHES";
572 case NUMPENS:
573 return "NUMPENS";
574 case NUMMARKERS:
575 return "NUMMARKERS";
576 case NUMFONTS:
577 return "NUMFONTS";
578 case NUMCOLORS:
579 return "NUMCOLORS";
580 case PDEVICESIZE:
581 return "PDEVICESIZE";
582 case CURVECAPS:
583 return "CURVECAPS";
584 case LINECAPS:
585 return "LINECAPS";
586 case POLYGONALCAPS:
587 return "POLYGONALCAPS";
588 case TEXTCAPS:
589 return "TEXTCAPS";
590 case CLIPCAPS:
591 return "CLIPCAPS";
592 case RASTERCAPS:
593 return "RASTERCAPS";
594 case ASPECTX:
595 return "ASPECTX";
596 case ASPECTY:
597 return "ASPECTY";
598 case ASPECTXY:
599 return "ASPECTXY";
600 case LOGPIXELSX:
601 return "LOGPIXELSX";
602 case LOGPIXELSY:
603 return "LOGPIXELSY";
604 case SIZEPALETTE:
605 return "SIZEPALETTE";
606 case NUMRESERVED:
607 return "NUMRESERVED";
608 case COLORRES:
609 return "COLORRES";
610 case PHYSICALWIDTH:
611 return "PHYSICALWIDTH";
612 case PHYSICALHEIGHT:
613 return "PHYSICALHEIGHT";
614 case PHYSICALOFFSETX:
615 return "PHYSICALOFFSETX";
616 case PHYSICALOFFSETY:
617 return "PHYSICALOFFSETY";
618 case SCALINGFACTORX:
619 return "SCALINGFACTORX";
620 case SCALINGFACTORY:
621 return "SCALINGFACTORY";
622 }
623 return "unknown";
624}
625#endif
626//******************************************************************************
627//******************************************************************************
628int WIN32API GetDeviceCaps(HDC hdc, int nIndex)
629{
630 int rc;
631
632 rc = O32_GetDeviceCaps(hdc, nIndex);
633 dprintf(("GDI32: GetDeviceCaps %x %s returned %d\n", hdc, GetDeviceCapsString(nIndex), rc));
634 //SvL: 13-9-'98: NT returns -1 when using 16 bits colors, NOT 65536!
635 if(nIndex == NUMCOLORS && rc > 256)
636 return -1;
637
638 return(rc);
639}
640//******************************************************************************
641//******************************************************************************
642BOOL WIN32API GetMiterLimit( HDC arg1, float * arg2)
643{
644 return O32_GetMiterLimit(arg1, arg2);
645}
646//******************************************************************************
647//******************************************************************************
648COLORREF WIN32API GetNearestColor( HDC arg1, COLORREF arg2)
649{
650 return O32_GetNearestColor(arg1, arg2);
651}
652//******************************************************************************
653//******************************************************************************
654INT WIN32API GetPath( HDC hdc, PPOINT arg2, PBYTE arg3, int arg4)
655{
656 return O32_GetPath(hdc, arg2, arg3, arg4);
657}
658//******************************************************************************
659//******************************************************************************
660int WIN32API GetPolyFillMode( HDC hdc)
661{
662 return O32_GetPolyFillMode(hdc);
663}
664//******************************************************************************
665//******************************************************************************
666int WIN32API GetROP2( HDC hdc)
667{
668 return O32_GetROP2(hdc);
669}
670//******************************************************************************
671//******************************************************************************
672BOOL WIN32API GetRasterizerCaps(LPRASTERIZER_STATUS arg1, UINT arg2)
673{
674 return O32_GetRasterizerCaps(arg1, arg2);
675}
676//******************************************************************************
677//******************************************************************************
678UINT WIN32API GetTextAlign( HDC hdc)
679{
680 return O32_GetTextAlign(hdc);
681}
682//******************************************************************************
683//******************************************************************************
684int WIN32API GetTextCharacterExtra( HDC hdc)
685{
686 return O32_GetTextCharacterExtra(hdc);
687}
688//******************************************************************************
689//******************************************************************************
690COLORREF WIN32API GetTextColor( HDC hdc)
691{
692 return O32_GetTextColor(hdc);
693}
694//******************************************************************************
695//******************************************************************************
696BOOL WIN32API Pie(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
697 int nBottomRect, int nXRadial1, int nYRadial1, int nXRadial2,
698 int nYRadial2)
699{
700 dprintf(("GDI32: Pie %x (%d,%d)(%d,%d) (%d,%d) (%d,%d)", hdc, nLeftRect, nTopRect, nRightRect,
701 nBottomRect, nXRadial1, nYRadial1, nXRadial2, nYRadial2));
702
703 //CB: bug in O32_Pie
704 if (nXRadial1 == nXRadial2 && nYRadial1 == nYRadial2)
705 return O32_Ellipse(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect);
706 else
707 return O32_Pie(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect,nXRadial1,nYRadial1,nXRadial2,nYRadial2);
708}
709//******************************************************************************
710//******************************************************************************
711BOOL WIN32API PolyBezier( HDC arg1, const POINT * arg2, DWORD arg3)
712{
713 return O32_PolyBezier(arg1, arg2, (int)arg3);
714}
715//******************************************************************************
716//******************************************************************************
717BOOL WIN32API PolyBezierTo( HDC arg1, const POINT * arg2, DWORD arg3)
718{
719 return O32_PolyBezierTo(arg1, arg2, arg3);
720}
721//******************************************************************************
722//******************************************************************************
723BOOL WIN32API PolyDraw( HDC hdc, const POINT * arg2, const BYTE * arg3, DWORD arg4)
724{
725 return O32_PolyDraw(hdc, arg2, arg3, arg4);
726}
727//******************************************************************************
728//******************************************************************************
729BOOL WIN32API PolyPolygon( HDC hdc, const POINT *lpPoints, const INT *lpPolyCounts, UINT nCount)
730{
731#ifdef DEBUG
732 int count = 0;
733 for(int i=0;i<nCount;i++)
734 {
735 for(int j=0;j<lpPolyCounts[i];j++)
736 {
737 dprintf(("Vertex %d point (%d,%d)", i, lpPoints[count].x, lpPoints[count].y));
738 count++;
739 }
740 }
741#endif
742 return O32_PolyPolygon(hdc, lpPoints, lpPolyCounts, nCount);
743}
744//******************************************************************************
745//******************************************************************************
746BOOL WIN32API PolyPolyline( HDC hdc, const POINT * lppt, const DWORD * lpdwPolyPoints, DWORD cCount)
747{
748 return O32_PolyPolyline(hdc,lppt,lpdwPolyPoints,cCount);
749}
750//******************************************************************************
751//******************************************************************************
752BOOL WIN32API Polygon( HDC hdc, const POINT *lpPoints, int count)
753{
754 BOOL ret = FALSE;
755#ifdef DEBUG
756 if(lpPoints && count) {
757 for(int i=0;i<count;i++) {
758 dprintf(("Point (%d,%d)", lpPoints[i].x, lpPoints[i].y));
759 }
760 }
761#endif
762 return O32_Polygon(hdc, lpPoints, count);
763}
764//******************************************************************************
765//******************************************************************************
766BOOL WIN32API PtVisible( HDC hdc, int x, int y)
767{
768 dprintf(("GDI32: PtVisible %x (%d,%d)", hdc, x, y));
769 return O32_PtVisible(hdc, x, y);
770}
771//******************************************************************************
772//******************************************************************************
773BOOL WIN32API RectVisible( HDC hdc, const RECT *lpRect)
774{
775 if(lpRect == NULL) {
776 dprintf(("WARNING: GDI32: RectVisible %x lpRect == NULL!"));
777 return FALSE;
778 }
779 dprintf(("GDI32: RectVisible %x (%d,%d)(%d,%d)", hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom));
780 return O32_RectVisible(hdc, lpRect);
781}
782//******************************************************************************
783//******************************************************************************
784BOOL WIN32API RoundRect( HDC arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
785{
786 return O32_RoundRect(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
787}
788//******************************************************************************
789//******************************************************************************
790int WIN32API SetArcDirection( HDC arg1, int arg2)
791{
792 return O32_SetArcDirection(arg1, arg2);
793}
794//******************************************************************************
795//******************************************************************************
796UINT WIN32API SetBoundsRect( HDC arg1, const RECT * arg2, UINT arg3)
797{
798 return O32_SetBoundsRect(arg1, arg2, arg3);
799}
800//******************************************************************************
801//******************************************************************************
802BOOL WIN32API SetBrushOrgEx( HDC arg1, int arg2, int arg3, PPOINT arg4)
803{
804 return O32_SetBrushOrgEx(arg1, arg2, arg3, arg4);
805}
806//******************************************************************************
807//******************************************************************************
808DWORD WIN32API SetMapperFlags(HDC hdc, DWORD dwFlag)
809{
810 return O32_SetMapperFlags(hdc, dwFlag);
811}
812//******************************************************************************
813//******************************************************************************
814BOOL WIN32API SetMiterLimit(HDC hdc, float eNewLimit, float* peOldLimit)
815{
816 return O32_SetMiterLimit(hdc, eNewLimit, peOldLimit);
817}
818//******************************************************************************
819//******************************************************************************
820int WIN32API SetPolyFillMode(HDC hdc, int iPolyFillMode)
821{
822 return O32_SetPolyFillMode(hdc, iPolyFillMode);
823}
824//******************************************************************************
825//******************************************************************************
826UINT WIN32API SetTextAlign(HDC hdc, UINT fMode)
827{
828 return O32_SetTextAlign(hdc, fMode);
829}
830//******************************************************************************
831//******************************************************************************
832int WIN32API SetTextCharacterExtra(HDC hdc, int nCharExtra)
833{
834 return O32_SetTextCharacterExtra(hdc, nCharExtra);
835}
836//******************************************************************************
837//******************************************************************************
838BOOL WIN32API SetTextJustification(HDC hdc, int nBreakExtra, int nBreakCount)
839{
840 return O32_SetTextJustification(hdc, nBreakExtra, nBreakCount);
841}
842//******************************************************************************
843//******************************************************************************
844BOOL WIN32API WidenPath( HDC hdc)
845{
846 return O32_WidenPath(hdc);
847}
848//******************************************************************************
849//TODO: Sets the color adjustment values for a device context. (used to adjust
850// the input color of the src bitmap for calls of StretchBlt & StretchDIBits
851// functions when HALFTONE mode is set
852//******************************************************************************
853BOOL WIN32API SetColorAdjustment(HDC hdc, CONST COLORADJUSTMENT *lpca)
854{
855 dprintf(("GDI32: SetColorAdjustment, not implemented!(TRUE)\n"));
856 return(TRUE);
857}
858//******************************************************************************
859//Maps colors to system palette; faster way to update window (instead of redrawing)
860//We just redraw
861//******************************************************************************
862BOOL WIN32API UpdateColors(HDC hdc)
863{
864 return InvalidateRect(WindowFromDC(hdc), NULL, FALSE);
865}
866//******************************************************************************
867//******************************************************************************
868BOOL WIN32API GdiComment(HDC hdc, UINT cbSize, CONST BYTE *lpData)
869{
870 dprintf(("GDI32: GdiComment %x %d %x NOT IMPLEMENTED", hdc, cbSize, lpData));
871// return O32_GdiComment(hdc, cbSize, lpData);
872 return TRUE;
873}
874//******************************************************************************
875//******************************************************************************
876int WIN32API DrawEscape(HDC hdc, int nEscape, int cbInput, LPCSTR lpszInData)
877{
878 dprintf(("GDI32: DrawEscape, not implemented\n"));
879 return(0);
880}
881//******************************************************************************
882//******************************************************************************
883BOOL WIN32API GetColorAdjustment(HDC hdc, COLORADJUSTMENT *lpca)
884{
885 dprintf(("GDI32: GetColorAdjustment, not implemented\n"));
886 return(FALSE);
887}
888//******************************************************************************
889//******************************************************************************
890
891
892/*****************************************************************************
893 * Name : BOOL CancelDC
894 * Purpose : The CancelDC function cancels any pending operation on the
895 * specified device context (DC).
896 * Parameters: HDC hdc handle of device context
897 * Variables :
898 * Result : TRUE / FALSE
899 * Remark :
900 * Status : UNTESTED STUB
901 *
902 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
903 *****************************************************************************/
904
905BOOL WIN32API CancelDC(HDC hdc)
906{
907 dprintf(("GDI32: CancelDC(%08xh) not implemented.\n",
908 hdc));
909
910 return (FALSE);
911}
912
913/*****************************************************************************
914 * Name : BOOL CombineTransform
915 * Purpose : The CombineTransform function concatenates two world-space to
916 * page-space transformations.
917 * Parameters: LLPXFORM lLPXFORMResult address of combined transformation
918 * XFORM *lLPXFORM1 address of 1st transformation
919 * XFORM *lLPXFORM2 address of 2nd transformation
920 * Variables :
921 * Result : TRUE / FALSE
922 * Remark :
923 * Status : COMPLETELY UNTESTED
924 *
925 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
926 * Markus Montkowski [Wen, 1999/01/12 20:18]
927 *****************************************************************************/
928
929BOOL WIN32API CombineTransform(LPXFORM lLPXFORMResult,
930 CONST XFORM *lLPXFORM1,
931 CONST XFORM *lLPXFORM2)
932{
933 dprintf(("GDI32: CombineTransform(%08xh,%08xh,%08xh).\n",
934 lLPXFORMResult,
935 lLPXFORM1,
936 lLPXFORM2));
937
938 XFORM xfrm;
939 if( IsBadWritePtr( (void*)lLPXFORMResult, sizeof(XFORM)) ||
940 IsBadReadPtr( (void*)lLPXFORM1, sizeof(XFORM)) ||
941 IsBadWritePtr( (void*)lLPXFORM2, sizeof(XFORM)) )
942 return (FALSE);
943
944 // Add the translations
945 lLPXFORMResult->eDx = lLPXFORM1->eDx + lLPXFORM2->eDx;
946 lLPXFORMResult->eDy = lLPXFORM1->eDy + lLPXFORM2->eDy;
947
948 // Multiply the matrixes
949 xfrm.eM11 = lLPXFORM1->eM11 * lLPXFORM2->eM11 + lLPXFORM1->eM21 * lLPXFORM1->eM12;
950 xfrm.eM12 = lLPXFORM1->eM11 * lLPXFORM2->eM12 + lLPXFORM1->eM12 * lLPXFORM1->eM22;
951 xfrm.eM21 = lLPXFORM1->eM21 * lLPXFORM2->eM11 + lLPXFORM1->eM22 * lLPXFORM1->eM21;
952 xfrm.eM22 = lLPXFORM1->eM21 * lLPXFORM2->eM12 + lLPXFORM1->eM22 * lLPXFORM1->eM22;
953
954 // Now copy to resulting XFROM as the pt must not be distinct
955 lLPXFORMResult->eM11 = xfrm.eM11;
956 lLPXFORMResult->eM12 = xfrm.eM12;
957 lLPXFORMResult->eM21 = xfrm.eM21;
958 lLPXFORMResult->eM22 = xfrm.eM22;
959
960 return (TRUE);
961}
962
963
964/*****************************************************************************
965 * Name : BOOL FixBrushOrgEx
966 * Purpose : The FixBrushOrgEx function is not implemented in the Win32 API.
967 * It is provided for compatibility with Win32s. If called, the
968 * function does nothing, and returns FALSE.
969 * Parameters: HDC, int, int, LPPOINT
970 * Variables :
971 * Result : TRUE / FALSE
972 * Remark : not implemented in Win32
973 * Status : UNTESTED STUB
974 *
975 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
976 *****************************************************************************/
977
978BOOL WIN32API FixBrushOrgEx(HDC hdc,
979 int iDummy1,
980 int iDummy2,
981 LPPOINT lpPoint)
982{
983 dprintf(("GDI32: FixBrushOrgEx(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
984 hdc,
985 iDummy1,
986 iDummy2,
987 lpPoint));
988
989 return (FALSE);
990}
991
992
993/*****************************************************************************
994 * Name : DWORD GdiGetBatchLimit
995 * Purpose : The GdiGetBatchLimit function returns the maximum number of
996 * function calls that can be accumulated in the calling thread's
997 * current batch. The system flushes the current batch whenever
998 * this limit is exceeded.
999 * Parameters:
1000 * Variables :
1001 * Result : 1
1002 * Remark :
1003 * Status : UNTESTED STUB
1004 *
1005 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1006 *****************************************************************************/
1007
1008DWORD WIN32API GdiGetBatchLimit(VOID)
1009{
1010 dprintf(("GDI32: GdiGetBatchLimit() not implemented (1).\n"));
1011
1012 return (1);
1013}
1014
1015
1016/*****************************************************************************
1017 * Name : DWORD GdiSetBatchLimit
1018 * Purpose : The GdiSetBatchLimit function sets the maximum number of
1019 * functions that can be accumulated in the calling thread's current
1020 * batch. The system flushes the current batch whenever this limit
1021 * is exceeded.
1022 * Parameters: DWORD dwLimit
1023 * Variables :
1024 * Result :
1025 * Remark :
1026 * Status : UNTESTED STUB
1027 *
1028 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
1029 *****************************************************************************/
1030
1031DWORD WIN32API GdiSetBatchLimit(DWORD dwLimit)
1032{
1033 dprintf(("GDI32: GdiSetBatchLimit(%08xh) not implemented (1).\n",
1034 dwLimit));
1035
1036 return (1);
1037}
1038
1039
Note: See TracBrowser for help on using the repository browser.