4 * Copyright 1993 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36 #include "gdi_private.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
41 #define HGDIOBJ_32(h16) ((HGDIOBJ)(ULONG_PTR)(h16))
43 #define GDI_HEAP_SIZE 0xffe0
45 /***********************************************************************
49 static const LOGBRUSH WhiteBrush = { BS_SOLID, RGB(255,255,255), 0 };
50 static const LOGBRUSH BlackBrush = { BS_SOLID, RGB(0,0,0), 0 };
51 static const LOGBRUSH NullBrush = { BS_NULL, 0, 0 };
53 static const LOGBRUSH LtGrayBrush = { BS_SOLID, RGB(192,192,192), 0 };
54 static const LOGBRUSH GrayBrush = { BS_SOLID, RGB(128,128,128), 0 };
55 static const LOGBRUSH DkGrayBrush = { BS_SOLID, RGB(64,64,64), 0 };
57 static const LOGPEN WhitePen = { PS_SOLID, { 0, 0 }, RGB(255,255,255) };
58 static const LOGPEN BlackPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) };
59 static const LOGPEN NullPen = { PS_NULL, { 0, 0 }, 0 };
61 static const LOGBRUSH DCBrush = { BS_SOLID, RGB(255,255,255), 0 };
62 static const LOGPEN DCPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) };
64 /* reserve one extra entry for the stock default bitmap */
65 /* this is what Windows does too */
66 #define NB_STOCK_OBJECTS (STOCK_LAST+2)
68 static HGDIOBJ stock_objects[NB_STOCK_OBJECTS];
70 static SYSLEVEL GDI_level;
71 static CRITICAL_SECTION_DEBUG critsect_debug =
73 0, 0, &GDI_level.crst,
74 { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
75 0, 0, { 0, (DWORD)(__FILE__ ": GDI_level") }
77 static SYSLEVEL GDI_level = { { &critsect_debug, -1, 0, 0, 0, 0 }, 3 };
79 inline static BOOL get_bool(char *buffer)
81 return (buffer[0] == 'y' || buffer[0] == 'Y' ||
82 buffer[0] == 't' || buffer[0] == 'T' ||
87 /****************************************************************************
89 * language-independent stock fonts
93 static const LOGFONTW OEMFixedFont =
94 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET,
95 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, {'\0'} };
97 static const LOGFONTW AnsiFixedFont =
98 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
99 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, {'\0'} };
101 static const LOGFONTW AnsiVarFont =
102 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
103 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
104 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} };
106 /******************************************************************************
108 * language-dependent stock fonts
110 * 'ANSI' charset and 'DEFAULT' charset is not same.
111 * The chars in CP_ACP should be drawn with 'DEFAULT' charset.
112 * 'ANSI' charset seems to be identical with ISO-8859-1.
113 * 'DEFAULT' charset is a language-dependent charset.
115 * 'System' font seems to be an alias for language-dependent font.
119 * language-dependent stock fonts for all known charsets
120 * please see TranslateCharsetInfo (dlls/gdi/font.c) and
121 * CharsetBindingInfo (dlls/x11drv/xfont.c),
122 * and modify entries for your language if needed.
124 struct DefaultFontInfo
128 LOGFONTW DeviceDefaultFont;
129 LOGFONTW SystemFixedFont;
130 LOGFONTW DefaultGuiFont; /* Note for this font the lfHeight member should be the point size */
133 static const struct DefaultFontInfo default_fonts[] =
137 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
138 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
139 {'S','y','s','t','e','m','\0'}
141 { /* Device Default */
142 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
143 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
147 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
148 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
151 { /* DefaultGuiFont */
152 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
153 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
154 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
157 { EASTEUROPE_CHARSET,
159 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
160 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
161 {'S','y','s','t','e','m','\0'}
163 { /* Device Default */
164 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
165 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
169 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
170 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
173 { /* DefaultGuiFont */
174 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
175 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
176 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
181 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
182 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
183 {'S','y','s','t','e','m','\0'}
185 { /* Device Default */
186 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
187 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
191 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
192 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
195 { /* DefaultGuiFont */
196 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
197 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
198 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
203 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
204 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
205 {'S','y','s','t','e','m','\0'}
207 { /* Device Default */
208 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
209 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
213 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
214 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
217 { /* DefaultGuiFont */
218 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
219 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
220 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
225 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
226 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
227 {'S','y','s','t','e','m','\0'}
229 { /* Device Default */
230 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
231 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
235 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
236 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
239 { /* DefaultGuiFont */
240 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
241 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
242 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
247 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
248 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
249 {'S','y','s','t','e','m','\0'}
251 { /* Device Default */
252 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
253 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
257 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
258 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
261 { /* DefaultGuiFont */
262 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
263 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
264 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
269 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
270 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
271 {'S','y','s','t','e','m','\0'}
273 { /* Device Default */
274 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
275 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
279 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
280 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
283 { /* DefaultGuiFont */
284 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
285 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
286 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
291 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
292 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
293 {'S','y','s','t','e','m','\0'}
295 { /* Device Default */
296 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
297 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
301 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
302 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
305 { /* DefaultGuiFont */
306 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
307 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
308 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
313 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
314 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
315 {'S','y','s','t','e','m','\0'}
317 { /* Device Default */
318 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
319 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
323 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
324 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
327 { /* DefaultGuiFont */
328 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
329 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
330 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
335 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
336 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
337 {'S','y','s','t','e','m','\0'}
339 { /* Device Default */
340 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
341 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
345 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
346 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
349 { /* DefaultGuiFont */
350 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
351 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
352 {'M','S',' ','U','I',' ','G','o','t','h','i','c','\0'}
357 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
358 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
359 {'S','y','s','t','e','m','\0'}
361 { /* Device Default */
362 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
363 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
367 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
368 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
371 { /* DefaultGuiFont */
372 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
373 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
374 {'M','S',' ','S','o','n','g','\0'} /* FIXME: Is this correct? */
379 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
380 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
381 {'S','y','s','t','e','m','\0'}
383 { /* Device Default */
384 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
385 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
389 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
390 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
393 { /* DefaultGuiFont */
394 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
395 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
396 {'G','u','l','i','m','\0'},
399 { CHINESEBIG5_CHARSET,
401 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
402 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
403 {'S','y','s','t','e','m','\0'}
405 { /* Device Default */
406 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
407 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
411 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
412 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
415 { /* DefaultGuiFont */
416 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
417 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
418 {'\0'} /* FIXME - what is the native font??? */
423 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
424 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
425 {'S','y','s','t','e','m','\0'}
427 { /* Device Default */
428 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
429 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
433 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
434 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
437 { /* DefaultGuiFont */
438 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
439 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
440 {'M','S',' ','M','i','n','g','l','i','u','\0'} /* FIXME: Is this correct? */
446 /*************************************************************************
447 * __wine_make_gdi_object_system (GDI32.@)
449 * USER has to tell GDI that its system brushes and pens are non-deletable.
450 * For a description of the GDI object magics and their flags,
451 * see "Undocumented Windows" (wrong about the OBJECT_NOSYSTEM flag, though).
453 void __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set)
455 GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
457 /* touch the "system" bit of the wMagic field of a GDIOBJHDR */
459 ptr->wMagic &= ~OBJECT_NOSYSTEM;
461 ptr->wMagic |= OBJECT_NOSYSTEM;
463 GDI_ReleaseObj( handle );
466 /******************************************************************************
469 static const struct DefaultFontInfo* get_default_fonts(UINT charset)
473 for(n=0;n<(sizeof(default_fonts)/sizeof(default_fonts[0]));n++)
475 if ( default_fonts[n].charset == charset )
476 return &default_fonts[n];
479 FIXME( "unhandled charset 0x%08x - use ANSI_CHARSET for default stock objects\n", charset );
480 return &default_fonts[0];
484 /******************************************************************************
485 * get_default_charset (internal)
487 * get the language-dependent charset that can handle CP_ACP correctly.
489 static UINT get_default_charset( void )
495 csi.ciCharset = ANSI_CHARSET;
496 if ( ! TranslateCharsetInfo( (LPDWORD)uACP, &csi, TCI_SRCCODEPAGE ) )
498 FIXME( "unhandled codepage %u - use ANSI_CHARSET for default stock objects\n", uACP );
502 return csi.ciCharset;
505 static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
506 static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'};
508 /******************************************************************************
511 * get the dpi from the registry
513 static DWORD get_dpi( void )
518 if (RegOpenKeyW(HKEY_CURRENT_CONFIG, dpi_key_name, &hkey) == ERROR_SUCCESS)
520 DWORD type, size, new_dpi;
522 size = sizeof(new_dpi);
523 if(RegQueryValueExW(hkey, dpi_value_name, NULL, &type, (void *)&new_dpi, &size) == ERROR_SUCCESS)
525 if(type == REG_DWORD && new_dpi != 0)
533 /******************************************************************************
536 static HFONT create_stock_font( char const *fontName, const LOGFONTW *font, HKEY hkey )
540 char buffer[MAX_PATH];
543 if (!hkey) return CreateFontIndirectW( font );
546 sprintf(key, "%s.Height", fontName);
547 count = sizeof(buffer);
548 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
549 lf.lfHeight = atoi(buffer);
551 sprintf(key, "%s.Bold", fontName);
552 count = sizeof(buffer);
553 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
554 lf.lfWeight = get_bool(buffer) ? FW_BOLD : FW_NORMAL;
556 sprintf(key, "%s.Italic", fontName);
557 count = sizeof(buffer);
558 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
559 lf.lfItalic = get_bool(buffer);
561 sprintf(key, "%s.Underline", fontName);
562 count = sizeof(buffer);
563 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
564 lf.lfUnderline = get_bool(buffer);
566 sprintf(key, "%s.StrikeOut", fontName);
567 count = sizeof(buffer);
568 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
569 lf.lfStrikeOut = get_bool(buffer);
570 return CreateFontIndirectW( &lf );
574 /***********************************************************************
577 * Increment the reference count of a GDI object.
579 inline static void inc_ref_count( HGDIOBJ handle )
583 if ((header = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
586 GDI_ReleaseObj( handle );
591 /***********************************************************************
594 * Decrement the reference count of a GDI object.
596 inline static void dec_ref_count( HGDIOBJ handle )
600 if ((header = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
602 if (header->dwCount) header->dwCount--;
603 if (header->dwCount != 0x80000000) GDI_ReleaseObj( handle );
606 /* handle delayed DeleteObject*/
608 GDI_ReleaseObj( handle );
609 TRACE( "executing delayed DeleteObject for %p\n", handle );
610 DeleteObject( handle );
616 /***********************************************************************
619 * GDI initialization.
624 LOGFONTW default_gui_font;
625 const struct DefaultFontInfo* deffonts;
628 if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Fonts", &hkey))
631 /* create stock objects */
632 stock_objects[WHITE_BRUSH] = CreateBrushIndirect( &WhiteBrush );
633 stock_objects[LTGRAY_BRUSH] = CreateBrushIndirect( &LtGrayBrush );
634 stock_objects[GRAY_BRUSH] = CreateBrushIndirect( &GrayBrush );
635 stock_objects[DKGRAY_BRUSH] = CreateBrushIndirect( &DkGrayBrush );
636 stock_objects[BLACK_BRUSH] = CreateBrushIndirect( &BlackBrush );
637 stock_objects[NULL_BRUSH] = CreateBrushIndirect( &NullBrush );
639 stock_objects[WHITE_PEN] = CreatePenIndirect( &WhitePen );
640 stock_objects[BLACK_PEN] = CreatePenIndirect( &BlackPen );
641 stock_objects[NULL_PEN] = CreatePenIndirect( &NullPen );
643 stock_objects[DEFAULT_PALETTE] = PALETTE_Init();
644 stock_objects[DEFAULT_BITMAP] = CreateBitmap( 1, 1, 1, 1, NULL );
646 /* language-independent stock fonts */
647 stock_objects[OEM_FIXED_FONT] = create_stock_font( "OEMFixed", &OEMFixedFont, hkey );
648 stock_objects[ANSI_FIXED_FONT] = create_stock_font( "AnsiFixed", &AnsiFixedFont, hkey );
649 stock_objects[ANSI_VAR_FONT] = create_stock_font( "AnsiVar", &AnsiVarFont, hkey );
651 /* language-dependent stock fonts */
652 deffonts = get_default_fonts(get_default_charset());
653 stock_objects[SYSTEM_FONT] = create_stock_font( "System", &deffonts->SystemFont, hkey );
654 stock_objects[DEVICE_DEFAULT_FONT] = create_stock_font( "DeviceDefault", &deffonts->DeviceDefaultFont, hkey );
655 stock_objects[SYSTEM_FIXED_FONT] = create_stock_font( "SystemFixed", &deffonts->SystemFixedFont, hkey );
657 /* For the default gui font, we use the lfHeight member in deffonts as a place-holder
658 for the point size so we must convert this into a true height */
659 memcpy(&default_gui_font, &deffonts->DefaultGuiFont, sizeof(default_gui_font));
660 default_gui_font.lfHeight = -MulDiv(default_gui_font.lfHeight, get_dpi(), 72);
661 stock_objects[DEFAULT_GUI_FONT] = create_stock_font( "DefaultGui", &default_gui_font, hkey );
663 stock_objects[DC_BRUSH] = CreateBrushIndirect( &DCBrush );
664 stock_objects[DC_PEN] = CreatePenIndirect( &DCPen );
666 /* clear the NOSYSTEM bit on all stock objects*/
667 for (i = 0; i < NB_STOCK_OBJECTS; i++)
669 if (!stock_objects[i])
671 if (i == 9) continue; /* there's no stock object 9 */
672 ERR( "could not create stock object %d\n", i );
675 __wine_make_gdi_object_system( stock_objects[i], TRUE );
678 if (hkey) RegCloseKey( hkey );
685 #define FIRST_LARGE_HANDLE 16
686 #define MAX_LARGE_HANDLES ((GDI_HEAP_SIZE >> 2) - FIRST_LARGE_HANDLE)
687 static GDIOBJHDR *large_handles[MAX_LARGE_HANDLES];
688 static int next_large_handle;
690 /***********************************************************************
693 * Allocate a GDI handle from the large heap. Helper for GDI_AllocObject
695 inline static GDIOBJHDR *alloc_large_heap( WORD size, HGDIOBJ *handle )
700 for (i = next_large_handle + 1; i < MAX_LARGE_HANDLES; i++)
701 if (!large_handles[i]) goto found;
702 for (i = 0; i <= next_large_handle; i++)
703 if (!large_handles[i]) goto found;
708 if ((obj = HeapAlloc( GetProcessHeap(), 0, size )))
710 large_handles[i] = obj;
711 *handle = (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2);
712 next_large_handle = i;
718 /***********************************************************************
721 void *GDI_AllocObject( WORD size, WORD magic, HGDIOBJ *handle, const struct gdi_obj_funcs *funcs )
723 GDIOBJHDR *obj = NULL;
725 _EnterSysLevel( &GDI_level );
726 if (!(obj = alloc_large_heap( size, handle ))) goto error;
728 obj->wMagic = magic|OBJECT_NOSYSTEM;
733 TRACE("(%p): enter %ld\n", *handle, GDI_level.crst.RecursionCount);
737 _LeaveSysLevel( &GDI_level );
743 /***********************************************************************
746 * The object ptr must have been obtained with GDI_GetObjPtr.
747 * The new pointer must be released with GDI_ReleaseObj.
749 void *GDI_ReallocObject( WORD size, HGDIOBJ handle, void *object )
751 void *new_ptr = NULL;
754 i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
755 if (i >= 0 && i < MAX_LARGE_HANDLES && large_handles[i])
757 new_ptr = HeapReAlloc( GetProcessHeap(), 0, large_handles[i], size );
758 if (new_ptr) large_handles[i] = new_ptr;
760 else ERR( "Invalid handle %p\n", handle );
763 TRACE("(%p): leave %ld\n", handle, GDI_level.crst.RecursionCount);
764 _LeaveSysLevel( &GDI_level );
770 /***********************************************************************
773 BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
775 GDIOBJHDR *object = ptr;
778 object->wMagic = 0; /* Mark it as invalid */
779 object->funcs = NULL;
780 i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
781 if (i >= 0 && i < MAX_LARGE_HANDLES && large_handles[i])
783 HeapFree( GetProcessHeap(), 0, large_handles[i] );
784 large_handles[i] = NULL;
786 else ERR( "Invalid handle %p\n", handle );
787 TRACE("(%p): leave %ld\n", handle, GDI_level.crst.RecursionCount);
788 _LeaveSysLevel( &GDI_level );
793 /***********************************************************************
796 * Return a pointer to the GDI object associated to the handle.
797 * Return NULL if the object has the wrong magic number.
798 * The object must be released with GDI_ReleaseObj.
800 void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
802 GDIOBJHDR *ptr = NULL;
805 _EnterSysLevel( &GDI_level );
807 i = ((UINT_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
808 if (i >= 0 && i < MAX_LARGE_HANDLES)
810 ptr = large_handles[i];
811 if (ptr && (magic != MAGIC_DONTCARE) && (GDIMAGIC(ptr->wMagic) != magic)) ptr = NULL;
816 _LeaveSysLevel( &GDI_level );
817 WARN( "Invalid handle %p\n", handle );
819 else TRACE("(%p): enter %ld\n", handle, GDI_level.crst.RecursionCount);
825 /***********************************************************************
829 void GDI_ReleaseObj( HGDIOBJ handle )
831 TRACE("(%p): leave %ld\n", handle, GDI_level.crst.RecursionCount);
832 _LeaveSysLevel( &GDI_level );
836 /***********************************************************************
839 void GDI_CheckNotLock(void)
841 _CheckNotSysLevel( &GDI_level );
845 /***********************************************************************
846 * DeleteObject (GDI32.@)
848 * Delete a Gdi object.
851 * obj [I] Gdi object to delete
854 * Success: TRUE. If obj was not returned from GetStockObject(), any resources
855 * it consumed are released.
856 * Failure: FALSE, if obj is not a valid Gdi object, or is currently selected
859 BOOL WINAPI DeleteObject( HGDIOBJ obj )
861 /* Check if object is valid */
864 if (HIWORD(obj)) return FALSE;
866 if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
868 if (!(header->wMagic & OBJECT_NOSYSTEM)
869 && (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC))
871 TRACE("Preserving system object %p\n", obj);
872 GDI_ReleaseObj( obj );
878 DC *dc = DC_GetDCPtr(header->hdcs->hdc);
879 struct hdc_list *tmp;
881 TRACE("hdc %p has interest in %p\n", header->hdcs->hdc, obj);
884 if(dc->funcs->pDeleteObject)
885 dc->funcs->pDeleteObject( dc->physDev, obj );
886 GDI_ReleaseObj( header->hdcs->hdc );
889 header->hdcs = header->hdcs->next;
890 HeapFree(GetProcessHeap(), 0, tmp);
895 TRACE("delayed for %p because object in use, count %ld\n", obj, header->dwCount );
896 header->dwCount |= 0x80000000; /* mark for delete */
897 GDI_ReleaseObj( obj );
905 if (header->funcs && header->funcs->pDeleteObject)
906 return header->funcs->pDeleteObject( obj, header );
908 GDI_ReleaseObj( obj );
912 /***********************************************************************
913 * GDI_hdc_using_object
915 * Call this if the dc requires DeleteObject notification
917 BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc)
920 struct hdc_list **pphdc;
922 TRACE("obj %p hdc %p\n", obj, hdc);
924 if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
926 if (!(header->wMagic & OBJECT_NOSYSTEM) &&
927 (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC))
933 for(pphdc = &header->hdcs; *pphdc; pphdc = &(*pphdc)->next)
934 if((*pphdc)->hdc == hdc)
938 *pphdc = HeapAlloc(GetProcessHeap(), 0, sizeof(**pphdc));
940 (*pphdc)->next = NULL;
947 /***********************************************************************
948 * GDI_hdc_not_using_object
951 BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc)
954 struct hdc_list *phdc, **prev;
956 TRACE("obj %p hdc %p\n", obj, hdc);
958 if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
960 if (!(header->wMagic & OBJECT_NOSYSTEM) &&
961 (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC))
968 prev = &header->hdcs;
971 if(phdc->hdc == hdc) {
973 HeapFree(GetProcessHeap(), 0, phdc);
985 /***********************************************************************
986 * GetStockObject (GDI32.@)
988 HGDIOBJ WINAPI GetStockObject( INT obj )
991 if ((obj < 0) || (obj >= NB_STOCK_OBJECTS)) return 0;
992 ret = stock_objects[obj];
993 TRACE("returning %p\n", ret );
998 /***********************************************************************
1001 INT16 WINAPI GetObject16( HGDIOBJ16 handle16, INT16 count, LPVOID buffer )
1004 HGDIOBJ handle = HGDIOBJ_32( handle16 );
1007 TRACE("%p %d %p\n", handle, count, buffer );
1008 if (!count) return 0;
1010 if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
1012 if (ptr->funcs && ptr->funcs->pGetObject16)
1013 result = ptr->funcs->pGetObject16( handle, ptr, count, buffer );
1015 SetLastError( ERROR_INVALID_HANDLE );
1017 GDI_ReleaseObj( handle );
1022 /***********************************************************************
1023 * GetObjectA (GDI32.@)
1025 INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
1029 TRACE("%p %d %p\n", handle, count, buffer );
1031 if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
1033 if (ptr->funcs && ptr->funcs->pGetObjectA)
1034 result = ptr->funcs->pGetObjectA( handle, ptr, count, buffer );
1036 SetLastError( ERROR_INVALID_HANDLE );
1038 GDI_ReleaseObj( handle );
1042 /***********************************************************************
1043 * GetObjectW (GDI32.@)
1045 INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
1049 TRACE("%p %d %p\n", handle, count, buffer );
1051 if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
1053 if (ptr->funcs && ptr->funcs->pGetObjectW)
1054 result = ptr->funcs->pGetObjectW( handle, ptr, count, buffer );
1056 SetLastError( ERROR_INVALID_HANDLE );
1058 GDI_ReleaseObj( handle );
1062 /***********************************************************************
1063 * GetObjectType (GDI32.@)
1065 DWORD WINAPI GetObjectType( HGDIOBJ handle )
1069 TRACE("%p\n", handle );
1071 if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
1073 SetLastError( ERROR_INVALID_HANDLE );
1077 switch(GDIMAGIC(ptr->wMagic))
1086 result = OBJ_BITMAP;
1095 result = OBJ_REGION;
1101 result = OBJ_METADC;
1103 case METAFILE_MAGIC:
1104 result = OBJ_METAFILE;
1106 case METAFILE_DC_MAGIC:
1107 result = OBJ_METADC;
1109 case ENHMETAFILE_MAGIC:
1110 result = OBJ_ENHMETAFILE;
1112 case ENHMETAFILE_DC_MAGIC:
1113 result = OBJ_ENHMETADC;
1115 case MEMORY_DC_MAGIC:
1119 FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr->wMagic) );
1122 GDI_ReleaseObj( handle );
1126 /***********************************************************************
1127 * GetCurrentObject (GDI32.@)
1129 * Get the currently selected object of a given type in a device context.
1132 * hdc [I] Device context to get the current object from
1133 * type [I] Type of current object to get (OBJ_* defines from "wingdi.h")
1136 * Success: The current object of the given type selected in hdc.
1137 * Failure: A NULL handle.
1140 * - only the following object types are supported:
1147 HGDIOBJ WINAPI GetCurrentObject(HDC hdc,UINT type)
1150 DC * dc = DC_GetDCPtr( hdc );
1155 case OBJ_PEN: ret = dc->hPen; break;
1156 case OBJ_BRUSH: ret = dc->hBrush; break;
1157 case OBJ_PAL: ret = dc->hPalette; break;
1158 case OBJ_FONT: ret = dc->hFont; break;
1159 case OBJ_BITMAP: ret = dc->hBitmap; break;
1161 /* the SDK only mentions those above */
1162 FIXME("(%p,%d): unknown type.\n",hdc,type);
1165 GDI_ReleaseObj( hdc );
1171 /***********************************************************************
1172 * SelectObject (GDI32.@)
1174 * Select a Gdi object into a device context.
1177 * hdc [I] Device context to associate the object with
1178 * hObj [I] Gdi object to associate with hdc
1181 * Success: A non-NULL handle representing the previously selected object of
1182 * the same type as hObj.
1183 * Failure: A NULL object. If hdc is invalid, GetLastError() returns ERROR_INVALID_HANDLE.
1184 * if hObj is not a valid object handle, no last error is set. In either
1185 * case, hdc is unaffected by the call.
1187 HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
1193 TRACE( "(%p,%p)\n", hdc, hObj );
1195 if (!(dc = DC_GetDCPtr( hdc )))
1196 SetLastError( ERROR_INVALID_HANDLE );
1199 GDI_ReleaseObj( hdc );
1201 header = GDI_GetObjPtr( hObj, MAGIC_DONTCARE );
1204 if (header->funcs && header->funcs->pSelectObject)
1206 ret = header->funcs->pSelectObject( hObj, header, hdc );
1207 if (ret && ret != hObj && (INT)ret > COMPLEXREGION)
1209 inc_ref_count( hObj );
1210 dec_ref_count( ret );
1213 GDI_ReleaseObj( hObj );
1220 /***********************************************************************
1221 * UnrealizeObject (GDI32.@)
1223 BOOL WINAPI UnrealizeObject( HGDIOBJ obj )
1226 /* Check if object is valid */
1228 GDIOBJHDR * header = GDI_GetObjPtr( obj, MAGIC_DONTCARE );
1229 if (!header) return FALSE;
1231 TRACE("%p\n", obj );
1233 /* Unrealize object */
1235 if (header->funcs && header->funcs->pUnrealizeObject)
1236 result = header->funcs->pUnrealizeObject( obj, header );
1238 GDI_ReleaseObj( obj );
1243 /* Solid colors to enumerate */
1244 static const COLORREF solid_colors[] =
1245 { RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff),
1246 RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00),
1247 RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00),
1248 RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff),
1249 RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00),
1250 RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80),
1251 RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
1252 RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
1256 /***********************************************************************
1257 * EnumObjects (GDI32.@)
1259 INT WINAPI EnumObjects( HDC hdc, INT nObjType,
1260 GOBJENUMPROC lpEnumFunc, LPARAM lParam )
1267 TRACE("%p %d %p %08lx\n", hdc, nObjType, lpEnumFunc, lParam );
1271 /* Enumerate solid pens */
1272 for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
1274 pen.lopnStyle = PS_SOLID;
1275 pen.lopnWidth.x = 1;
1276 pen.lopnWidth.y = 0;
1277 pen.lopnColor = solid_colors[i];
1278 retval = lpEnumFunc( &pen, lParam );
1279 TRACE("solid pen %08lx, ret=%d\n",
1280 solid_colors[i], retval);
1286 /* Enumerate solid brushes */
1287 for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
1289 brush.lbStyle = BS_SOLID;
1290 brush.lbColor = solid_colors[i];
1292 retval = lpEnumFunc( &brush, lParam );
1293 TRACE("solid brush %08lx, ret=%d\n",
1294 solid_colors[i], retval);
1298 /* Now enumerate hatched brushes */
1299 if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++)
1301 brush.lbStyle = BS_HATCHED;
1302 brush.lbColor = RGB(0,0,0);
1304 retval = lpEnumFunc( &brush, lParam );
1305 TRACE("hatched brush %d, ret=%d\n",
1312 /* FIXME: implement Win32 types */
1313 WARN("(%d): Invalid type\n", nObjType );
1320 /***********************************************************************
1321 * IsGDIObject (GDI.462)
1323 * returns type of object if valid (W95 system programming secrets p. 264-5)
1325 BOOL16 WINAPI IsGDIObject16( HGDIOBJ16 handle16 )
1328 HGDIOBJ handle = HGDIOBJ_32( handle16 );
1330 GDIOBJHDR *object = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
1333 magic = GDIMAGIC(object->wMagic) - PEN_MAGIC + 1;
1334 GDI_ReleaseObj( handle );
1340 /***********************************************************************
1341 * SetObjectOwner (GDI32.@)
1343 void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner )
1349 /***********************************************************************
1350 * MakeObjectPrivate (GDI.463)
1352 * What does that mean ?
1353 * Some little docu can be found in "Undocumented Windows",
1354 * but this is basically useless.
1355 * At least we know that this flags the GDI object's wMagic
1356 * with 0x2000 (OBJECT_PRIVATE), so we just do it.
1357 * But Wine doesn't react on that yet.
1359 void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle16, BOOL16 private )
1361 HGDIOBJ handle = HGDIOBJ_32( handle16 );
1362 GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
1365 ERR("invalid GDI object %p !\n", handle);
1368 ptr->wMagic |= OBJECT_PRIVATE;
1369 GDI_ReleaseObj( handle );
1373 /***********************************************************************
1374 * GdiFlush (GDI32.@)
1376 BOOL WINAPI GdiFlush(void)
1378 return TRUE; /* FIXME */
1382 /***********************************************************************
1383 * GdiGetBatchLimit (GDI32.@)
1385 DWORD WINAPI GdiGetBatchLimit(void)
1387 return 1; /* FIXME */
1391 /***********************************************************************
1392 * GdiSetBatchLimit (GDI32.@)
1394 DWORD WINAPI GdiSetBatchLimit( DWORD limit )
1396 return 1; /* FIXME */
1400 /***********************************************************************
1401 * GdiSeeGdiDo (GDI.452)
1403 DWORD WINAPI GdiSeeGdiDo16( WORD wReqType, WORD wParam1, WORD wParam2,
1410 case 0x0001: /* LocalAlloc */
1411 WARN("LocalAlloc16(%x, %x): ignoring\n", wParam1, wParam3);
1414 case 0x0002: /* LocalFree */
1415 WARN("LocalFree16(%x): ignoring\n", wParam1);
1418 case 0x0003: /* LocalCompact */
1419 WARN("LocalCompact16(%x): ignoring\n", wParam3);
1420 ret = 65000; /* lie about the amount of free space */
1422 case 0x0103: /* LocalHeap */
1423 WARN("LocalHeap16(): ignoring\n");
1426 WARN("(wReqType=%04x): Unknown\n", wReqType);
1432 /***********************************************************************
1433 * GdiSignalProc32 (GDI.610)
1435 WORD WINAPI GdiSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
1436 DWORD dwFlags, HMODULE16 hModule )
1441 /***********************************************************************
1442 * GdiInit2 (GDI.403)
1444 * See "Undocumented Windows"
1448 * h2 [I] global data
1450 HANDLE16 WINAPI GdiInit216( HANDLE16 h1, HANDLE16 h2 )
1452 FIXME("(%04x, %04x), stub.\n", h1, h2);
1454 return 0xffff; /* undefined return value */
1455 return h1; /* FIXME: should be the memory handle of h1 */
1458 /***********************************************************************
1459 * FinalGdiInit (GDI.405)
1461 void WINAPI FinalGdiInit16( HBRUSH16 hPattern /* [in] fill pattern of desktop */ )
1465 /***********************************************************************
1466 * GdiFreeResources (GDI.609)
1468 WORD WINAPI GdiFreeResources16( DWORD reserve )
1470 return 90; /* lie about it, it shouldn't matter */
1474 /*******************************************************************
1475 * GetColorAdjustment [GDI32.@]
1479 BOOL WINAPI GetColorAdjustment(HDC hdc, LPCOLORADJUSTMENT lpca)
1481 FIXME("GetColorAdjustment, stub\n");
1485 /*******************************************************************
1486 * GdiComment [GDI32.@]
1490 BOOL WINAPI GdiComment(HDC hdc, UINT cbSize, const BYTE *lpData)
1492 DC *dc = DC_GetDCPtr(hdc);
1496 if (dc->funcs->pGdiComment)
1497 ret = dc->funcs->pGdiComment( dc->physDev, cbSize, lpData );
1499 GDI_ReleaseObj( hdc );
1503 /*******************************************************************
1504 * SetColorAdjustment [GDI32.@]
1508 BOOL WINAPI SetColorAdjustment(HDC hdc, const COLORADJUSTMENT* lpca)
1510 FIXME("SetColorAdjustment, stub\n");