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 /* FIXME: these should perhaps be BS_HATCHED, at least for 1 bitperpixel */
54 static const LOGBRUSH LtGrayBrush
= { BS_SOLID
, RGB(192,192,192), 0 };
55 static const LOGBRUSH GrayBrush
= { BS_SOLID
, RGB(128,128,128), 0 };
57 /* This is BS_HATCHED, for 1 bitperpixel. This makes the spray work in pbrush */
58 /* See HatchBrushes in x11drv for the HS_DIAGCROSS+1 hack */
59 static const LOGBRUSH DkGrayBrush
= { BS_HATCHED
, RGB(0,0,0), (HS_DIAGCROSS
+1) };
61 static const LOGPEN WhitePen
= { PS_SOLID
, { 0, 0 }, RGB(255,255,255) };
62 static const LOGPEN BlackPen
= { PS_SOLID
, { 0, 0 }, RGB(0,0,0) };
63 static const LOGPEN NullPen
= { PS_NULL
, { 0, 0 }, 0 };
65 static const LOGBRUSH DCBrush
= { BS_SOLID
, RGB(255,255,255), 0 };
66 static const LOGPEN DCPen
= { PS_SOLID
, { 0, 0 }, RGB(0,0,0) };
68 /* reserve one extra entry for the stock default bitmap */
69 /* this is what Windows does too */
70 #define NB_STOCK_OBJECTS (STOCK_LAST+2)
72 static HGDIOBJ stock_objects
[NB_STOCK_OBJECTS
];
74 static SYSLEVEL GDI_level
;
75 static CRITICAL_SECTION_DEBUG critsect_debug
=
77 0, 0, &GDI_level
.crst
,
78 { &critsect_debug
.ProcessLocksList
, &critsect_debug
.ProcessLocksList
},
79 0, 0, { 0, (DWORD
)(__FILE__
": GDI_level") }
81 static SYSLEVEL GDI_level
= { { &critsect_debug
, -1, 0, 0, 0, 0 }, 3 };
83 static WORD GDI_HeapSel
;
85 inline static BOOL
get_bool(char *buffer
)
87 return (buffer
[0] == 'y' || buffer
[0] == 'Y' ||
88 buffer
[0] == 't' || buffer
[0] == 'T' ||
93 /****************************************************************************
95 * language-independent stock fonts
99 static const LOGFONTW OEMFixedFont
=
100 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, OEM_CHARSET
,
101 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, {'\0'} };
103 static const LOGFONTW AnsiFixedFont
=
104 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
105 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, {'\0'} };
107 static const LOGFONTW AnsiVarFont
=
108 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
109 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
110 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} };
112 /******************************************************************************
114 * language-dependent stock fonts
116 * 'ANSI' charset and 'DEFAULT' charset is not same.
117 * The chars in CP_ACP should be drawn with 'DEFAULT' charset.
118 * 'ANSI' charset seems to be identical with ISO-8859-1.
119 * 'DEFAULT' charset is a language-dependent charset.
121 * 'System' font seems to be an alias for language-dependent font.
125 * language-dependenet stock fonts for all known charsets
126 * please see TranslateCharsetInfo (objects/font.c) and
127 * CharsetBindingInfo (graphics/x11drv/xfont.c),
128 * and modify entries for your language if needed.
130 struct DefaultFontInfo
134 LOGFONTW DeviceDefaultFont
;
135 LOGFONTW SystemFixedFont
;
136 LOGFONTW DefaultGuiFont
;
139 static const struct DefaultFontInfo default_fonts
[] =
143 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
144 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
145 {'S','y','s','t','e','m','\0'}
147 { /* Device Default */
148 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
149 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
153 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
154 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
157 { /* DefaultGuiFont */
158 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
159 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
160 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
163 { EASTEUROPE_CHARSET
,
165 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
166 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
167 {'S','y','s','t','e','m','\0'}
169 { /* Device Default */
170 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
171 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
175 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
176 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
179 { /* DefaultGuiFont */
180 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
181 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
182 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
187 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
188 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
189 {'S','y','s','t','e','m','\0'}
191 { /* Device Default */
192 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
193 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
197 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
198 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
201 { /* DefaultGuiFont */
202 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
203 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
204 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
209 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
210 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
211 {'S','y','s','t','e','m','\0'}
213 { /* Device Default */
214 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
215 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
219 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
220 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
223 { /* DefaultGuiFont */
224 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
225 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
226 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
231 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
232 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
233 {'S','y','s','t','e','m','\0'}
235 { /* Device Default */
236 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
237 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
241 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
242 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
245 { /* DefaultGuiFont */
246 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
247 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
248 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
253 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
254 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
255 {'S','y','s','t','e','m','\0'}
257 { /* Device Default */
258 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
259 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
263 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
264 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
267 { /* DefaultGuiFont */
268 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
269 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
270 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
275 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
276 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
277 {'S','y','s','t','e','m','\0'}
279 { /* Device Default */
280 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
281 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
285 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
286 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
289 { /* DefaultGuiFont */
290 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
291 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
292 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
297 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
298 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
299 {'S','y','s','t','e','m','\0'}
301 { /* Device Default */
302 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
303 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
307 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
308 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
311 { /* DefaultGuiFont */
312 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
313 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
314 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
319 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
320 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
321 {'S','y','s','t','e','m','\0'}
323 { /* Device Default */
324 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
325 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
329 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
330 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
333 { /* DefaultGuiFont */
334 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
335 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
336 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
341 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
342 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
343 {'S','y','s','t','e','m','\0'}
345 { /* Device Default */
346 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
347 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
351 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
352 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
355 { /* DefaultGuiFont */
356 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
357 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
358 {'M','S',' ','U','I',' ','G','o','t','h','i','c','\0'}
363 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
364 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
365 {'S','y','s','t','e','m','\0'}
367 { /* Device Default */
368 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
369 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
373 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
374 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
377 { /* DefaultGuiFont */
378 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
379 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
380 {'M','S',' ','S','o','n','g','\0'} /* FIXME: Is this correct? */
385 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
386 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
387 {'S','y','s','t','e','m','\0'}
389 { /* Device Default */
390 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
391 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
395 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
396 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
399 { /* DefaultGuiFont */
400 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
401 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
402 {'G','u','l','i','m'},
405 { CHINESEBIG5_CHARSET
,
407 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
408 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
409 {'S','y','s','t','e','m','\0'}
411 { /* Device Default */
412 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
413 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
417 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
418 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
421 { /* DefaultGuiFont */
422 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
423 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
424 {'\0'} /* FIXME - what is the native font??? */
429 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
430 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
431 {'S','y','s','t','e','m','\0'}
433 { /* Device Default */
434 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
435 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
439 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
440 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
443 { /* DefaultGuiFont */
444 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
445 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
446 {'M','S',' ','M','i','n','g','l','i','u','\0'} /* FIXME: Is this correct? */
452 /******************************************************************************
455 static const struct DefaultFontInfo
* get_default_fonts(UINT charset
)
459 for(n
=0;n
<(sizeof(default_fonts
)/sizeof(default_fonts
[0]));n
++)
461 if ( default_fonts
[n
].charset
== charset
)
462 return &default_fonts
[n
];
465 FIXME( "unhandled charset 0x%08x - use ANSI_CHARSET for default stock objects\n", charset
);
466 return &default_fonts
[0];
470 /******************************************************************************
471 * get_default_charset (internal)
473 * get the language-dependent charset that can handle CP_ACP correctly.
475 static UINT
get_default_charset( void )
481 csi
.ciCharset
= ANSI_CHARSET
;
482 if ( ! TranslateCharsetInfo( (LPDWORD
)uACP
, &csi
, TCI_SRCCODEPAGE
) )
484 FIXME( "unhandled codepage %u - use ANSI_CHARSET for default stock objects\n", uACP
);
488 return csi
.ciCharset
;
492 /******************************************************************************
495 static HFONT
create_stock_font( char const *fontName
, const LOGFONTW
*font
, HKEY hkey
)
499 char buffer
[MAX_PATH
];
502 if (!hkey
) return CreateFontIndirectW( font
);
505 sprintf(key
, "%s.Height", fontName
);
506 count
= sizeof(buffer
);
507 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
508 lf
.lfHeight
= atoi(buffer
);
510 sprintf(key
, "%s.Bold", fontName
);
511 count
= sizeof(buffer
);
512 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
513 lf
.lfWeight
= get_bool(buffer
) ? FW_BOLD
: FW_NORMAL
;
515 sprintf(key
, "%s.Italic", fontName
);
516 count
= sizeof(buffer
);
517 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
518 lf
.lfItalic
= get_bool(buffer
);
520 sprintf(key
, "%s.Underline", fontName
);
521 count
= sizeof(buffer
);
522 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
523 lf
.lfUnderline
= get_bool(buffer
);
525 sprintf(key
, "%s.StrikeOut", fontName
);
526 count
= sizeof(buffer
);
527 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
528 lf
.lfStrikeOut
= get_bool(buffer
);
529 return CreateFontIndirectW( &lf
);
533 #define TRACE_SEC(handle,text) \
534 TRACE("(%p): " text " %ld\n", (handle), GDI_level.crst.RecursionCount)
537 /***********************************************************************
540 * Increment the reference count of a GDI object.
542 inline static void inc_ref_count( HGDIOBJ handle
)
546 if ((header
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
)))
549 GDI_ReleaseObj( handle
);
554 /***********************************************************************
557 * Decrement the reference count of a GDI object.
559 inline static void dec_ref_count( HGDIOBJ handle
)
563 if ((header
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
)))
565 if (header
->dwCount
) header
->dwCount
--;
566 if (header
->dwCount
!= 0x80000000) GDI_ReleaseObj( handle
);
569 /* handle delayed DeleteObject*/
571 GDI_ReleaseObj( handle
);
572 TRACE( "executing delayed DeleteObject for %p\n", handle
);
573 DeleteObject( handle
);
579 /***********************************************************************
582 * GDI initialization.
586 HINSTANCE16 instance
;
589 const struct DefaultFontInfo
* deffonts
;
592 if (RegOpenKeyA(HKEY_LOCAL_MACHINE
, "Software\\Wine\\Wine\\Config\\Tweak.Fonts", &hkey
))
595 /* create GDI heap */
596 if ((instance
= LoadLibrary16( "GDI.EXE" )) >= 32) GDI_HeapSel
= instance
| 7;
598 /* create stock objects */
599 stock_objects
[WHITE_BRUSH
] = CreateBrushIndirect( &WhiteBrush
);
600 stock_objects
[LTGRAY_BRUSH
] = CreateBrushIndirect( &LtGrayBrush
);
601 stock_objects
[GRAY_BRUSH
] = CreateBrushIndirect( &GrayBrush
);
602 stock_objects
[DKGRAY_BRUSH
] = CreateBrushIndirect( &DkGrayBrush
);
603 stock_objects
[BLACK_BRUSH
] = CreateBrushIndirect( &BlackBrush
);
604 stock_objects
[NULL_BRUSH
] = CreateBrushIndirect( &NullBrush
);
606 stock_objects
[WHITE_PEN
] = CreatePenIndirect( &WhitePen
);
607 stock_objects
[BLACK_PEN
] = CreatePenIndirect( &BlackPen
);
608 stock_objects
[NULL_PEN
] = CreatePenIndirect( &NullPen
);
610 stock_objects
[DEFAULT_PALETTE
] = PALETTE_Init();
611 stock_objects
[DEFAULT_BITMAP
] = CreateBitmap( 1, 1, 1, 1, NULL
);
613 /* language-independent stock fonts */
614 stock_objects
[OEM_FIXED_FONT
] = create_stock_font( "OEMFixed", &OEMFixedFont
, hkey
);
615 stock_objects
[ANSI_FIXED_FONT
] = create_stock_font( "AnsiFixed", &AnsiFixedFont
, hkey
);
616 stock_objects
[ANSI_VAR_FONT
] = create_stock_font( "AnsiVar", &AnsiVarFont
, hkey
);
618 /* language-dependent stock fonts */
619 deffonts
= get_default_fonts(get_default_charset());
620 stock_objects
[SYSTEM_FONT
] = create_stock_font( "System", &deffonts
->SystemFont
, hkey
);
621 stock_objects
[DEVICE_DEFAULT_FONT
] = create_stock_font( "DeviceDefault", &deffonts
->DeviceDefaultFont
, hkey
);
622 stock_objects
[SYSTEM_FIXED_FONT
] = create_stock_font( "SystemFixed", &deffonts
->SystemFixedFont
, hkey
);
623 stock_objects
[DEFAULT_GUI_FONT
] = create_stock_font( "DefaultGui", &deffonts
->DefaultGuiFont
, hkey
);
625 stock_objects
[DC_BRUSH
] = CreateBrushIndirect( &DCBrush
);
626 stock_objects
[DC_PEN
] = CreatePenIndirect( &DCPen
);
628 /* clear the NOSYSTEM bit on all stock objects*/
629 for (i
= 0; i
< NB_STOCK_OBJECTS
; i
++)
631 if (!stock_objects
[i
])
633 if (i
== 9) continue; /* there's no stock object 9 */
634 ERR( "could not create stock object %d\n", i
);
637 ptr
= GDI_GetObjPtr( stock_objects
[i
], MAGIC_DONTCARE
);
638 ptr
->wMagic
&= ~OBJECT_NOSYSTEM
;
639 GDI_ReleaseObj( stock_objects
[i
] );
642 if (hkey
) RegCloseKey( hkey
);
649 #define FIRST_LARGE_HANDLE 16
650 #define MAX_LARGE_HANDLES ((GDI_HEAP_SIZE >> 2) - FIRST_LARGE_HANDLE)
651 static GDIOBJHDR
*large_handles
[MAX_LARGE_HANDLES
];
652 static int next_large_handle
;
654 /***********************************************************************
657 * Allocate a GDI handle from the large heap. Helper for GDI_AllocObject
659 inline static GDIOBJHDR
*alloc_large_heap( WORD size
, HGDIOBJ
*handle
)
664 for (i
= next_large_handle
+ 1; i
< MAX_LARGE_HANDLES
; i
++)
665 if (!large_handles
[i
]) goto found
;
666 for (i
= 0; i
<= next_large_handle
; i
++)
667 if (!large_handles
[i
]) goto found
;
672 if ((obj
= HeapAlloc( GetProcessHeap(), 0, size
)))
674 large_handles
[i
] = obj
;
675 *handle
= (HGDIOBJ
)(ULONG_PTR
)((i
+ FIRST_LARGE_HANDLE
) << 2);
676 next_large_handle
= i
;
682 /***********************************************************************
685 void *GDI_AllocObject( WORD size
, WORD magic
, HGDIOBJ
*handle
, const struct gdi_obj_funcs
*funcs
)
690 _EnterSysLevel( &GDI_level
);
696 if (!(hlocal
= LOCAL_Alloc( GDI_HeapSel
, LMEM_MOVEABLE
, size
))) goto error
;
697 assert( hlocal
& 2 );
698 obj
= (GDIOBJHDR
*)LOCAL_Lock( GDI_HeapSel
, hlocal
);
699 *handle
= (HGDIOBJ
)(ULONG_PTR
)hlocal
;
704 case DISABLED_DC_MAGIC
:
707 case METAFILE_DC_MAGIC
:
708 case ENHMETAFILE_MAGIC
:
709 case ENHMETAFILE_DC_MAGIC
:
710 case MEMORY_DC_MAGIC
:
713 if (!(obj
= alloc_large_heap( size
, handle
))) goto error
;
718 obj
->wMagic
= magic
|OBJECT_NOSYSTEM
;
723 TRACE_SEC( *handle
, "enter" );
727 _LeaveSysLevel( &GDI_level
);
733 /***********************************************************************
736 * The object ptr must have been obtained with GDI_GetObjPtr.
737 * The new pointer must be released with GDI_ReleaseObj.
739 void *GDI_ReallocObject( WORD size
, HGDIOBJ handle
, void *object
)
743 if ((UINT_PTR
)handle
& 2) /* GDI heap handle */
745 HLOCAL16 h
= LOWORD(handle
);
746 LOCAL_Unlock( GDI_HeapSel
, h
);
747 if ((new_handle
= (HGDIOBJ
)(ULONG_PTR
)LOCAL_ReAlloc( GDI_HeapSel
, h
, size
, LMEM_MOVEABLE
)))
749 assert( new_handle
== handle
); /* moveable handle cannot change */
750 return LOCAL_Lock( GDI_HeapSel
, h
);
755 int i
= ((ULONG_PTR
)handle
>> 2) - FIRST_LARGE_HANDLE
;
756 if (i
>= 0 && i
< MAX_LARGE_HANDLES
&& large_handles
[i
])
758 void *new_ptr
= HeapReAlloc( GetProcessHeap(), 0, large_handles
[i
], size
);
761 large_handles
[i
] = new_ptr
;
765 else ERR( "Invalid handle %p\n", handle
);
767 TRACE_SEC( handle
, "leave" );
768 _LeaveSysLevel( &GDI_level
);
773 /***********************************************************************
776 BOOL
GDI_FreeObject( HGDIOBJ handle
, void *ptr
)
778 GDIOBJHDR
*object
= ptr
;
780 object
->wMagic
= 0; /* Mark it as invalid */
781 object
->funcs
= NULL
;
782 if ((UINT_PTR
)handle
& 2) /* GDI heap handle */
784 HLOCAL16 h
= LOWORD(handle
);
785 LOCAL_Unlock( GDI_HeapSel
, h
);
786 LOCAL_Free( GDI_HeapSel
, h
);
788 else /* large heap handle */
790 int i
= ((ULONG_PTR
)handle
>> 2) - FIRST_LARGE_HANDLE
;
791 if (i
>= 0 && i
< MAX_LARGE_HANDLES
&& large_handles
[i
])
793 HeapFree( GetProcessHeap(), 0, large_handles
[i
] );
794 large_handles
[i
] = NULL
;
796 else ERR( "Invalid handle %p\n", handle
);
798 TRACE_SEC( handle
, "leave" );
799 _LeaveSysLevel( &GDI_level
);
804 /***********************************************************************
807 * Return a pointer to the GDI object associated to the handle.
808 * Return NULL if the object has the wrong magic number.
809 * The object must be released with GDI_ReleaseObj.
811 void *GDI_GetObjPtr( HGDIOBJ handle
, WORD magic
)
813 GDIOBJHDR
*ptr
= NULL
;
815 _EnterSysLevel( &GDI_level
);
817 if ((UINT_PTR
)handle
& 2) /* GDI heap handle */
819 HLOCAL16 h
= LOWORD(handle
);
820 ptr
= (GDIOBJHDR
*)LOCAL_Lock( GDI_HeapSel
, h
);
823 if (((magic
!= MAGIC_DONTCARE
) && (GDIMAGIC(ptr
->wMagic
) != magic
)) ||
824 (GDIMAGIC(ptr
->wMagic
) < FIRST_MAGIC
) ||
825 (GDIMAGIC(ptr
->wMagic
) > LAST_MAGIC
))
827 LOCAL_Unlock( GDI_HeapSel
, h
);
832 else /* large heap handle */
834 int i
= ((UINT_PTR
)handle
>> 2) - FIRST_LARGE_HANDLE
;
835 if (i
>= 0 && i
< MAX_LARGE_HANDLES
)
837 ptr
= large_handles
[i
];
838 if (ptr
&& (magic
!= MAGIC_DONTCARE
) && (GDIMAGIC(ptr
->wMagic
) != magic
)) ptr
= NULL
;
844 _LeaveSysLevel( &GDI_level
);
845 SetLastError( ERROR_INVALID_HANDLE
);
846 WARN( "Invalid handle %p\n", handle
);
848 else TRACE_SEC( handle
, "enter" );
854 /***********************************************************************
858 void GDI_ReleaseObj( HGDIOBJ handle
)
860 if ((UINT_PTR
)handle
& 2) LOCAL_Unlock( GDI_HeapSel
, LOWORD(handle
) );
861 TRACE_SEC( handle
, "leave" );
862 _LeaveSysLevel( &GDI_level
);
866 /***********************************************************************
869 void GDI_CheckNotLock(void)
871 _CheckNotSysLevel( &GDI_level
);
875 /***********************************************************************
876 * DeleteObject (GDI32.@)
878 BOOL WINAPI
DeleteObject( HGDIOBJ obj
)
880 /* Check if object is valid */
883 if (HIWORD(obj
)) return FALSE
;
885 if (!(header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
))) return FALSE
;
887 if (!(header
->wMagic
& OBJECT_NOSYSTEM
)
888 && (header
->wMagic
>= FIRST_MAGIC
) && (header
->wMagic
<= LAST_MAGIC
))
890 TRACE("Preserving system object %p\n", obj
);
891 GDI_ReleaseObj( obj
);
897 DC
*dc
= DC_GetDCPtr(header
->hdcs
->hdc
);
898 struct hdc_list
*tmp
;
900 TRACE("hdc %p has interest in %p\n", header
->hdcs
->hdc
, obj
);
903 if(dc
->funcs
->pDeleteObject
)
904 dc
->funcs
->pDeleteObject( dc
->physDev
, obj
);
905 GDI_ReleaseObj( header
->hdcs
->hdc
);
908 header
->hdcs
= header
->hdcs
->next
;
909 HeapFree(GetProcessHeap(), 0, tmp
);
914 TRACE("delayed for %p because object in use, count %ld\n", obj
, header
->dwCount
);
915 header
->dwCount
|= 0x80000000; /* mark for delete */
916 GDI_ReleaseObj( obj
);
924 if (header
->funcs
&& header
->funcs
->pDeleteObject
)
925 return header
->funcs
->pDeleteObject( obj
, header
);
927 GDI_ReleaseObj( obj
);
931 /***********************************************************************
932 * GDI_hdc_using_object
934 * Call this if the dc requires DeleteObject notification
936 BOOL
GDI_hdc_using_object(HGDIOBJ obj
, HDC hdc
)
939 struct hdc_list
**pphdc
;
941 TRACE("obj %p hdc %p\n", obj
, hdc
);
943 if (!(header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
))) return FALSE
;
945 if (!(header
->wMagic
& OBJECT_NOSYSTEM
) &&
946 (header
->wMagic
>= FIRST_MAGIC
) && (header
->wMagic
<= LAST_MAGIC
))
952 for(pphdc
= &header
->hdcs
; *pphdc
; pphdc
= &(*pphdc
)->next
)
953 if((*pphdc
)->hdc
== hdc
)
957 *pphdc
= HeapAlloc(GetProcessHeap(), 0, sizeof(**pphdc
));
959 (*pphdc
)->next
= NULL
;
966 /***********************************************************************
967 * GDI_hdc_not_using_object
970 BOOL
GDI_hdc_not_using_object(HGDIOBJ obj
, HDC hdc
)
973 struct hdc_list
*phdc
, **prev
;
975 TRACE("obj %p hdc %p\n", obj
, hdc
);
977 if (!(header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
))) return FALSE
;
979 if (!(header
->wMagic
& OBJECT_NOSYSTEM
) &&
980 (header
->wMagic
>= FIRST_MAGIC
) && (header
->wMagic
<= LAST_MAGIC
))
987 prev
= &header
->hdcs
;
990 if(phdc
->hdc
== hdc
) {
992 HeapFree(GetProcessHeap(), 0, phdc
);
1000 GDI_ReleaseObj(obj
);
1004 /***********************************************************************
1005 * GetStockObject (GDI32.@)
1007 HGDIOBJ WINAPI
GetStockObject( INT obj
)
1010 if ((obj
< 0) || (obj
>= NB_STOCK_OBJECTS
)) return 0;
1011 ret
= stock_objects
[obj
];
1012 TRACE("returning %p\n", ret
);
1017 /***********************************************************************
1018 * GetObject (GDI.82)
1020 INT16 WINAPI
GetObject16( HGDIOBJ16 handle16
, INT16 count
, LPVOID buffer
)
1023 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1026 TRACE("%p %d %p\n", handle
, count
, buffer
);
1027 if (!count
) return 0;
1029 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1031 if (ptr
->funcs
&& ptr
->funcs
->pGetObject16
)
1032 result
= ptr
->funcs
->pGetObject16( handle
, ptr
, count
, buffer
);
1034 SetLastError( ERROR_INVALID_HANDLE
);
1036 GDI_ReleaseObj( handle
);
1041 /***********************************************************************
1042 * GetObjectA (GDI32.@)
1044 INT WINAPI
GetObjectA( HGDIOBJ handle
, INT count
, LPVOID buffer
)
1048 TRACE("%p %d %p\n", handle
, count
, buffer
);
1050 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1052 if (ptr
->funcs
&& ptr
->funcs
->pGetObjectA
)
1053 result
= ptr
->funcs
->pGetObjectA( handle
, ptr
, count
, buffer
);
1055 SetLastError( ERROR_INVALID_HANDLE
);
1057 GDI_ReleaseObj( handle
);
1061 /***********************************************************************
1062 * GetObjectW (GDI32.@)
1064 INT WINAPI
GetObjectW( HGDIOBJ handle
, INT count
, LPVOID buffer
)
1068 TRACE("%p %d %p\n", handle
, count
, buffer
);
1070 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1072 if (ptr
->funcs
&& ptr
->funcs
->pGetObjectW
)
1073 result
= ptr
->funcs
->pGetObjectW( handle
, ptr
, count
, buffer
);
1075 SetLastError( ERROR_INVALID_HANDLE
);
1077 GDI_ReleaseObj( handle
);
1081 /***********************************************************************
1082 * GetObjectType (GDI32.@)
1084 DWORD WINAPI
GetObjectType( HGDIOBJ handle
)
1088 TRACE("%p\n", handle
);
1090 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1092 switch(GDIMAGIC(ptr
->wMagic
))
1101 result
= OBJ_BITMAP
;
1110 result
= OBJ_REGION
;
1116 result
= OBJ_METADC
;
1118 case METAFILE_MAGIC
:
1119 result
= OBJ_METAFILE
;
1121 case METAFILE_DC_MAGIC
:
1122 result
= OBJ_METADC
;
1124 case ENHMETAFILE_MAGIC
:
1125 result
= OBJ_ENHMETAFILE
;
1127 case ENHMETAFILE_DC_MAGIC
:
1128 result
= OBJ_ENHMETADC
;
1130 case MEMORY_DC_MAGIC
:
1134 FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr
->wMagic
) );
1137 GDI_ReleaseObj( handle
);
1141 /***********************************************************************
1142 * GetCurrentObject (GDI32.@)
1144 HGDIOBJ WINAPI
GetCurrentObject(HDC hdc
,UINT type
)
1147 DC
* dc
= DC_GetDCPtr( hdc
);
1152 case OBJ_PEN
: ret
= dc
->hPen
; break;
1153 case OBJ_BRUSH
: ret
= dc
->hBrush
; break;
1154 case OBJ_PAL
: ret
= dc
->hPalette
; break;
1155 case OBJ_FONT
: ret
= dc
->hFont
; break;
1156 case OBJ_BITMAP
: ret
= dc
->hBitmap
; break;
1158 /* the SDK only mentions those above */
1159 FIXME("(%p,%d): unknown type.\n",hdc
,type
);
1162 GDI_ReleaseObj( hdc
);
1168 /***********************************************************************
1169 * SelectObject (GDI32.@)
1171 HGDIOBJ WINAPI
SelectObject( HDC hdc
, HGDIOBJ handle
)
1174 GDIOBJHDR
*header
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
1175 if (!header
) return 0;
1177 TRACE("hdc=%p %p\n", hdc
, handle
);
1179 if (header
->funcs
&& header
->funcs
->pSelectObject
)
1181 ret
= header
->funcs
->pSelectObject( handle
, header
, hdc
);
1182 if (ret
&& ret
!= handle
&& (INT
)ret
> COMPLEXREGION
)
1184 inc_ref_count( handle
);
1185 dec_ref_count( ret
);
1188 GDI_ReleaseObj( handle
);
1193 /***********************************************************************
1194 * UnrealizeObject (GDI32.@)
1196 BOOL WINAPI
UnrealizeObject( HGDIOBJ obj
)
1199 /* Check if object is valid */
1201 GDIOBJHDR
* header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
);
1202 if (!header
) return FALSE
;
1204 TRACE("%p\n", obj
);
1206 /* Unrealize object */
1208 if (header
->funcs
&& header
->funcs
->pUnrealizeObject
)
1209 result
= header
->funcs
->pUnrealizeObject( obj
, header
);
1211 GDI_ReleaseObj( obj
);
1216 /* Solid colors to enumerate */
1217 static const COLORREF solid_colors
[] =
1218 { RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff),
1219 RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00),
1220 RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00),
1221 RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff),
1222 RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00),
1223 RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80),
1224 RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
1225 RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
1229 /***********************************************************************
1230 * EnumObjects (GDI32.@)
1232 INT WINAPI
EnumObjects( HDC hdc
, INT nObjType
,
1233 GOBJENUMPROC lpEnumFunc
, LPARAM lParam
)
1239 TRACE("%p %d %p %08lx\n", hdc
, nObjType
, lpEnumFunc
, lParam
);
1243 /* Enumerate solid pens */
1244 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
1246 pen
.lopnStyle
= PS_SOLID
;
1247 pen
.lopnWidth
.x
= 1;
1248 pen
.lopnWidth
.y
= 0;
1249 pen
.lopnColor
= solid_colors
[i
];
1250 retval
= lpEnumFunc( &pen
, lParam
);
1251 TRACE("solid pen %08lx, ret=%d\n",
1252 solid_colors
[i
], retval
);
1258 /* Enumerate solid brushes */
1259 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
1261 brush
.lbStyle
= BS_SOLID
;
1262 brush
.lbColor
= solid_colors
[i
];
1264 retval
= lpEnumFunc( &brush
, lParam
);
1265 TRACE("solid brush %08lx, ret=%d\n",
1266 solid_colors
[i
], retval
);
1270 /* Now enumerate hatched brushes */
1271 if (retval
) for (i
= HS_HORIZONTAL
; i
<= HS_DIAGCROSS
; i
++)
1273 brush
.lbStyle
= BS_HATCHED
;
1274 brush
.lbColor
= RGB(0,0,0);
1276 retval
= lpEnumFunc( &brush
, lParam
);
1277 TRACE("hatched brush %d, ret=%d\n",
1284 /* FIXME: implement Win32 types */
1285 WARN("(%d): Invalid type\n", nObjType
);
1292 /***********************************************************************
1293 * IsGDIObject (GDI.462)
1295 * returns type of object if valid (W95 system programming secrets p. 264-5)
1297 BOOL16 WINAPI
IsGDIObject16( HGDIOBJ16 handle16
)
1300 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1302 GDIOBJHDR
*object
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
1305 magic
= GDIMAGIC(object
->wMagic
) - PEN_MAGIC
+ 1;
1306 GDI_ReleaseObj( handle
);
1312 /***********************************************************************
1313 * SetObjectOwner (GDI32.@)
1315 void WINAPI
SetObjectOwner( HGDIOBJ handle
, HANDLE owner
)
1321 /***********************************************************************
1322 * MakeObjectPrivate (GDI.463)
1324 * What does that mean ?
1325 * Some little docu can be found in "Undocumented Windows",
1326 * but this is basically useless.
1327 * At least we know that this flags the GDI object's wMagic
1328 * with 0x2000 (OBJECT_PRIVATE), so we just do it.
1329 * But Wine doesn't react on that yet.
1331 void WINAPI
MakeObjectPrivate16( HGDIOBJ16 handle16
, BOOL16
private )
1333 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1334 GDIOBJHDR
*ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
1337 ERR("invalid GDI object %p !\n", handle
);
1340 ptr
->wMagic
|= OBJECT_PRIVATE
;
1341 GDI_ReleaseObj( handle
);
1345 /***********************************************************************
1346 * GdiFlush (GDI32.@)
1348 BOOL WINAPI
GdiFlush(void)
1350 return TRUE
; /* FIXME */
1354 /***********************************************************************
1355 * GdiGetBatchLimit (GDI32.@)
1357 DWORD WINAPI
GdiGetBatchLimit(void)
1359 return 1; /* FIXME */
1363 /***********************************************************************
1364 * GdiSetBatchLimit (GDI32.@)
1366 DWORD WINAPI
GdiSetBatchLimit( DWORD limit
)
1368 return 1; /* FIXME */
1372 /***********************************************************************
1373 * GdiSeeGdiDo (GDI.452)
1375 DWORD WINAPI
GdiSeeGdiDo16( WORD wReqType
, WORD wParam1
, WORD wParam2
,
1380 case 0x0001: /* LocalAlloc */
1381 return LOCAL_Alloc( GDI_HeapSel
, wParam1
, wParam3
);
1382 case 0x0002: /* LocalFree */
1383 return LOCAL_Free( GDI_HeapSel
, wParam1
);
1384 case 0x0003: /* LocalCompact */
1385 return LOCAL_Compact( GDI_HeapSel
, wParam3
, 0 );
1386 case 0x0103: /* LocalHeap */
1389 WARN("(wReqType=%04x): Unknown\n", wReqType
);
1394 /***********************************************************************
1395 * GdiSignalProc32 (GDI.610)
1397 WORD WINAPI
GdiSignalProc( UINT uCode
, DWORD dwThreadOrProcessID
,
1398 DWORD dwFlags
, HMODULE16 hModule
)
1403 /***********************************************************************
1404 * GdiInit2 (GDI.403)
1406 * See "Undocumented Windows"
1408 HANDLE16 WINAPI
GdiInit216(
1409 HANDLE16 h1
, /* [in] GDI object */
1410 HANDLE16 h2
/* [in] global data */
1413 FIXME("(%04x, %04x), stub.\n", h1
, h2
);
1415 return 0xffff; /* undefined return value */
1416 return h1
; /* FIXME: should be the memory handle of h1 */
1419 /***********************************************************************
1420 * FinalGdiInit (GDI.405)
1422 void WINAPI
FinalGdiInit16( HBRUSH16 hPattern
/* [in] fill pattern of desktop */ )
1426 /***********************************************************************
1427 * GdiFreeResources (GDI.609)
1429 WORD WINAPI
GdiFreeResources16( DWORD reserve
)
1431 return (WORD
)( (int)LOCAL_CountFree( GDI_HeapSel
) * 100 /
1432 (int)LOCAL_HeapSize( GDI_HeapSel
) );
1436 /*******************************************************************
1437 * GetColorAdjustment [GDI32.@]
1441 BOOL WINAPI
GetColorAdjustment(HDC hdc
, LPCOLORADJUSTMENT lpca
)
1443 FIXME("GetColorAdjustment, stub\n");
1447 /*******************************************************************
1448 * GetMiterLimit [GDI32.@]
1452 BOOL WINAPI
GetMiterLimit(HDC hdc
, PFLOAT peLimit
)
1454 FIXME("GetMiterLimit, stub\n");
1458 /*******************************************************************
1459 * SetMiterLimit [GDI32.@]
1463 BOOL WINAPI
SetMiterLimit(HDC hdc
, FLOAT eNewLimit
, PFLOAT peOldLimit
)
1465 FIXME("(%p,%f,%p) stub\n", hdc
, eNewLimit
, peOldLimit
);
1467 *peOldLimit
= 10.0; /* Default miter is 10, see msdn */
1471 /*******************************************************************
1472 * GdiComment [GDI32.@]
1476 BOOL WINAPI
GdiComment(HDC hdc
, UINT cbSize
, const BYTE
*lpData
)
1478 DC
*dc
= DC_GetDCPtr(hdc
);
1482 if (dc
->funcs
->pGdiComment
)
1483 ret
= dc
->funcs
->pGdiComment( dc
->physDev
, cbSize
, lpData
);
1485 GDI_ReleaseObj( hdc
);
1489 /*******************************************************************
1490 * SetColorAdjustment [GDI32.@]
1494 BOOL WINAPI
SetColorAdjustment(HDC hdc
, const COLORADJUSTMENT
* lpca
)
1496 FIXME("SetColorAdjustment, stub\n");