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 "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(gdi
);
42 #define HGDIOBJ_32(h16) ((HGDIOBJ)(ULONG_PTR)(h16))
44 /***********************************************************************
48 static const LOGBRUSH WhiteBrush
= { BS_SOLID
, RGB(255,255,255), 0 };
49 static const LOGBRUSH BlackBrush
= { BS_SOLID
, RGB(0,0,0), 0 };
50 static const LOGBRUSH NullBrush
= { BS_NULL
, 0, 0 };
52 /* FIXME: these should perhaps be BS_HATCHED, at least for 1 bitperpixel */
53 static const LOGBRUSH LtGrayBrush
= { BS_SOLID
, RGB(192,192,192), 0 };
54 static const LOGBRUSH GrayBrush
= { BS_SOLID
, RGB(128,128,128), 0 };
56 /* This is BS_HATCHED, for 1 bitperpixel. This makes the spray work in pbrush */
57 /* See HatchBrushes in x11drv for the HS_DIAGCROSS+1 hack */
58 static const LOGBRUSH DkGrayBrush
= { BS_HATCHED
, RGB(0,0,0), (HS_DIAGCROSS
+1) };
60 static const LOGPEN WhitePen
= { PS_SOLID
, { 0, 0 }, RGB(255,255,255) };
61 static const LOGPEN BlackPen
= { PS_SOLID
, { 0, 0 }, RGB(0,0,0) };
62 static const LOGPEN NullPen
= { PS_NULL
, { 0, 0 }, 0 };
64 static const LOGBRUSH DCBrush
= { BS_SOLID
, RGB(255,255,255), 0 };
65 static const LOGPEN DCPen
= { PS_SOLID
, { 0, 0 }, RGB(0,0,0) };
67 /* reserve one extra entry for the stock default bitmap */
68 /* this is what Windows does too */
69 #define NB_STOCK_OBJECTS (STOCK_LAST+2)
71 static HGDIOBJ stock_objects
[NB_STOCK_OBJECTS
];
73 static SYSLEVEL GDI_level
;
74 static CRITICAL_SECTION_DEBUG critsect_debug
=
76 0, 0, &GDI_level
.crst
,
77 { &critsect_debug
.ProcessLocksList
, &critsect_debug
.ProcessLocksList
},
78 0, 0, { 0, (DWORD
)(__FILE__
": GDI_level") }
80 static SYSLEVEL GDI_level
= { { &critsect_debug
, -1, 0, 0, 0, 0 }, 3 };
82 static WORD GDI_HeapSel
;
84 inline static BOOL
get_bool(char *buffer
)
86 return (buffer
[0] == 'y' || buffer
[0] == 'Y' ||
87 buffer
[0] == 't' || buffer
[0] == 'T' ||
92 /****************************************************************************
94 * language-independent stock fonts
98 static const LOGFONTW OEMFixedFont
=
99 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, OEM_CHARSET
,
100 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, {'\0'} };
102 static const LOGFONTW AnsiFixedFont
=
103 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
104 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, {'\0'} };
106 static const LOGFONTW AnsiVarFont
=
107 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
108 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
109 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} };
111 /******************************************************************************
113 * language-dependent stock fonts
115 * 'ANSI' charset and 'DEFAULT' charset is not same.
116 * The chars in CP_ACP should be drawn with 'DEFAULT' charset.
117 * 'ANSI' charset seems to be identical with ISO-8859-1.
118 * 'DEFAULT' charset is a language-dependent charset.
120 * 'System' font seems to be an alias for language-dependent font.
124 * language-dependenet stock fonts for all known charsets
125 * please see TranslateCharsetInfo (objects/font.c) and
126 * CharsetBindingInfo (graphics/x11drv/xfont.c),
127 * and modify entries for your language if needed.
129 struct DefaultFontInfo
133 LOGFONTW DeviceDefaultFont
;
134 LOGFONTW SystemFixedFont
;
135 LOGFONTW DefaultGuiFont
;
138 static const struct DefaultFontInfo default_fonts
[] =
142 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
143 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
144 {'S','y','s','t','e','m','\0'}
146 { /* Device Default */
147 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
148 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
152 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
153 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
156 { /* DefaultGuiFont */
157 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
158 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
159 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
162 { EASTEUROPE_CHARSET
,
164 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
165 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
166 {'S','y','s','t','e','m','\0'}
168 { /* Device Default */
169 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
170 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
174 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
175 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
178 { /* DefaultGuiFont */
179 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
180 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
181 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
186 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
187 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
188 {'S','y','s','t','e','m','\0'}
190 { /* Device Default */
191 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
192 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
196 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
197 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
200 { /* DefaultGuiFont */
201 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
202 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
203 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
208 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
209 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
210 {'S','y','s','t','e','m','\0'}
212 { /* Device Default */
213 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
214 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
218 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
219 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
222 { /* DefaultGuiFont */
223 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
224 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
225 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
230 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
231 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
232 {'S','y','s','t','e','m','\0'}
234 { /* Device Default */
235 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
236 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
240 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
241 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
244 { /* DefaultGuiFont */
245 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
246 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
247 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
252 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
253 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
254 {'S','y','s','t','e','m','\0'}
256 { /* Device Default */
257 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
258 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
262 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
263 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
266 { /* DefaultGuiFont */
267 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
268 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
269 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
274 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
275 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
276 {'S','y','s','t','e','m','\0'}
278 { /* Device Default */
279 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
280 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
284 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
285 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
288 { /* DefaultGuiFont */
289 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
290 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
291 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
296 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
297 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
298 {'S','y','s','t','e','m','\0'}
300 { /* Device Default */
301 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
302 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
306 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
307 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
310 { /* DefaultGuiFont */
311 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
312 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
313 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
318 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
319 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
320 {'S','y','s','t','e','m','\0'}
322 { /* Device Default */
323 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
324 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
328 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
329 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
332 { /* DefaultGuiFont */
333 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
334 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
335 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}
340 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
341 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
342 {'S','y','s','t','e','m','\0'}
344 { /* Device Default */
345 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
346 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
350 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
351 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
354 { /* DefaultGuiFont */
355 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
356 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
357 {'M','S',' ','P','G','o','t','h','i','c','\0'}
362 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
363 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
364 {'S','y','s','t','e','m','\0'}
366 { /* Device Default */
367 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
368 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
372 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
373 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
376 { /* DefaultGuiFont */
377 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
378 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
379 {'M','S',' ','S','o','n','g','\0'} /* FIXME: Is this correct? */
384 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
385 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
386 {'S','y','s','t','e','m','\0'}
388 { /* Device Default */
389 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
390 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
394 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
395 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
398 { /* DefaultGuiFont */
399 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
400 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
401 {'G','u','l','i','m'},
404 { CHINESEBIG5_CHARSET
,
406 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
407 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
408 {'S','y','s','t','e','m','\0'}
410 { /* Device Default */
411 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
412 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
416 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
417 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
420 { /* DefaultGuiFont */
421 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
422 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
423 {'\0'} /* FIXME - what is the native font??? */
428 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
429 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
430 {'S','y','s','t','e','m','\0'}
432 { /* Device Default */
433 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
434 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
438 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
439 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
442 { /* DefaultGuiFont */
443 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
444 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
445 {'M','S',' ','M','i','n','g','l','i','u','\0'} /* FIXME: Is this correct? */
451 /******************************************************************************
454 static const struct DefaultFontInfo
* get_default_fonts(UINT charset
)
458 for(n
=0;n
<(sizeof(default_fonts
)/sizeof(default_fonts
[0]));n
++)
460 if ( default_fonts
[n
].charset
== charset
)
461 return &default_fonts
[n
];
464 FIXME( "unhandled charset 0x%08x - use ANSI_CHARSET for default stock objects\n", charset
);
465 return &default_fonts
[0];
469 /******************************************************************************
470 * get_default_charset (internal)
472 * get the language-dependent charset that can handle CP_ACP correctly.
474 static UINT
get_default_charset( void )
480 csi
.ciCharset
= ANSI_CHARSET
;
481 if ( ! TranslateCharsetInfo( (LPDWORD
)uACP
, &csi
, TCI_SRCCODEPAGE
) )
483 FIXME( "unhandled codepage %u - use ANSI_CHARSET for default stock objects\n", uACP
);
487 return csi
.ciCharset
;
491 /******************************************************************************
494 static HFONT
create_stock_font( char const *fontName
, const LOGFONTW
*font
, HKEY hkey
)
498 char buffer
[MAX_PATH
];
501 if (!hkey
) return CreateFontIndirectW( font
);
504 sprintf(key
, "%s.Height", fontName
);
505 count
= sizeof(buffer
);
506 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
507 lf
.lfHeight
= atoi(buffer
);
509 sprintf(key
, "%s.Bold", fontName
);
510 count
= sizeof(buffer
);
511 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
512 lf
.lfWeight
= get_bool(buffer
) ? FW_BOLD
: FW_NORMAL
;
514 sprintf(key
, "%s.Italic", fontName
);
515 count
= sizeof(buffer
);
516 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
517 lf
.lfItalic
= get_bool(buffer
);
519 sprintf(key
, "%s.Underline", fontName
);
520 count
= sizeof(buffer
);
521 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
522 lf
.lfUnderline
= get_bool(buffer
);
524 sprintf(key
, "%s.StrikeOut", fontName
);
525 count
= sizeof(buffer
);
526 if(!RegQueryValueExA(hkey
, key
, 0, &type
, buffer
, &count
))
527 lf
.lfStrikeOut
= get_bool(buffer
);
528 return CreateFontIndirectW( &lf
);
532 #define TRACE_SEC(handle,text) \
533 TRACE("(%p): " text " %ld\n", (handle), GDI_level.crst.RecursionCount)
536 /***********************************************************************
539 * Increment the reference count of a GDI object.
541 inline static void inc_ref_count( HGDIOBJ handle
)
545 if ((header
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
)))
548 GDI_ReleaseObj( handle
);
553 /***********************************************************************
556 * Decrement the reference count of a GDI object.
558 inline static void dec_ref_count( HGDIOBJ handle
)
562 if ((header
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
)))
564 if (header
->dwCount
) header
->dwCount
--;
565 if (header
->dwCount
!= 0x80000000) GDI_ReleaseObj( handle
);
568 /* handle delayed DeleteObject*/
570 GDI_ReleaseObj( handle
);
571 TRACE( "executing delayed DeleteObject for %p\n", handle
);
572 DeleteObject( handle
);
578 /***********************************************************************
581 * GDI initialization.
585 HINSTANCE16 instance
;
588 const struct DefaultFontInfo
* deffonts
;
591 if (RegOpenKeyA(HKEY_LOCAL_MACHINE
, "Software\\Wine\\Wine\\Config\\Tweak.Fonts", &hkey
))
594 /* create GDI heap */
595 if ((instance
= LoadLibrary16( "GDI.EXE" )) >= 32) GDI_HeapSel
= instance
| 7;
597 /* create stock objects */
598 stock_objects
[WHITE_BRUSH
] = CreateBrushIndirect( &WhiteBrush
);
599 stock_objects
[LTGRAY_BRUSH
] = CreateBrushIndirect( &LtGrayBrush
);
600 stock_objects
[GRAY_BRUSH
] = CreateBrushIndirect( &GrayBrush
);
601 stock_objects
[DKGRAY_BRUSH
] = CreateBrushIndirect( &DkGrayBrush
);
602 stock_objects
[BLACK_BRUSH
] = CreateBrushIndirect( &BlackBrush
);
603 stock_objects
[NULL_BRUSH
] = CreateBrushIndirect( &NullBrush
);
605 stock_objects
[WHITE_PEN
] = CreatePenIndirect( &WhitePen
);
606 stock_objects
[BLACK_PEN
] = CreatePenIndirect( &BlackPen
);
607 stock_objects
[NULL_PEN
] = CreatePenIndirect( &NullPen
);
609 stock_objects
[DEFAULT_PALETTE
] = PALETTE_Init();
610 stock_objects
[DEFAULT_BITMAP
] = CreateBitmap( 1, 1, 1, 1, NULL
);
612 /* language-independent stock fonts */
613 stock_objects
[OEM_FIXED_FONT
] = create_stock_font( "OEMFixed", &OEMFixedFont
, hkey
);
614 stock_objects
[ANSI_FIXED_FONT
] = create_stock_font( "AnsiFixed", &AnsiFixedFont
, hkey
);
615 stock_objects
[ANSI_VAR_FONT
] = create_stock_font( "AnsiVar", &AnsiVarFont
, hkey
);
617 /* language-dependent stock fonts */
618 deffonts
= get_default_fonts(get_default_charset());
619 stock_objects
[SYSTEM_FONT
] = create_stock_font( "System", &deffonts
->SystemFont
, hkey
);
620 stock_objects
[DEVICE_DEFAULT_FONT
] = create_stock_font( "DeviceDefault", &deffonts
->DeviceDefaultFont
, hkey
);
621 stock_objects
[SYSTEM_FIXED_FONT
] = create_stock_font( "SystemFixed", &deffonts
->SystemFixedFont
, hkey
);
622 stock_objects
[DEFAULT_GUI_FONT
] = create_stock_font( "DefaultGui", &deffonts
->DefaultGuiFont
, hkey
);
624 stock_objects
[DC_BRUSH
] = CreateBrushIndirect( &DCBrush
);
625 stock_objects
[DC_PEN
] = CreatePenIndirect( &DCPen
);
627 /* clear the NOSYSTEM bit on all stock objects*/
628 for (i
= 0; i
< NB_STOCK_OBJECTS
; i
++)
630 if (!stock_objects
[i
])
632 if (i
== 9) continue; /* there's no stock object 9 */
633 ERR( "could not create stock object %d\n", i
);
636 ptr
= GDI_GetObjPtr( stock_objects
[i
], MAGIC_DONTCARE
);
637 ptr
->wMagic
&= ~OBJECT_NOSYSTEM
;
638 GDI_ReleaseObj( stock_objects
[i
] );
641 if (hkey
) RegCloseKey( hkey
);
648 #define FIRST_LARGE_HANDLE 16
649 #define MAX_LARGE_HANDLES ((GDI_HEAP_SIZE >> 2) - FIRST_LARGE_HANDLE)
650 static GDIOBJHDR
*large_handles
[MAX_LARGE_HANDLES
];
651 static int next_large_handle
;
653 /***********************************************************************
656 * Allocate a GDI handle from the large heap. Helper for GDI_AllocObject
658 inline static GDIOBJHDR
*alloc_large_heap( WORD size
, HGDIOBJ
*handle
)
663 for (i
= next_large_handle
+ 1; i
< MAX_LARGE_HANDLES
; i
++)
664 if (!large_handles
[i
]) goto found
;
665 for (i
= 0; i
<= next_large_handle
; i
++)
666 if (!large_handles
[i
]) goto found
;
671 if ((obj
= HeapAlloc( GetProcessHeap(), 0, size
)))
673 large_handles
[i
] = obj
;
674 *handle
= (HGDIOBJ
)(ULONG_PTR
)((i
+ FIRST_LARGE_HANDLE
) << 2);
675 next_large_handle
= i
;
681 /***********************************************************************
684 void *GDI_AllocObject( WORD size
, WORD magic
, HGDIOBJ
*handle
, const struct gdi_obj_funcs
*funcs
)
689 _EnterSysLevel( &GDI_level
);
695 if (!(hlocal
= LOCAL_Alloc( GDI_HeapSel
, LMEM_MOVEABLE
, size
))) goto error
;
696 assert( hlocal
& 2 );
697 obj
= (GDIOBJHDR
*)LOCAL_Lock( GDI_HeapSel
, hlocal
);
698 *handle
= (HGDIOBJ
)(ULONG_PTR
)hlocal
;
703 case DISABLED_DC_MAGIC
:
706 case METAFILE_DC_MAGIC
:
707 case ENHMETAFILE_MAGIC
:
708 case ENHMETAFILE_DC_MAGIC
:
709 case MEMORY_DC_MAGIC
:
712 if (!(obj
= alloc_large_heap( size
, handle
))) goto error
;
717 obj
->wMagic
= magic
|OBJECT_NOSYSTEM
;
722 TRACE_SEC( *handle
, "enter" );
726 _LeaveSysLevel( &GDI_level
);
732 /***********************************************************************
735 * The object ptr must have been obtained with GDI_GetObjPtr.
736 * The new pointer must be released with GDI_ReleaseObj.
738 void *GDI_ReallocObject( WORD size
, HGDIOBJ handle
, void *object
)
742 if ((UINT_PTR
)handle
& 2) /* GDI heap handle */
744 HLOCAL16 h
= LOWORD(handle
);
745 LOCAL_Unlock( GDI_HeapSel
, h
);
746 if ((new_handle
= (HGDIOBJ
)(ULONG_PTR
)LOCAL_ReAlloc( GDI_HeapSel
, h
, size
, LMEM_MOVEABLE
)))
748 assert( new_handle
== handle
); /* moveable handle cannot change */
749 return LOCAL_Lock( GDI_HeapSel
, h
);
754 int i
= ((ULONG_PTR
)handle
>> 2) - FIRST_LARGE_HANDLE
;
755 if (i
>= 0 && i
< MAX_LARGE_HANDLES
&& large_handles
[i
])
757 void *new_ptr
= HeapReAlloc( GetProcessHeap(), 0, large_handles
[i
], size
);
760 large_handles
[i
] = new_ptr
;
764 else ERR( "Invalid handle %p\n", handle
);
766 TRACE_SEC( handle
, "leave" );
767 _LeaveSysLevel( &GDI_level
);
772 /***********************************************************************
775 BOOL
GDI_FreeObject( HGDIOBJ handle
, void *ptr
)
777 GDIOBJHDR
*object
= ptr
;
779 object
->wMagic
= 0; /* Mark it as invalid */
780 object
->funcs
= NULL
;
781 if ((UINT_PTR
)handle
& 2) /* GDI heap handle */
783 HLOCAL16 h
= LOWORD(handle
);
784 LOCAL_Unlock( GDI_HeapSel
, h
);
785 LOCAL_Free( GDI_HeapSel
, h
);
787 else /* large heap handle */
789 int i
= ((ULONG_PTR
)handle
>> 2) - FIRST_LARGE_HANDLE
;
790 if (i
>= 0 && i
< MAX_LARGE_HANDLES
&& large_handles
[i
])
792 HeapFree( GetProcessHeap(), 0, large_handles
[i
] );
793 large_handles
[i
] = NULL
;
795 else ERR( "Invalid handle %p\n", handle
);
797 TRACE_SEC( handle
, "leave" );
798 _LeaveSysLevel( &GDI_level
);
803 /***********************************************************************
806 * Return a pointer to the GDI object associated to the handle.
807 * Return NULL if the object has the wrong magic number.
808 * The object must be released with GDI_ReleaseObj.
810 void *GDI_GetObjPtr( HGDIOBJ handle
, WORD magic
)
812 GDIOBJHDR
*ptr
= NULL
;
814 _EnterSysLevel( &GDI_level
);
816 if ((UINT_PTR
)handle
& 2) /* GDI heap handle */
818 HLOCAL16 h
= LOWORD(handle
);
819 ptr
= (GDIOBJHDR
*)LOCAL_Lock( GDI_HeapSel
, h
);
822 if (((magic
!= MAGIC_DONTCARE
) && (GDIMAGIC(ptr
->wMagic
) != magic
)) ||
823 (GDIMAGIC(ptr
->wMagic
) < FIRST_MAGIC
) ||
824 (GDIMAGIC(ptr
->wMagic
) > LAST_MAGIC
))
826 LOCAL_Unlock( GDI_HeapSel
, h
);
831 else /* large heap handle */
833 int i
= ((UINT_PTR
)handle
>> 2) - FIRST_LARGE_HANDLE
;
834 if (i
>= 0 && i
< MAX_LARGE_HANDLES
)
836 ptr
= large_handles
[i
];
837 if (ptr
&& (magic
!= MAGIC_DONTCARE
) && (GDIMAGIC(ptr
->wMagic
) != magic
)) ptr
= NULL
;
843 _LeaveSysLevel( &GDI_level
);
844 SetLastError( ERROR_INVALID_HANDLE
);
845 WARN( "Invalid handle %p\n", handle
);
847 else TRACE_SEC( handle
, "enter" );
853 /***********************************************************************
857 void GDI_ReleaseObj( HGDIOBJ handle
)
859 if ((UINT_PTR
)handle
& 2) LOCAL_Unlock( GDI_HeapSel
, LOWORD(handle
) );
860 TRACE_SEC( handle
, "leave" );
861 _LeaveSysLevel( &GDI_level
);
865 /***********************************************************************
868 void GDI_CheckNotLock(void)
870 _CheckNotSysLevel( &GDI_level
);
874 /***********************************************************************
875 * DeleteObject (GDI32.@)
877 BOOL WINAPI
DeleteObject( HGDIOBJ obj
)
879 /* Check if object is valid */
882 if (HIWORD(obj
)) return FALSE
;
884 if (!(header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
))) return FALSE
;
886 if (!(header
->wMagic
& OBJECT_NOSYSTEM
)
887 && (header
->wMagic
>= FIRST_MAGIC
) && (header
->wMagic
<= LAST_MAGIC
))
889 TRACE("Preserving system object %p\n", obj
);
890 GDI_ReleaseObj( obj
);
896 DC
*dc
= DC_GetDCPtr(header
->hdcs
->hdc
);
897 struct hdc_list
*tmp
;
899 TRACE("hdc %p has interest in %p\n", header
->hdcs
->hdc
, obj
);
902 if(dc
->funcs
->pDeleteObject
)
903 dc
->funcs
->pDeleteObject( dc
->physDev
, obj
);
904 GDI_ReleaseObj( header
->hdcs
->hdc
);
907 header
->hdcs
= header
->hdcs
->next
;
908 HeapFree(GetProcessHeap(), 0, tmp
);
913 TRACE("delayed for %p because object in use, count %ld\n", obj
, header
->dwCount
);
914 header
->dwCount
|= 0x80000000; /* mark for delete */
915 GDI_ReleaseObj( obj
);
923 if (header
->funcs
&& header
->funcs
->pDeleteObject
)
924 return header
->funcs
->pDeleteObject( obj
, header
);
926 GDI_ReleaseObj( obj
);
930 /***********************************************************************
931 * GDI_hdc_using_object
933 * Call this if the dc requires DeleteObject notification
935 BOOL
GDI_hdc_using_object(HGDIOBJ obj
, HDC hdc
)
938 struct hdc_list
**pphdc
;
940 TRACE("obj %p hdc %p\n", obj
, hdc
);
942 if (!(header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
))) return FALSE
;
944 if (!(header
->wMagic
& OBJECT_NOSYSTEM
) &&
945 (header
->wMagic
>= FIRST_MAGIC
) && (header
->wMagic
<= LAST_MAGIC
))
951 for(pphdc
= &header
->hdcs
; *pphdc
; pphdc
= &(*pphdc
)->next
)
952 if((*pphdc
)->hdc
== hdc
)
956 *pphdc
= HeapAlloc(GetProcessHeap(), 0, sizeof(**pphdc
));
958 (*pphdc
)->next
= NULL
;
965 /***********************************************************************
966 * GDI_hdc_not_using_object
969 BOOL
GDI_hdc_not_using_object(HGDIOBJ obj
, HDC hdc
)
972 struct hdc_list
*phdc
, **prev
;
974 TRACE("obj %p hdc %p\n", obj
, hdc
);
976 if (!(header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
))) return FALSE
;
978 if (!(header
->wMagic
& OBJECT_NOSYSTEM
) &&
979 (header
->wMagic
>= FIRST_MAGIC
) && (header
->wMagic
<= LAST_MAGIC
))
986 prev
= &header
->hdcs
;
989 if(phdc
->hdc
== hdc
) {
991 HeapFree(GetProcessHeap(), 0, phdc
);
1003 /***********************************************************************
1004 * GetStockObject (GDI32.@)
1006 HGDIOBJ WINAPI
GetStockObject( INT obj
)
1009 if ((obj
< 0) || (obj
>= NB_STOCK_OBJECTS
)) return 0;
1010 ret
= stock_objects
[obj
];
1011 TRACE("returning %p\n", ret
);
1016 /***********************************************************************
1017 * GetObject (GDI.82)
1019 INT16 WINAPI
GetObject16( HANDLE16 handle16
, INT16 count
, LPVOID buffer
)
1022 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1025 TRACE("%p %d %p\n", handle
, count
, buffer
);
1026 if (!count
) return 0;
1028 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1030 if (ptr
->funcs
&& ptr
->funcs
->pGetObject16
)
1031 result
= ptr
->funcs
->pGetObject16( handle
, ptr
, count
, buffer
);
1033 SetLastError( ERROR_INVALID_HANDLE
);
1035 GDI_ReleaseObj( handle
);
1040 /***********************************************************************
1041 * GetObjectA (GDI32.@)
1043 INT WINAPI
GetObjectA( HANDLE handle
, INT count
, LPVOID buffer
)
1047 TRACE("%p %d %p\n", handle
, count
, buffer
);
1049 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1051 if (ptr
->funcs
&& ptr
->funcs
->pGetObjectA
)
1052 result
= ptr
->funcs
->pGetObjectA( handle
, ptr
, count
, buffer
);
1054 SetLastError( ERROR_INVALID_HANDLE
);
1056 GDI_ReleaseObj( handle
);
1060 /***********************************************************************
1061 * GetObjectW (GDI32.@)
1063 INT WINAPI
GetObjectW( HANDLE handle
, INT count
, LPVOID buffer
)
1067 TRACE("%p %d %p\n", handle
, count
, buffer
);
1069 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1071 if (ptr
->funcs
&& ptr
->funcs
->pGetObjectW
)
1072 result
= ptr
->funcs
->pGetObjectW( handle
, ptr
, count
, buffer
);
1074 SetLastError( ERROR_INVALID_HANDLE
);
1076 GDI_ReleaseObj( handle
);
1080 /***********************************************************************
1081 * GetObjectType (GDI32.@)
1083 DWORD WINAPI
GetObjectType( HANDLE handle
)
1087 TRACE("%p\n", handle
);
1089 if (!(ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
))) return 0;
1091 switch(GDIMAGIC(ptr
->wMagic
))
1100 result
= OBJ_BITMAP
;
1109 result
= OBJ_REGION
;
1115 result
= OBJ_METADC
;
1117 case METAFILE_MAGIC
:
1118 result
= OBJ_METAFILE
;
1120 case METAFILE_DC_MAGIC
:
1121 result
= OBJ_METADC
;
1123 case ENHMETAFILE_MAGIC
:
1124 result
= OBJ_ENHMETAFILE
;
1126 case ENHMETAFILE_DC_MAGIC
:
1127 result
= OBJ_ENHMETADC
;
1129 case MEMORY_DC_MAGIC
:
1133 FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr
->wMagic
) );
1136 GDI_ReleaseObj( handle
);
1140 /***********************************************************************
1141 * GetCurrentObject (GDI32.@)
1143 HANDLE WINAPI
GetCurrentObject(HDC hdc
,UINT type
)
1146 DC
* dc
= DC_GetDCPtr( hdc
);
1151 case OBJ_PEN
: ret
= dc
->hPen
; break;
1152 case OBJ_BRUSH
: ret
= dc
->hBrush
; break;
1153 case OBJ_PAL
: ret
= dc
->hPalette
; break;
1154 case OBJ_FONT
: ret
= dc
->hFont
; break;
1155 case OBJ_BITMAP
: ret
= dc
->hBitmap
; break;
1157 /* the SDK only mentions those above */
1158 FIXME("(%p,%d): unknown type.\n",hdc
,type
);
1161 GDI_ReleaseObj( hdc
);
1167 /***********************************************************************
1168 * SelectObject (GDI32.@)
1170 HGDIOBJ WINAPI
SelectObject( HDC hdc
, HGDIOBJ handle
)
1173 GDIOBJHDR
*header
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
1174 if (!header
) return 0;
1176 TRACE("hdc=%p %p\n", hdc
, handle
);
1178 if (header
->funcs
&& header
->funcs
->pSelectObject
)
1180 ret
= header
->funcs
->pSelectObject( handle
, header
, hdc
);
1181 if (ret
&& ret
!= handle
&& (INT
)ret
> COMPLEXREGION
)
1183 inc_ref_count( handle
);
1184 dec_ref_count( ret
);
1187 GDI_ReleaseObj( handle
);
1192 /***********************************************************************
1193 * UnrealizeObject (GDI32.@)
1195 BOOL WINAPI
UnrealizeObject( HGDIOBJ obj
)
1198 /* Check if object is valid */
1200 GDIOBJHDR
* header
= GDI_GetObjPtr( obj
, MAGIC_DONTCARE
);
1201 if (!header
) return FALSE
;
1203 TRACE("%p\n", obj
);
1205 /* Unrealize object */
1207 if (header
->funcs
&& header
->funcs
->pUnrealizeObject
)
1208 result
= header
->funcs
->pUnrealizeObject( obj
, header
);
1210 GDI_ReleaseObj( obj
);
1215 /* Solid colors to enumerate */
1216 static const COLORREF solid_colors
[] =
1217 { RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff),
1218 RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00),
1219 RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00),
1220 RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff),
1221 RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00),
1222 RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80),
1223 RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
1224 RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
1228 /***********************************************************************
1229 * EnumObjects (GDI32.@)
1231 INT WINAPI
EnumObjects( HDC hdc
, INT nObjType
,
1232 GOBJENUMPROC lpEnumFunc
, LPARAM lParam
)
1238 TRACE("%p %d %p %08lx\n", hdc
, nObjType
, lpEnumFunc
, lParam
);
1242 /* Enumerate solid pens */
1243 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
1245 pen
.lopnStyle
= PS_SOLID
;
1246 pen
.lopnWidth
.x
= 1;
1247 pen
.lopnWidth
.y
= 0;
1248 pen
.lopnColor
= solid_colors
[i
];
1249 retval
= lpEnumFunc( &pen
, lParam
);
1250 TRACE("solid pen %08lx, ret=%d\n",
1251 solid_colors
[i
], retval
);
1257 /* Enumerate solid brushes */
1258 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
1260 brush
.lbStyle
= BS_SOLID
;
1261 brush
.lbColor
= solid_colors
[i
];
1263 retval
= lpEnumFunc( &brush
, lParam
);
1264 TRACE("solid brush %08lx, ret=%d\n",
1265 solid_colors
[i
], retval
);
1269 /* Now enumerate hatched brushes */
1270 if (retval
) for (i
= HS_HORIZONTAL
; i
<= HS_DIAGCROSS
; i
++)
1272 brush
.lbStyle
= BS_HATCHED
;
1273 brush
.lbColor
= RGB(0,0,0);
1275 retval
= lpEnumFunc( &brush
, lParam
);
1276 TRACE("hatched brush %d, ret=%d\n",
1283 /* FIXME: implement Win32 types */
1284 WARN("(%d): Invalid type\n", nObjType
);
1291 /***********************************************************************
1292 * IsGDIObject (GDI.462)
1294 * returns type of object if valid (W95 system programming secrets p. 264-5)
1296 BOOL16 WINAPI
IsGDIObject16( HGDIOBJ16 handle16
)
1299 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1301 GDIOBJHDR
*object
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
1304 magic
= GDIMAGIC(object
->wMagic
) - PEN_MAGIC
+ 1;
1305 GDI_ReleaseObj( handle
);
1311 /***********************************************************************
1312 * SetObjectOwner (GDI32.@)
1314 void WINAPI
SetObjectOwner( HGDIOBJ handle
, HANDLE owner
)
1320 /***********************************************************************
1321 * MakeObjectPrivate (GDI.463)
1323 * What does that mean ?
1324 * Some little docu can be found in "Undocumented Windows",
1325 * but this is basically useless.
1326 * At least we know that this flags the GDI object's wMagic
1327 * with 0x2000 (OBJECT_PRIVATE), so we just do it.
1328 * But Wine doesn't react on that yet.
1330 void WINAPI
MakeObjectPrivate16( HGDIOBJ16 handle16
, BOOL16
private )
1332 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1333 GDIOBJHDR
*ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
1336 ERR("invalid GDI object %p !\n", handle
);
1339 ptr
->wMagic
|= OBJECT_PRIVATE
;
1340 GDI_ReleaseObj( handle
);
1344 /***********************************************************************
1345 * GdiFlush (GDI32.@)
1347 BOOL WINAPI
GdiFlush(void)
1349 return TRUE
; /* FIXME */
1353 /***********************************************************************
1354 * GdiGetBatchLimit (GDI32.@)
1356 DWORD WINAPI
GdiGetBatchLimit(void)
1358 return 1; /* FIXME */
1362 /***********************************************************************
1363 * GdiSetBatchLimit (GDI32.@)
1365 DWORD WINAPI
GdiSetBatchLimit( DWORD limit
)
1367 return 1; /* FIXME */
1371 /***********************************************************************
1372 * GdiSeeGdiDo (GDI.452)
1374 DWORD WINAPI
GdiSeeGdiDo16( WORD wReqType
, WORD wParam1
, WORD wParam2
,
1379 case 0x0001: /* LocalAlloc */
1380 return LOCAL_Alloc( GDI_HeapSel
, wParam1
, wParam3
);
1381 case 0x0002: /* LocalFree */
1382 return LOCAL_Free( GDI_HeapSel
, wParam1
);
1383 case 0x0003: /* LocalCompact */
1384 return LOCAL_Compact( GDI_HeapSel
, wParam3
, 0 );
1385 case 0x0103: /* LocalHeap */
1388 WARN("(wReqType=%04x): Unknown\n", wReqType
);
1393 /***********************************************************************
1394 * GdiSignalProc32 (GDI.610)
1396 WORD WINAPI
GdiSignalProc( UINT uCode
, DWORD dwThreadOrProcessID
,
1397 DWORD dwFlags
, HMODULE16 hModule
)
1402 /***********************************************************************
1403 * GdiInit2 (GDI.403)
1405 * See "Undocumented Windows"
1407 HANDLE16 WINAPI
GdiInit216(
1408 HANDLE16 h1
, /* [in] GDI object */
1409 HANDLE16 h2
/* [in] global data */
1412 FIXME("(%04x, %04x), stub.\n", h1
, h2
);
1414 return 0xffff; /* undefined return value */
1415 return h1
; /* FIXME: should be the memory handle of h1 */
1418 /***********************************************************************
1419 * FinalGdiInit (GDI.405)
1421 void WINAPI
FinalGdiInit16( HBRUSH16 hPattern
/* [in] fill pattern of desktop */ )
1425 /***********************************************************************
1426 * GdiFreeResources (GDI.609)
1428 WORD WINAPI
GdiFreeResources16( DWORD reserve
)
1430 return (WORD
)( (int)LOCAL_CountFree( GDI_HeapSel
) * 100 /
1431 (int)LOCAL_HeapSize( GDI_HeapSel
) );
1435 /*******************************************************************
1436 * GetColorAdjustment [GDI32.@]
1440 BOOL WINAPI
GetColorAdjustment(HDC hdc
, LPCOLORADJUSTMENT lpca
)
1442 FIXME("GetColorAdjustment, stub\n");
1446 /*******************************************************************
1447 * GetMiterLimit [GDI32.@]
1451 BOOL WINAPI
GetMiterLimit(HDC hdc
, PFLOAT peLimit
)
1453 FIXME("GetMiterLimit, stub\n");
1457 /*******************************************************************
1458 * SetMiterLimit [GDI32.@]
1462 BOOL WINAPI
SetMiterLimit(HDC hdc
, FLOAT eNewLimit
, PFLOAT peOldLimit
)
1464 FIXME("SetMiterLimit, stub\n");
1468 /*******************************************************************
1469 * GdiComment [GDI32.@]
1473 BOOL WINAPI
GdiComment(HDC hdc
, UINT cbSize
, const BYTE
*lpData
)
1475 DC
*dc
= DC_GetDCPtr(hdc
);
1479 if (dc
->funcs
->pGdiComment
)
1480 ret
= dc
->funcs
->pGdiComment( dc
->physDev
, cbSize
, lpData
);
1482 GDI_ReleaseObj( hdc
);
1486 /*******************************************************************
1487 * SetColorAdjustment [GDI32.@]
1491 BOOL WINAPI
SetColorAdjustment(HDC hdc
, const COLORADJUSTMENT
* lpca
)
1493 FIXME("SetColorAdjustment, stub\n");