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
38 #include "gdi_private.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(gdi
);
43 #define HGDIOBJ_32(h16) ((HGDIOBJ)(ULONG_PTR)(h16))
45 #define GDI_HEAP_SIZE 0xffe0
47 /***********************************************************************
51 static const LOGBRUSH WhiteBrush
= { BS_SOLID
, RGB(255,255,255), 0 };
52 static const LOGBRUSH BlackBrush
= { BS_SOLID
, RGB(0,0,0), 0 };
53 static const LOGBRUSH NullBrush
= { BS_NULL
, 0, 0 };
55 /* FIXME: these should perhaps be BS_HATCHED, at least for 1 bitperpixel */
56 static const LOGBRUSH LtGrayBrush
= { BS_SOLID
, RGB(192,192,192), 0 };
57 static const LOGBRUSH GrayBrush
= { BS_SOLID
, RGB(128,128,128), 0 };
59 /* This is BS_HATCHED, for 1 bitperpixel. This makes the spray work in pbrush */
60 /* See HatchBrushes in x11drv for the HS_DIAGCROSS+1 hack */
61 static const LOGBRUSH DkGrayBrush
= { BS_HATCHED
, RGB(0,0,0), (HS_DIAGCROSS
+1) };
63 static const LOGPEN WhitePen
= { PS_SOLID
, { 0, 0 }, RGB(255,255,255) };
64 static const LOGPEN BlackPen
= { PS_SOLID
, { 0, 0 }, RGB(0,0,0) };
65 static const LOGPEN NullPen
= { PS_NULL
, { 0, 0 }, 0 };
67 static const LOGBRUSH DCBrush
= { BS_SOLID
, RGB(255,255,255), 0 };
68 static const LOGPEN DCPen
= { PS_SOLID
, { 0, 0 }, RGB(0,0,0) };
70 /* reserve one extra entry for the stock default bitmap */
71 /* this is what Windows does too */
72 #define NB_STOCK_OBJECTS (STOCK_LAST+2)
74 static HGDIOBJ stock_objects
[NB_STOCK_OBJECTS
];
76 static SYSLEVEL GDI_level
;
77 static CRITICAL_SECTION_DEBUG critsect_debug
=
79 0, 0, &GDI_level
.crst
,
80 { &critsect_debug
.ProcessLocksList
, &critsect_debug
.ProcessLocksList
},
81 0, 0, { 0, (DWORD
)(__FILE__
": GDI_level") }
83 static SYSLEVEL GDI_level
= { { &critsect_debug
, -1, 0, 0, 0, 0 }, 3 };
85 static WORD GDI_HeapSel
;
87 inline static BOOL
get_bool(char *buffer
)
89 return (buffer
[0] == 'y' || buffer
[0] == 'Y' ||
90 buffer
[0] == 't' || buffer
[0] == 'T' ||
95 /****************************************************************************
97 * language-independent stock fonts
101 static const LOGFONTW OEMFixedFont
=
102 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, OEM_CHARSET
,
103 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, {'\0'} };
105 static const LOGFONTW AnsiFixedFont
=
106 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
107 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, {'\0'} };
109 static const LOGFONTW AnsiVarFont
=
110 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
111 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
112 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} };
114 /******************************************************************************
116 * language-dependent stock fonts
118 * 'ANSI' charset and 'DEFAULT' charset is not same.
119 * The chars in CP_ACP should be drawn with 'DEFAULT' charset.
120 * 'ANSI' charset seems to be identical with ISO-8859-1.
121 * 'DEFAULT' charset is a language-dependent charset.
123 * 'System' font seems to be an alias for language-dependent font.
127 * language-dependenet stock fonts for all known charsets
128 * please see TranslateCharsetInfo (objects/font.c) and
129 * CharsetBindingInfo (graphics/x11drv/xfont.c),
130 * and modify entries for your language if needed.
132 struct DefaultFontInfo
136 LOGFONTW DeviceDefaultFont
;
137 LOGFONTW SystemFixedFont
;
138 LOGFONTW DefaultGuiFont
;
141 static const struct DefaultFontInfo default_fonts
[] =
145 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
146 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
147 {'S','y','s','t','e','m','\0'}
149 { /* Device Default */
150 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
151 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
155 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
156 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
159 { /* DefaultGuiFont */
160 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
161 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
162 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
165 { EASTEUROPE_CHARSET
,
167 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
168 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
169 {'S','y','s','t','e','m','\0'}
171 { /* Device Default */
172 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
173 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
177 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
178 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
181 { /* DefaultGuiFont */
182 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
183 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
184 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
189 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
190 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
191 {'S','y','s','t','e','m','\0'}
193 { /* Device Default */
194 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
195 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
199 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
200 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
203 { /* DefaultGuiFont */
204 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
205 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
206 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
211 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
212 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
213 {'S','y','s','t','e','m','\0'}
215 { /* Device Default */
216 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
217 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
221 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
222 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
225 { /* DefaultGuiFont */
226 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
227 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
228 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
233 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
234 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
235 {'S','y','s','t','e','m','\0'}
237 { /* Device Default */
238 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
239 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
243 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
244 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
247 { /* DefaultGuiFont */
248 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
249 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
250 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
255 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
256 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
257 {'S','y','s','t','e','m','\0'}
259 { /* Device Default */
260 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
261 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
265 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
266 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
269 { /* DefaultGuiFont */
270 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
271 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
272 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
277 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
278 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
279 {'S','y','s','t','e','m','\0'}
281 { /* Device Default */
282 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
283 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
287 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
288 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
291 { /* DefaultGuiFont */
292 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
293 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
294 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
299 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
300 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
301 {'S','y','s','t','e','m','\0'}
303 { /* Device Default */
304 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
305 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
309 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
310 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
313 { /* DefaultGuiFont */
314 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
315 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
316 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
321 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
322 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
323 {'S','y','s','t','e','m','\0'}
325 { /* Device Default */
326 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
327 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
331 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
332 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
335 { /* DefaultGuiFont */
336 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
337 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
338 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
343 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
344 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
345 {'S','y','s','t','e','m','\0'}
347 { /* Device Default */
348 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
349 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
353 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
354 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
357 { /* DefaultGuiFont */
358 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
359 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
360 {'M','S',' ','U','I',' ','G','o','t','h','i','c','\0'}
365 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
366 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
367 {'S','y','s','t','e','m','\0'}
369 { /* Device Default */
370 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
371 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
375 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
376 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
379 { /* DefaultGuiFont */
380 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
381 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
382 {'M','S',' ','S','o','n','g','\0'} /* FIXME: Is this correct? */
387 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
388 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
389 {'S','y','s','t','e','m','\0'}
391 { /* Device Default */
392 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
393 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
397 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
398 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
401 { /* DefaultGuiFont */
402 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
403 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
404 {'G','u','l','i','m'},
407 { CHINESEBIG5_CHARSET
,
409 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
410 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
411 {'S','y','s','t','e','m','\0'}
413 { /* Device Default */
414 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
415 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
419 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
420 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
423 { /* DefaultGuiFont */
424 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
425 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
426 {'\0'} /* FIXME - what is the native font??? */
431 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
432 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
433 {'S','y','s','t','e','m','\0'}
435 { /* Device Default */
436 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
437 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
441 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
442 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
445 { /* DefaultGuiFont */
446 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
447 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
448 {'M','S',' ','M','i','n','g','l','i','u','\0'} /* FIXME: Is this correct? */
454 /******************************************************************************
457 static const struct DefaultFontInfo
* get_default_fonts(UINT charset
)
461 for(n
=0;n
<(sizeof(default_fonts
)/sizeof(default_fonts
[0]));n
++)
463 if ( default_fonts
[n
].charset
== charset
)
464 return &default_fonts
[n
];
467 FIXME( "unhandled charset 0x%08x - use ANSI_CHARSET for default stock objects\n", charset
);
468 return &default_fonts
[0];
472 /******************************************************************************
473 * get_default_charset (internal)
475 * get the language-dependent charset that can handle CP_ACP correctly.
477 static UINT
get_default_charset( void )
483 csi
.ciCharset
= ANSI_CHARSET
;
484 if ( ! TranslateCharsetInfo( (LPDWORD
)uACP
, &csi
, TCI_SRCCODEPAGE
) )
486 FIXME( "unhandled codepage %u - use ANSI_CHARSET for default stock objects\n", uACP
);
490 return csi
.ciCharset
;
494 /******************************************************************************
497 static HFONT
create_stock_font( char const *fontName
, const LOGFONTW
*font
, HKEY hkey
)
501 char buffer
[MAX_PATH
];
504 if (!hkey
) return CreateFontIndirectW( font
);
507 sprintf(key
, "%s.Height", fontName
);
508 count
= sizeof(buffer
);
509 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
510 lf
.lfHeight
= atoi(buffer
);
512 sprintf(key
, "%s.Bold", fontName
);
513 count
= sizeof(buffer
);
514 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
515 lf
.lfWeight
= get_bool(buffer
) ? FW_BOLD
: FW_NORMAL
;
517 sprintf(key
, "%s.Italic", fontName
);
518 count
= sizeof(buffer
);
519 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
520 lf
.lfItalic
= get_bool(buffer
);
522 sprintf(key
, "%s.Underline", fontName
);
523 count
= sizeof(buffer
);
524 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
525 lf
.lfUnderline
= get_bool(buffer
);
527 sprintf(key
, "%s.StrikeOut", fontName
);
528 count
= sizeof(buffer
);
529 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
530 lf
.lfStrikeOut
= get_bool(buffer
);
531 return CreateFontIndirectW( &lf
);
535 #define TRACE_SEC(handle,text) \
536 TRACE("(%p): " text " %ld\n", (handle), GDI_level.crst.RecursionCount)
539 /***********************************************************************
542 * Increment the reference count of a GDI object.
544 inline static void inc_ref_count( HGDIOBJ handle
)
548 if ((header
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
)))
551 GDI_ReleaseObj( handle
);
556 /***********************************************************************
559 * Decrement the reference count of a GDI object.
561 inline static void dec_ref_count( HGDIOBJ handle
)
565 if ((header
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
)))
567 if (header
->dwCount
) header
->dwCount
--;
568 if (header
->dwCount
!= 0x80000000) GDI_ReleaseObj( handle
);
571 /* handle delayed DeleteObject*/
573 GDI_ReleaseObj( handle
);
574 TRACE( "executing delayed DeleteObject for %p\n", handle
);
575 DeleteObject( handle
);
581 /***********************************************************************
584 * GDI initialization.
588 HINSTANCE16 instance
;
591 const struct DefaultFontInfo
* deffonts
;
594 if (RegOpenKeyA(HKEY_LOCAL_MACHINE
, "Software\\Wine\\Wine\\Config\\Tweak.Fonts", &hkey
))
597 /* create GDI heap */
598 if ((instance
= LoadLibrary16( "GDI.EXE" )) >= 32) GDI_HeapSel
= instance
| 7;
600 /* create stock objects */
601 stock_objects
[WHITE_BRUSH
] = CreateBrushIndirect( &WhiteBrush
);
602 stock_objects
[LTGRAY_BRUSH
] = CreateBrushIndirect( &LtGrayBrush
);
603 stock_objects
[GRAY_BRUSH
] = CreateBrushIndirect( &GrayBrush
);
604 stock_objects
[DKGRAY_BRUSH
] = CreateBrushIndirect( &DkGrayBrush
);
605 stock_objects
[BLACK_BRUSH
] = CreateBrushIndirect( &BlackBrush
);
606 stock_objects
[NULL_BRUSH
] = CreateBrushIndirect( &NullBrush
);
608 stock_objects
[WHITE_PEN
] = CreatePenIndirect( &WhitePen
);
609 stock_objects
[BLACK_PEN
] = CreatePenIndirect( &BlackPen
);
610 stock_objects
[NULL_PEN
] = CreatePenIndirect( &NullPen
);
612 stock_objects
[DEFAULT_PALETTE
] = PALETTE_Init();
613 stock_objects
[DEFAULT_BITMAP
] = CreateBitmap( 1, 1, 1, 1, NULL
);
615 /* language-independent stock fonts */
616 stock_objects
[OEM_FIXED_FONT
] = create_stock_font( "OEMFixed", &OEMFixedFont
, hkey
);
617 stock_objects
[ANSI_FIXED_FONT
] = create_stock_font( "AnsiFixed", &AnsiFixedFont
, hkey
);
618 stock_objects
[ANSI_VAR_FONT
] = create_stock_font( "AnsiVar", &AnsiVarFont
, hkey
);
620 /* language-dependent stock fonts */
621 deffonts
= get_default_fonts(get_default_charset());
622 stock_objects
[SYSTEM_FONT
] = create_stock_font( "System", &deffonts
->SystemFont
, hkey
);
623 stock_objects
[DEVICE_DEFAULT_FONT
] = create_stock_font( "DeviceDefault", &deffonts
->DeviceDefaultFont
, hkey
);
624 stock_objects
[SYSTEM_FIXED_FONT
] = create_stock_font( "SystemFixed", &deffonts
->SystemFixedFont
, hkey
);
625 stock_objects
[DEFAULT_GUI_FONT
] = create_stock_font( "DefaultGui", &deffonts
->DefaultGuiFont
, hkey
);
627 stock_objects
[DC_BRUSH
] = CreateBrushIndirect( &DCBrush
);
628 stock_objects
[DC_PEN
] = CreatePenIndirect( &DCPen
);
630 /* clear the NOSYSTEM bit on all stock objects*/
631 for (i
= 0; i
< NB_STOCK_OBJECTS
; i
++)
633 if (!stock_objects
[i
])
635 if (i
== 9) continue; /* there's no stock object 9 */
636 ERR( "could not create stock object %d\n", i
);
639 ptr
= GDI_GetObjPtr( stock_objects
[i
], MAGIC_DONTCARE
);
640 ptr
->wMagic
&= ~OBJECT_NOSYSTEM
;
641 GDI_ReleaseObj( stock_objects
[i
] );
644 if (hkey
) RegCloseKey( hkey
);
651 #define FIRST_LARGE_HANDLE 16
652 #define MAX_LARGE_HANDLES ((GDI_HEAP_SIZE >> 2) - FIRST_LARGE_HANDLE)
653 static GDIOBJHDR
*large_handles
[MAX_LARGE_HANDLES
];
654 static int next_large_handle
;
656 /***********************************************************************
659 * Allocate a GDI handle from the large heap. Helper for GDI_AllocObject
661 inline static GDIOBJHDR
*alloc_large_heap( WORD size
, HGDIOBJ
*handle
)
666 for (i
= next_large_handle
+ 1; i
< MAX_LARGE_HANDLES
; i
++)
667 if (!large_handles
[i
]) goto found
;
668 for (i
= 0; i
<= next_large_handle
; i
++)
669 if (!large_handles
[i
]) goto found
;
674 if ((obj
= HeapAlloc( GetProcessHeap(), 0, size
)))
676 large_handles
[i
] = obj
;
677 *handle
= (HGDIOBJ
)(ULONG_PTR
)((i
+ FIRST_LARGE_HANDLE
) << 2);
678 next_large_handle
= i
;
684 /***********************************************************************
687 void *GDI_AllocObject( WORD size
, WORD magic
, HGDIOBJ
*handle
, const struct gdi_obj_funcs
*funcs
)
692 _EnterSysLevel( &GDI_level
);
698 if (!(hlocal
= LOCAL_Alloc( GDI_HeapSel
, LMEM_MOVEABLE
, size
))) goto error
;
699 assert( hlocal
& 2 );
700 obj
= (GDIOBJHDR
*)LOCAL_Lock( GDI_HeapSel
, hlocal
);
701 *handle
= (HGDIOBJ
)(ULONG_PTR
)hlocal
;
706 case DISABLED_DC_MAGIC
:
709 case METAFILE_DC_MAGIC
:
710 case ENHMETAFILE_MAGIC
:
711 case ENHMETAFILE_DC_MAGIC
:
712 case MEMORY_DC_MAGIC
:
715 if (!(obj
= alloc_large_heap( size
, handle
))) goto error
;
720 obj
->wMagic
= magic
|OBJECT_NOSYSTEM
;
725 TRACE_SEC( *handle
, "enter" );
729 _LeaveSysLevel( &GDI_level
);
735 /***********************************************************************
738 * The object ptr must have been obtained with GDI_GetObjPtr.
739 * The new pointer must be released with GDI_ReleaseObj.
741 void *GDI_ReallocObject( WORD size
, HGDIOBJ handle
, void *object
)
745 if ((UINT_PTR
)handle
& 2) /* GDI heap handle */
747 HLOCAL16 h
= LOWORD(handle
);
748 LOCAL_Unlock( GDI_HeapSel
, h
);
749 if ((new_handle
= (HGDIOBJ
)(ULONG_PTR
)LOCAL_ReAlloc( GDI_HeapSel
, h
, size
, LMEM_MOVEABLE
)))
751 assert( new_handle
== handle
); /* moveable handle cannot change */
752 return LOCAL_Lock( GDI_HeapSel
, h
);
757 int i
= ((ULONG_PTR
)handle
>> 2) - FIRST_LARGE_HANDLE
;
758 if (i
>= 0 && i
< MAX_LARGE_HANDLES
&& large_handles
[i
])
760 void *new_ptr
= HeapReAlloc( GetProcessHeap(), 0, large_handles
[i
], size
);
763 large_handles
[i
] = new_ptr
;
767 else ERR( "Invalid handle %p\n", handle
);
769 TRACE_SEC( handle
, "leave" );
770 _LeaveSysLevel( &GDI_level
);
775 /***********************************************************************
778 BOOL
GDI_FreeObject( HGDIOBJ handle
, void *ptr
)
780 GDIOBJHDR
*object
= ptr
;
782 object
->wMagic
= 0; /* Mark it as invalid */
783 object
->funcs
= NULL
;
784 if ((UINT_PTR
)handle
& 2) /* GDI heap handle */
786 HLOCAL16 h
= LOWORD(handle
);
787 LOCAL_Unlock( GDI_HeapSel
, h
);
788 LOCAL_Free( GDI_HeapSel
, h
);
790 else /* large heap handle */
792 int i
= ((ULONG_PTR
)handle
>> 2) - FIRST_LARGE_HANDLE
;
793 if (i
>= 0 && i
< MAX_LARGE_HANDLES
&& large_handles
[i
])
795 HeapFree( GetProcessHeap(), 0, large_handles
[i
] );
796 large_handles
[i
] = NULL
;
798 else ERR( "Invalid handle %p\n", handle
);
800 TRACE_SEC( handle
, "leave" );
801 _LeaveSysLevel( &GDI_level
);
806 /***********************************************************************
809 * Return a pointer to the GDI object associated to the handle.
810 * Return NULL if the object has the wrong magic number.
811 * The object must be released with GDI_ReleaseObj.
813 void *GDI_GetObjPtr( HGDIOBJ handle
, WORD magic
)
815 GDIOBJHDR
*ptr
= NULL
;
817 _EnterSysLevel( &GDI_level
);
819 if ((UINT_PTR
)handle
& 2) /* GDI heap handle */
821 HLOCAL16 h
= LOWORD(handle
);
822 ptr
= (GDIOBJHDR
*)LOCAL_Lock( GDI_HeapSel
, h
);
825 if (((magic
!= MAGIC_DONTCARE
) && (GDIMAGIC(ptr
->wMagic
) != magic
)) ||
826 (GDIMAGIC(ptr
->wMagic
) < FIRST_MAGIC
) ||
827 (GDIMAGIC(ptr
->wMagic
) > LAST_MAGIC
))
829 LOCAL_Unlock( GDI_HeapSel
, h
);
834 else /* large heap handle */
836 int i
= ((UINT_PTR
)handle
>> 2) - FIRST_LARGE_HANDLE
;
837 if (i
>= 0 && i
< MAX_LARGE_HANDLES
)
839 ptr
= large_handles
[i
];
840 if (ptr
&& (magic
!= MAGIC_DONTCARE
) && (GDIMAGIC(ptr
->wMagic
) != magic
)) ptr
= NULL
;
846 _LeaveSysLevel( &GDI_level
);
847 SetLastError( ERROR_INVALID_HANDLE
);
848 WARN( "Invalid handle %p\n", handle
);
850 else TRACE_SEC( handle
, "enter" );
856 /***********************************************************************
860 void GDI_ReleaseObj( HGDIOBJ handle
)
862 if ((UINT_PTR
)handle
& 2) LOCAL_Unlock( GDI_HeapSel
, LOWORD(handle
) );
863 TRACE_SEC( handle
, "leave" );
864 _LeaveSysLevel( &GDI_level
);
868 /***********************************************************************
871 void GDI_CheckNotLock(void)
873 _CheckNotSysLevel( &GDI_level
);
877 /***********************************************************************
878 * DeleteObject (GDI32.@)
880 BOOL WINAPI
DeleteObject( HGDIOBJ obj
)
882 /* Check if object is valid */
885 if (HIWORD(obj
)) return FALSE
;
887 if (!(header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
))) return FALSE
;
889 if (!(header
->wMagic
& OBJECT_NOSYSTEM
)
890 && (header
->wMagic
>= FIRST_MAGIC
) && (header
->wMagic
<= LAST_MAGIC
))
892 TRACE("Preserving system object %p\n", obj
);
893 GDI_ReleaseObj( obj
);
899 DC
*dc
= DC_GetDCPtr(header
->hdcs
->hdc
);
900 struct hdc_list
*tmp
;
902 TRACE("hdc %p has interest in %p\n", header
->hdcs
->hdc
, obj
);
905 if(dc
->funcs
->pDeleteObject
)
906 dc
->funcs
->pDeleteObject( dc
->physDev
, obj
);
907 GDI_ReleaseObj( header
->hdcs
->hdc
);
910 header
->hdcs
= header
->hdcs
->next
;
911 HeapFree(GetProcessHeap(), 0, tmp
);
916 TRACE("delayed for %p because object in use, count %ld\n", obj
, header
->dwCount
);
917 header
->dwCount
|= 0x80000000; /* mark for delete */
918 GDI_ReleaseObj( obj
);
926 if (header
->funcs
&& header
->funcs
->pDeleteObject
)
927 return header
->funcs
->pDeleteObject( obj
, header
);
929 GDI_ReleaseObj( obj
);
933 /***********************************************************************
934 * GDI_hdc_using_object
936 * Call this if the dc requires DeleteObject notification
938 BOOL
GDI_hdc_using_object(HGDIOBJ obj
, HDC hdc
)
941 struct hdc_list
**pphdc
;
943 TRACE("obj %p hdc %p\n", obj
, hdc
);
945 if (!(header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
))) return FALSE
;
947 if (!(header
->wMagic
& OBJECT_NOSYSTEM
) &&
948 (header
->wMagic
>= FIRST_MAGIC
) && (header
->wMagic
<= LAST_MAGIC
))
954 for(pphdc
= &header
->hdcs
; *pphdc
; pphdc
= &(*pphdc
)->next
)
955 if((*pphdc
)->hdc
== hdc
)
959 *pphdc
= HeapAlloc(GetProcessHeap(), 0, sizeof(**pphdc
));
961 (*pphdc
)->next
= NULL
;
968 /***********************************************************************
969 * GDI_hdc_not_using_object
972 BOOL
GDI_hdc_not_using_object(HGDIOBJ obj
, HDC hdc
)
975 struct hdc_list
*phdc
, **prev
;
977 TRACE("obj %p hdc %p\n", obj
, hdc
);
979 if (!(header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
))) return FALSE
;
981 if (!(header
->wMagic
& OBJECT_NOSYSTEM
) &&
982 (header
->wMagic
>= FIRST_MAGIC
) && (header
->wMagic
<= LAST_MAGIC
))
989 prev
= &header
->hdcs
;
992 if(phdc
->hdc
== hdc
) {
994 HeapFree(GetProcessHeap(), 0, phdc
);
1002 GDI_ReleaseObj(obj
);
1006 /***********************************************************************
1007 * GetStockObject (GDI32.@)
1009 HGDIOBJ WINAPI
GetStockObject( INT obj
)
1012 if ((obj
< 0) || (obj
>= NB_STOCK_OBJECTS
)) return 0;
1013 ret
= stock_objects
[obj
];
1014 TRACE("returning %p\n", ret
);
1019 /***********************************************************************
1020 * GetObject (GDI.82)
1022 INT16 WINAPI
GetObject16( HANDLE16 handle16
, INT16 count
, LPVOID buffer
)
1025 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1028 TRACE("%p %d %p\n", handle
, count
, buffer
);
1029 if (!count
) return 0;
1031 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1033 if (ptr
->funcs
&& ptr
->funcs
->pGetObject16
)
1034 result
= ptr
->funcs
->pGetObject16( handle
, ptr
, count
, buffer
);
1036 SetLastError( ERROR_INVALID_HANDLE
);
1038 GDI_ReleaseObj( handle
);
1043 /***********************************************************************
1044 * GetObjectA (GDI32.@)
1046 INT WINAPI
GetObjectA( HANDLE handle
, INT count
, LPVOID buffer
)
1050 TRACE("%p %d %p\n", handle
, count
, buffer
);
1052 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1054 if (ptr
->funcs
&& ptr
->funcs
->pGetObjectA
)
1055 result
= ptr
->funcs
->pGetObjectA( handle
, ptr
, count
, buffer
);
1057 SetLastError( ERROR_INVALID_HANDLE
);
1059 GDI_ReleaseObj( handle
);
1063 /***********************************************************************
1064 * GetObjectW (GDI32.@)
1066 INT WINAPI
GetObjectW( HANDLE handle
, INT count
, LPVOID buffer
)
1070 TRACE("%p %d %p\n", handle
, count
, buffer
);
1072 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1074 if (ptr
->funcs
&& ptr
->funcs
->pGetObjectW
)
1075 result
= ptr
->funcs
->pGetObjectW( handle
, ptr
, count
, buffer
);
1077 SetLastError( ERROR_INVALID_HANDLE
);
1079 GDI_ReleaseObj( handle
);
1083 /***********************************************************************
1084 * GetObjectType (GDI32.@)
1086 DWORD WINAPI
GetObjectType( HANDLE handle
)
1090 TRACE("%p\n", handle
);
1092 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1094 switch(GDIMAGIC(ptr
->wMagic
))
1103 result
= OBJ_BITMAP
;
1112 result
= OBJ_REGION
;
1118 result
= OBJ_METADC
;
1120 case METAFILE_MAGIC
:
1121 result
= OBJ_METAFILE
;
1123 case METAFILE_DC_MAGIC
:
1124 result
= OBJ_METADC
;
1126 case ENHMETAFILE_MAGIC
:
1127 result
= OBJ_ENHMETAFILE
;
1129 case ENHMETAFILE_DC_MAGIC
:
1130 result
= OBJ_ENHMETADC
;
1132 case MEMORY_DC_MAGIC
:
1136 FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr
->wMagic
) );
1139 GDI_ReleaseObj( handle
);
1143 /***********************************************************************
1144 * GetCurrentObject (GDI32.@)
1146 HANDLE WINAPI
GetCurrentObject(HDC hdc
,UINT type
)
1149 DC
* dc
= DC_GetDCPtr( hdc
);
1154 case OBJ_PEN
: ret
= dc
->hPen
; break;
1155 case OBJ_BRUSH
: ret
= dc
->hBrush
; break;
1156 case OBJ_PAL
: ret
= dc
->hPalette
; break;
1157 case OBJ_FONT
: ret
= dc
->hFont
; break;
1158 case OBJ_BITMAP
: ret
= dc
->hBitmap
; break;
1160 /* the SDK only mentions those above */
1161 FIXME("(%p,%d): unknown type.\n",hdc
,type
);
1164 GDI_ReleaseObj( hdc
);
1170 /***********************************************************************
1171 * SelectObject (GDI32.@)
1173 HGDIOBJ WINAPI
SelectObject( HDC hdc
, HGDIOBJ handle
)
1176 GDIOBJHDR
*header
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
1177 if (!header
) return 0;
1179 TRACE("hdc=%p %p\n", hdc
, handle
);
1181 if (header
->funcs
&& header
->funcs
->pSelectObject
)
1183 ret
= header
->funcs
->pSelectObject( handle
, header
, hdc
);
1184 if (ret
&& ret
!= handle
&& (INT
)ret
> COMPLEXREGION
)
1186 inc_ref_count( handle
);
1187 dec_ref_count( ret
);
1190 GDI_ReleaseObj( handle
);
1195 /***********************************************************************
1196 * UnrealizeObject (GDI32.@)
1198 BOOL WINAPI
UnrealizeObject( HGDIOBJ obj
)
1201 /* Check if object is valid */
1203 GDIOBJHDR
* header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
);
1204 if (!header
) return FALSE
;
1206 TRACE("%p\n", obj
);
1208 /* Unrealize object */
1210 if (header
->funcs
&& header
->funcs
->pUnrealizeObject
)
1211 result
= header
->funcs
->pUnrealizeObject( obj
, header
);
1213 GDI_ReleaseObj( obj
);
1218 /* Solid colors to enumerate */
1219 static const COLORREF solid_colors
[] =
1220 { RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff),
1221 RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00),
1222 RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00),
1223 RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff),
1224 RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00),
1225 RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80),
1226 RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
1227 RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
1231 /***********************************************************************
1232 * EnumObjects (GDI32.@)
1234 INT WINAPI
EnumObjects( HDC hdc
, INT nObjType
,
1235 GOBJENUMPROC lpEnumFunc
, LPARAM lParam
)
1241 TRACE("%p %d %p %08lx\n", hdc
, nObjType
, lpEnumFunc
, lParam
);
1245 /* Enumerate solid pens */
1246 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
1248 pen
.lopnStyle
= PS_SOLID
;
1249 pen
.lopnWidth
.x
= 1;
1250 pen
.lopnWidth
.y
= 0;
1251 pen
.lopnColor
= solid_colors
[i
];
1252 retval
= lpEnumFunc( &pen
, lParam
);
1253 TRACE("solid pen %08lx, ret=%d\n",
1254 solid_colors
[i
], retval
);
1260 /* Enumerate solid brushes */
1261 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
1263 brush
.lbStyle
= BS_SOLID
;
1264 brush
.lbColor
= solid_colors
[i
];
1266 retval
= lpEnumFunc( &brush
, lParam
);
1267 TRACE("solid brush %08lx, ret=%d\n",
1268 solid_colors
[i
], retval
);
1272 /* Now enumerate hatched brushes */
1273 if (retval
) for (i
= HS_HORIZONTAL
; i
<= HS_DIAGCROSS
; i
++)
1275 brush
.lbStyle
= BS_HATCHED
;
1276 brush
.lbColor
= RGB(0,0,0);
1278 retval
= lpEnumFunc( &brush
, lParam
);
1279 TRACE("hatched brush %d, ret=%d\n",
1286 /* FIXME: implement Win32 types */
1287 WARN("(%d): Invalid type\n", nObjType
);
1294 /***********************************************************************
1295 * IsGDIObject (GDI.462)
1297 * returns type of object if valid (W95 system programming secrets p. 264-5)
1299 BOOL16 WINAPI
IsGDIObject16( HGDIOBJ16 handle16
)
1302 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1304 GDIOBJHDR
*object
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
1307 magic
= GDIMAGIC(object
->wMagic
) - PEN_MAGIC
+ 1;
1308 GDI_ReleaseObj( handle
);
1314 /***********************************************************************
1315 * SetObjectOwner (GDI32.@)
1317 void WINAPI
SetObjectOwner( HGDIOBJ handle
, HANDLE owner
)
1323 /***********************************************************************
1324 * MakeObjectPrivate (GDI.463)
1326 * What does that mean ?
1327 * Some little docu can be found in "Undocumented Windows",
1328 * but this is basically useless.
1329 * At least we know that this flags the GDI object's wMagic
1330 * with 0x2000 (OBJECT_PRIVATE), so we just do it.
1331 * But Wine doesn't react on that yet.
1333 void WINAPI
MakeObjectPrivate16( HGDIOBJ16 handle16
, BOOL16
private )
1335 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1336 GDIOBJHDR
*ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
1339 ERR("invalid GDI object %p !\n", handle
);
1342 ptr
->wMagic
|= OBJECT_PRIVATE
;
1343 GDI_ReleaseObj( handle
);
1347 /***********************************************************************
1348 * GdiFlush (GDI32.@)
1350 BOOL WINAPI
GdiFlush(void)
1352 return TRUE
; /* FIXME */
1356 /***********************************************************************
1357 * GdiGetBatchLimit (GDI32.@)
1359 DWORD WINAPI
GdiGetBatchLimit(void)
1361 return 1; /* FIXME */
1365 /***********************************************************************
1366 * GdiSetBatchLimit (GDI32.@)
1368 DWORD WINAPI
GdiSetBatchLimit( DWORD limit
)
1370 return 1; /* FIXME */
1374 /***********************************************************************
1375 * GdiSeeGdiDo (GDI.452)
1377 DWORD WINAPI
GdiSeeGdiDo16( WORD wReqType
, WORD wParam1
, WORD wParam2
,
1382 case 0x0001: /* LocalAlloc */
1383 return LOCAL_Alloc( GDI_HeapSel
, wParam1
, wParam3
);
1384 case 0x0002: /* LocalFree */
1385 return LOCAL_Free( GDI_HeapSel
, wParam1
);
1386 case 0x0003: /* LocalCompact */
1387 return LOCAL_Compact( GDI_HeapSel
, wParam3
, 0 );
1388 case 0x0103: /* LocalHeap */
1391 WARN("(wReqType=%04x): Unknown\n", wReqType
);
1396 /***********************************************************************
1397 * GdiSignalProc32 (GDI.610)
1399 WORD WINAPI
GdiSignalProc( UINT uCode
, DWORD dwThreadOrProcessID
,
1400 DWORD dwFlags
, HMODULE16 hModule
)
1405 /***********************************************************************
1406 * GdiInit2 (GDI.403)
1408 * See "Undocumented Windows"
1410 HANDLE16 WINAPI
GdiInit216(
1411 HANDLE16 h1
, /* [in] GDI object */
1412 HANDLE16 h2
/* [in] global data */
1415 FIXME("(%04x, %04x), stub.\n", h1
, h2
);
1417 return 0xffff; /* undefined return value */
1418 return h1
; /* FIXME: should be the memory handle of h1 */
1421 /***********************************************************************
1422 * FinalGdiInit (GDI.405)
1424 void WINAPI
FinalGdiInit16( HBRUSH16 hPattern
/* [in] fill pattern of desktop */ )
1428 /***********************************************************************
1429 * GdiFreeResources (GDI.609)
1431 WORD WINAPI
GdiFreeResources16( DWORD reserve
)
1433 return (WORD
)( (int)LOCAL_CountFree( GDI_HeapSel
) * 100 /
1434 (int)LOCAL_HeapSize( GDI_HeapSel
) );
1438 /*******************************************************************
1439 * GetColorAdjustment [GDI32.@]
1443 BOOL WINAPI
GetColorAdjustment(HDC hdc
, LPCOLORADJUSTMENT lpca
)
1445 FIXME("GetColorAdjustment, stub\n");
1449 /*******************************************************************
1450 * GetMiterLimit [GDI32.@]
1454 BOOL WINAPI
GetMiterLimit(HDC hdc
, PFLOAT peLimit
)
1456 FIXME("GetMiterLimit, stub\n");
1460 /*******************************************************************
1461 * SetMiterLimit [GDI32.@]
1465 BOOL WINAPI
SetMiterLimit(HDC hdc
, FLOAT eNewLimit
, PFLOAT peOldLimit
)
1467 FIXME("SetMiterLimit, stub\n");
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");