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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
36 #include "gdi_private.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(gdi
);
41 #define FIRST_GDI_HANDLE 32
42 #define MAX_GDI_HANDLES 16384
47 struct hdc_list
*next
;
50 struct gdi_handle_entry
52 void *obj
; /* pointer to the object-specific data */
53 const struct gdi_obj_funcs
*funcs
; /* type-specific functions */
54 struct hdc_list
*hdcs
; /* list of HDCs interested in this object */
55 WORD generation
; /* generation count for reusing handle values */
56 WORD type
; /* object type (one of the OBJ_* constants) */
57 WORD selcount
; /* number of times the object is selected in a DC */
58 WORD system
: 1; /* system object flag */
59 WORD deleted
: 1; /* whether DeleteObject has been called on this object */
62 static struct gdi_handle_entry gdi_handles
[MAX_GDI_HANDLES
];
63 static struct gdi_handle_entry
*next_free
;
64 static struct gdi_handle_entry
*next_unused
= gdi_handles
;
65 static LONG debug_count
;
66 HMODULE gdi32_module
= 0;
68 static inline HGDIOBJ
entry_to_handle( struct gdi_handle_entry
*entry
)
70 unsigned int idx
= entry
- gdi_handles
+ FIRST_GDI_HANDLE
;
71 return LongToHandle( idx
| (entry
->generation
<< 16) );
74 static inline struct gdi_handle_entry
*handle_entry( HGDIOBJ handle
)
76 unsigned int idx
= LOWORD(handle
) - FIRST_GDI_HANDLE
;
78 if (idx
< MAX_GDI_HANDLES
&& gdi_handles
[idx
].type
)
80 if (!HIWORD( handle
) || HIWORD( handle
) == gdi_handles
[idx
].generation
)
81 return &gdi_handles
[idx
];
83 if (handle
) WARN( "invalid handle %p\n", handle
);
87 /***********************************************************************
91 static const LOGBRUSH WhiteBrush
= { BS_SOLID
, RGB(255,255,255), 0 };
92 static const LOGBRUSH BlackBrush
= { BS_SOLID
, RGB(0,0,0), 0 };
93 static const LOGBRUSH NullBrush
= { BS_NULL
, 0, 0 };
95 static const LOGBRUSH LtGrayBrush
= { BS_SOLID
, RGB(192,192,192), 0 };
96 static const LOGBRUSH GrayBrush
= { BS_SOLID
, RGB(128,128,128), 0 };
97 static const LOGBRUSH DkGrayBrush
= { BS_SOLID
, RGB(64,64,64), 0 };
99 static const LOGPEN WhitePen
= { PS_SOLID
, { 0, 0 }, RGB(255,255,255) };
100 static const LOGPEN BlackPen
= { PS_SOLID
, { 0, 0 }, RGB(0,0,0) };
101 static const LOGPEN NullPen
= { PS_NULL
, { 0, 0 }, 0 };
103 static const LOGBRUSH DCBrush
= { BS_SOLID
, RGB(255,255,255), 0 };
104 static const LOGPEN DCPen
= { PS_SOLID
, { 0, 0 }, RGB(0,0,0) };
106 /* reserve one extra entry for the stock default bitmap */
107 /* this is what Windows does too */
108 #define NB_STOCK_OBJECTS (STOCK_LAST+2)
110 static HGDIOBJ stock_objects
[NB_STOCK_OBJECTS
];
111 static HGDIOBJ scaled_stock_objects
[NB_STOCK_OBJECTS
];
113 static CRITICAL_SECTION gdi_section
;
114 static CRITICAL_SECTION_DEBUG critsect_debug
=
117 { &critsect_debug
.ProcessLocksList
, &critsect_debug
.ProcessLocksList
},
118 0, 0, { (DWORD_PTR
)(__FILE__
": gdi_section") }
120 static CRITICAL_SECTION gdi_section
= { &critsect_debug
, -1, 0, 0, 0, 0 };
123 /****************************************************************************
125 * language-independent stock fonts
129 static const LOGFONTW OEMFixedFont
=
130 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, OEM_CHARSET
,
131 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, {'\0'} };
133 static const LOGFONTW AnsiFixedFont
=
134 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
135 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
136 {'C','o','u','r','i','e','r','\0'} };
138 static const LOGFONTW AnsiVarFont
=
139 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
140 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
141 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} };
143 /******************************************************************************
145 * language-dependent stock fonts
147 * 'ANSI' charset and 'DEFAULT' charset is not same.
148 * The chars in CP_ACP should be drawn with 'DEFAULT' charset.
149 * 'ANSI' charset seems to be identical with ISO-8859-1.
150 * 'DEFAULT' charset is a language-dependent charset.
152 * 'System' font seems to be an alias for language-dependent font.
156 * language-dependent stock fonts for all known charsets
157 * please see TranslateCharsetInfo (dlls/gdi/font.c) and
158 * CharsetBindingInfo (dlls/x11drv/xfont.c),
159 * and modify entries for your language if needed.
161 struct DefaultFontInfo
165 LOGFONTW DeviceDefaultFont
;
166 LOGFONTW SystemFixedFont
;
167 LOGFONTW DefaultGuiFont
;
170 static const struct DefaultFontInfo default_fonts
[] =
174 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
175 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
176 {'S','y','s','t','e','m','\0'}
178 { /* Device Default */
179 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
180 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
181 {'S','y','s','t','e','m','\0'}
184 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
185 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
186 {'C','o','u','r','i','e','r','\0'}
188 { /* DefaultGuiFont */
189 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
190 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
191 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
194 { EASTEUROPE_CHARSET
,
196 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
197 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
198 {'S','y','s','t','e','m','\0'}
200 { /* Device Default */
201 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
202 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
203 {'S','y','s','t','e','m','\0'}
206 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
207 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
208 {'C','o','u','r','i','e','r','\0'}
210 { /* DefaultGuiFont */
211 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, EASTEUROPE_CHARSET
,
212 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
213 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
218 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
219 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
220 {'S','y','s','t','e','m','\0'}
222 { /* Device Default */
223 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
224 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
225 {'S','y','s','t','e','m','\0'}
228 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
229 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
230 {'C','o','u','r','i','e','r','\0'}
232 { /* DefaultGuiFont */
233 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, RUSSIAN_CHARSET
,
234 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
235 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
240 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
241 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
242 {'S','y','s','t','e','m','\0'}
244 { /* Device Default */
245 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
246 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
247 {'S','y','s','t','e','m','\0'}
250 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
251 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
252 {'C','o','u','r','i','e','r','\0'}
254 { /* DefaultGuiFont */
255 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GREEK_CHARSET
,
256 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
257 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
262 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
263 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
264 {'S','y','s','t','e','m','\0'}
266 { /* Device Default */
267 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
268 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
269 {'S','y','s','t','e','m','\0'}
272 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
273 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
274 {'C','o','u','r','i','e','r','\0'}
276 { /* DefaultGuiFont */
277 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, TURKISH_CHARSET
,
278 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
279 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
284 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
285 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
286 {'S','y','s','t','e','m','\0'}
288 { /* Device Default */
289 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
290 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
291 {'S','y','s','t','e','m','\0'}
294 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
295 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
296 {'C','o','u','r','i','e','r','\0'}
298 { /* DefaultGuiFont */
299 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HEBREW_CHARSET
,
300 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
301 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
306 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
307 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
308 {'S','y','s','t','e','m','\0'}
310 { /* Device Default */
311 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
312 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
313 {'S','y','s','t','e','m','\0'}
316 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
317 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
318 {'C','o','u','r','i','e','r','\0'}
320 { /* DefaultGuiFont */
321 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ARABIC_CHARSET
,
322 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
323 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
328 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
329 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
330 {'S','y','s','t','e','m','\0'}
332 { /* Device Default */
333 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
334 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
335 {'S','y','s','t','e','m','\0'}
338 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
339 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
340 {'C','o','u','r','i','e','r','\0'}
342 { /* DefaultGuiFont */
343 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, BALTIC_CHARSET
,
344 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
345 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
350 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
351 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
352 {'S','y','s','t','e','m','\0'}
354 { /* Device Default */
355 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
356 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
357 {'S','y','s','t','e','m','\0'}
360 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
361 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
362 {'C','o','u','r','i','e','r','\0'}
364 { /* DefaultGuiFont */
365 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, THAI_CHARSET
,
366 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
367 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
372 18, 8, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
373 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
374 {'S','y','s','t','e','m','\0'}
376 { /* Device Default */
377 18, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
378 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
379 {'S','y','s','t','e','m','\0'}
382 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
383 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
384 {'C','o','u','r','i','e','r','\0'}
386 { /* DefaultGuiFont */
387 -12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, SHIFTJIS_CHARSET
,
388 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
389 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
394 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
395 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
396 {'S','y','s','t','e','m','\0'}
398 { /* Device Default */
399 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
400 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
401 {'S','y','s','t','e','m','\0'}
404 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
405 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
406 {'C','o','u','r','i','e','r','\0'}
408 { /* DefaultGuiFont */
409 -12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, GB2312_CHARSET
,
410 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
411 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
416 16, 8, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
417 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
418 {'S','y','s','t','e','m','\0'}
420 { /* Device Default */
421 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
422 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
423 {'S','y','s','t','e','m','\0'}
426 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
427 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
428 {'C','o','u','r','i','e','r','\0'}
430 { /* DefaultGuiFont */
431 -12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, HANGEUL_CHARSET
,
432 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
433 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
436 { CHINESEBIG5_CHARSET
,
438 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
439 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
440 {'S','y','s','t','e','m','\0'}
442 { /* Device Default */
443 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
444 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
445 {'S','y','s','t','e','m','\0'}
448 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
449 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
450 {'C','o','u','r','i','e','r','\0'}
452 { /* DefaultGuiFont */
453 -12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, CHINESEBIG5_CHARSET
,
454 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
455 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
460 16, 7, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
461 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
462 {'S','y','s','t','e','m','\0'}
464 { /* Device Default */
465 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
466 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
467 {'S','y','s','t','e','m','\0'}
470 16, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
471 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
,
472 {'C','o','u','r','i','e','r','\0'}
474 { /* DefaultGuiFont */
475 -12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, JOHAB_CHARSET
,
476 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
477 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
483 /*************************************************************************
484 * __wine_make_gdi_object_system (GDI32.@)
486 * USER has to tell GDI that its system brushes and pens are non-deletable.
487 * For a description of the GDI object magics and their flags,
488 * see "Undocumented Windows" (wrong about the OBJECT_NOSYSTEM flag, though).
490 void CDECL
__wine_make_gdi_object_system( HGDIOBJ handle
, BOOL set
)
492 struct gdi_handle_entry
*entry
;
494 EnterCriticalSection( &gdi_section
);
495 if ((entry
= handle_entry( handle
))) entry
->system
= !!set
;
496 LeaveCriticalSection( &gdi_section
);
499 /******************************************************************************
502 static const struct DefaultFontInfo
* get_default_fonts(UINT charset
)
506 for(n
= 0; n
< ARRAY_SIZE( default_fonts
); n
++)
508 if ( default_fonts
[n
].charset
== charset
)
509 return &default_fonts
[n
];
512 FIXME( "unhandled charset 0x%08x - use ANSI_CHARSET for default stock objects\n", charset
);
513 return &default_fonts
[0];
517 /******************************************************************************
518 * get_default_charset (internal)
520 * get the language-dependent charset that can handle CP_ACP correctly.
522 static UINT
get_default_charset( void )
528 csi
.ciCharset
= ANSI_CHARSET
;
529 if ( !TranslateCharsetInfo( ULongToPtr(uACP
), &csi
, TCI_SRCCODEPAGE
) )
531 FIXME( "unhandled codepage %u - use ANSI_CHARSET for default stock objects\n", uACP
);
535 return csi
.ciCharset
;
539 /***********************************************************************
542 * Retrieve the reference count of a GDI object.
543 * Note: the object must be locked otherwise the count is meaningless.
545 UINT
GDI_get_ref_count( HGDIOBJ handle
)
547 struct gdi_handle_entry
*entry
;
550 EnterCriticalSection( &gdi_section
);
551 if ((entry
= handle_entry( handle
))) ret
= entry
->selcount
;
552 LeaveCriticalSection( &gdi_section
);
557 /***********************************************************************
560 * Increment the reference count of a GDI object.
562 HGDIOBJ
GDI_inc_ref_count( HGDIOBJ handle
)
564 struct gdi_handle_entry
*entry
;
566 EnterCriticalSection( &gdi_section
);
567 if ((entry
= handle_entry( handle
))) entry
->selcount
++;
569 LeaveCriticalSection( &gdi_section
);
574 /***********************************************************************
577 * Decrement the reference count of a GDI object.
579 BOOL
GDI_dec_ref_count( HGDIOBJ handle
)
581 struct gdi_handle_entry
*entry
;
583 EnterCriticalSection( &gdi_section
);
584 if ((entry
= handle_entry( handle
)))
586 assert( entry
->selcount
);
587 if (!--entry
->selcount
&& entry
->deleted
)
589 /* handle delayed DeleteObject*/
591 LeaveCriticalSection( &gdi_section
);
592 TRACE( "executing delayed DeleteObject for %p\n", handle
);
593 DeleteObject( handle
);
597 LeaveCriticalSection( &gdi_section
);
598 return entry
!= NULL
;
601 static const WCHAR dpi_key_name
[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\0'};
602 static const WCHAR def_dpi_key_name
[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
603 static const WCHAR dpi_value_name
[] = {'L','o','g','P','i','x','e','l','s','\0'};
605 /******************************************************************************
608 * Read a DWORD value from the registry
610 static BOOL
get_reg_dword(HKEY base
, const WCHAR
*key_name
, const WCHAR
*value_name
, DWORD
*value
)
613 DWORD type
, data
, size
= sizeof(data
);
616 if (RegOpenKeyW(base
, key_name
, &key
) == ERROR_SUCCESS
)
618 if (RegQueryValueExW(key
, value_name
, NULL
, &type
, (void *)&data
, &size
) == ERROR_SUCCESS
&&
629 /******************************************************************************
632 * get the dpi from the registry
638 if (get_reg_dword(HKEY_CURRENT_USER
, dpi_key_name
, dpi_value_name
, &dpi
))
640 if (get_reg_dword(HKEY_CURRENT_CONFIG
, def_dpi_key_name
, dpi_value_name
, &dpi
))
645 /******************************************************************************
648 * Get the system DPI, based on the DPI awareness mode.
650 DWORD
get_system_dpi(void)
652 static UINT (WINAPI
*pGetDpiForSystem
)(void);
654 if (!pGetDpiForSystem
)
656 static const WCHAR user32W
[] = {'u','s','e','r','3','2','.','d','l','l',0};
657 HMODULE user
= GetModuleHandleW( user32W
);
658 if (user
) pGetDpiForSystem
= (void *)GetProcAddress( user
, "GetDpiForSystem" );
660 return pGetDpiForSystem
? pGetDpiForSystem() : 96;
663 static HFONT
create_scaled_font( const LOGFONTW
*deffont
)
675 lf
.lfHeight
= MulDiv( lf
.lfHeight
, dpi
, 96 );
676 return CreateFontIndirectW( &lf
);
679 /***********************************************************************
682 * GDI initialization.
684 BOOL WINAPI
DllMain( HINSTANCE inst
, DWORD reason
, LPVOID reserved
)
686 const struct DefaultFontInfo
* deffonts
;
689 if (reason
!= DLL_PROCESS_ATTACH
) return TRUE
;
692 DisableThreadLibraryCalls( inst
);
695 /* create stock objects */
696 stock_objects
[WHITE_BRUSH
] = CreateBrushIndirect( &WhiteBrush
);
697 stock_objects
[LTGRAY_BRUSH
] = CreateBrushIndirect( &LtGrayBrush
);
698 stock_objects
[GRAY_BRUSH
] = CreateBrushIndirect( &GrayBrush
);
699 stock_objects
[DKGRAY_BRUSH
] = CreateBrushIndirect( &DkGrayBrush
);
700 stock_objects
[BLACK_BRUSH
] = CreateBrushIndirect( &BlackBrush
);
701 stock_objects
[NULL_BRUSH
] = CreateBrushIndirect( &NullBrush
);
703 stock_objects
[WHITE_PEN
] = CreatePenIndirect( &WhitePen
);
704 stock_objects
[BLACK_PEN
] = CreatePenIndirect( &BlackPen
);
705 stock_objects
[NULL_PEN
] = CreatePenIndirect( &NullPen
);
707 stock_objects
[DEFAULT_PALETTE
] = PALETTE_Init();
708 stock_objects
[DEFAULT_BITMAP
] = CreateBitmap( 1, 1, 1, 1, NULL
);
710 /* language-independent stock fonts */
711 stock_objects
[OEM_FIXED_FONT
] = CreateFontIndirectW( &OEMFixedFont
);
712 stock_objects
[ANSI_FIXED_FONT
] = CreateFontIndirectW( &AnsiFixedFont
);
713 stock_objects
[ANSI_VAR_FONT
] = CreateFontIndirectW( &AnsiVarFont
);
715 /* language-dependent stock fonts */
716 deffonts
= get_default_fonts(get_default_charset());
717 stock_objects
[SYSTEM_FONT
] = CreateFontIndirectW( &deffonts
->SystemFont
);
718 stock_objects
[DEVICE_DEFAULT_FONT
] = CreateFontIndirectW( &deffonts
->DeviceDefaultFont
);
719 stock_objects
[SYSTEM_FIXED_FONT
] = CreateFontIndirectW( &deffonts
->SystemFixedFont
);
720 stock_objects
[DEFAULT_GUI_FONT
] = CreateFontIndirectW( &deffonts
->DefaultGuiFont
);
722 scaled_stock_objects
[OEM_FIXED_FONT
] = create_scaled_font( &OEMFixedFont
);
723 scaled_stock_objects
[SYSTEM_FONT
] = create_scaled_font( &deffonts
->SystemFont
);
724 scaled_stock_objects
[SYSTEM_FIXED_FONT
] = create_scaled_font( &deffonts
->SystemFixedFont
);
725 scaled_stock_objects
[DEFAULT_GUI_FONT
] = create_scaled_font( &deffonts
->DefaultGuiFont
);
727 stock_objects
[DC_BRUSH
] = CreateBrushIndirect( &DCBrush
);
728 stock_objects
[DC_PEN
] = CreatePenIndirect( &DCPen
);
730 /* clear the NOSYSTEM bit on all stock objects*/
731 for (i
= 0; i
< NB_STOCK_OBJECTS
; i
++)
733 if (stock_objects
[i
]) __wine_make_gdi_object_system( stock_objects
[i
], TRUE
);
734 if (scaled_stock_objects
[i
]) __wine_make_gdi_object_system( scaled_stock_objects
[i
], TRUE
);
739 static const char *gdi_obj_type( unsigned type
)
743 case OBJ_PEN
: return "OBJ_PEN";
744 case OBJ_BRUSH
: return "OBJ_BRUSH";
745 case OBJ_DC
: return "OBJ_DC";
746 case OBJ_METADC
: return "OBJ_METADC";
747 case OBJ_PAL
: return "OBJ_PAL";
748 case OBJ_FONT
: return "OBJ_FONT";
749 case OBJ_BITMAP
: return "OBJ_BITMAP";
750 case OBJ_REGION
: return "OBJ_REGION";
751 case OBJ_METAFILE
: return "OBJ_METAFILE";
752 case OBJ_MEMDC
: return "OBJ_MEMDC";
753 case OBJ_EXTPEN
: return "OBJ_EXTPEN";
754 case OBJ_ENHMETADC
: return "OBJ_ENHMETADC";
755 case OBJ_ENHMETAFILE
: return "OBJ_ENHMETAFILE";
756 case OBJ_COLORSPACE
: return "OBJ_COLORSPACE";
757 default: return "UNKNOWN";
761 static void dump_gdi_objects( void )
763 struct gdi_handle_entry
*entry
;
765 TRACE( "%u objects:\n", MAX_GDI_HANDLES
);
767 EnterCriticalSection( &gdi_section
);
768 for (entry
= gdi_handles
; entry
< next_unused
; entry
++)
771 TRACE( "handle %p FREE\n", entry_to_handle( entry
));
773 TRACE( "handle %p obj %p type %s selcount %u deleted %u\n",
774 entry_to_handle( entry
), entry
->obj
, gdi_obj_type( entry
->type
),
775 entry
->selcount
, entry
->deleted
);
777 LeaveCriticalSection( &gdi_section
);
780 /***********************************************************************
783 * Allocate a GDI handle for an object, which must have been allocated on the process heap.
785 HGDIOBJ
alloc_gdi_handle( void *obj
, WORD type
, const struct gdi_obj_funcs
*funcs
)
787 struct gdi_handle_entry
*entry
;
790 assert( type
); /* type 0 is reserved to mark free entries */
792 EnterCriticalSection( &gdi_section
);
796 next_free
= entry
->obj
;
797 else if (next_unused
< gdi_handles
+ MAX_GDI_HANDLES
)
798 entry
= next_unused
++;
801 LeaveCriticalSection( &gdi_section
);
802 ERR( "out of GDI object handles, expect a crash\n" );
803 if (TRACE_ON(gdi
)) dump_gdi_objects();
807 entry
->funcs
= funcs
;
813 if (++entry
->generation
== 0xffff) entry
->generation
= 1;
814 ret
= entry_to_handle( entry
);
815 LeaveCriticalSection( &gdi_section
);
816 TRACE( "allocated %s %p %u/%u\n", gdi_obj_type(type
), ret
,
817 InterlockedIncrement( &debug_count
), MAX_GDI_HANDLES
);
822 /***********************************************************************
825 * Free a GDI handle and return a pointer to the object.
827 void *free_gdi_handle( HGDIOBJ handle
)
830 struct gdi_handle_entry
*entry
;
832 EnterCriticalSection( &gdi_section
);
833 if ((entry
= handle_entry( handle
)))
835 TRACE( "freed %s %p %u/%u\n", gdi_obj_type( entry
->type
), handle
,
836 InterlockedDecrement( &debug_count
) + 1, MAX_GDI_HANDLES
);
839 entry
->obj
= next_free
;
842 LeaveCriticalSection( &gdi_section
);
847 /***********************************************************************
848 * get_full_gdi_handle
850 * Return the full GDI handle from a possibly truncated value.
852 HGDIOBJ
get_full_gdi_handle( HGDIOBJ handle
)
854 struct gdi_handle_entry
*entry
;
856 if (!HIWORD( handle
))
858 EnterCriticalSection( &gdi_section
);
859 if ((entry
= handle_entry( handle
))) handle
= entry_to_handle( entry
);
860 LeaveCriticalSection( &gdi_section
);
865 /***********************************************************************
868 * Return a pointer to, and the type of, the GDI object
869 * associated with the handle.
870 * The object must be released with GDI_ReleaseObj.
872 void *get_any_obj_ptr( HGDIOBJ handle
, WORD
*type
)
875 struct gdi_handle_entry
*entry
;
877 EnterCriticalSection( &gdi_section
);
879 if ((entry
= handle_entry( handle
)))
885 if (!ptr
) LeaveCriticalSection( &gdi_section
);
889 /***********************************************************************
892 * Return a pointer to the GDI object associated with the handle.
893 * Return NULL if the object has the wrong type.
894 * The object must be released with GDI_ReleaseObj.
896 void *GDI_GetObjPtr( HGDIOBJ handle
, WORD type
)
899 void *ptr
= get_any_obj_ptr( handle
, &ret_type
);
900 if (ptr
&& ret_type
!= type
)
902 GDI_ReleaseObj( handle
);
908 /***********************************************************************
912 void GDI_ReleaseObj( HGDIOBJ handle
)
914 LeaveCriticalSection( &gdi_section
);
918 /***********************************************************************
921 void GDI_CheckNotLock(void)
923 if (RtlIsCriticalSectionLockedByThread(&gdi_section
))
925 ERR( "BUG: holding GDI lock\n" );
931 /***********************************************************************
932 * DeleteObject (GDI32.@)
934 * Delete a Gdi object.
937 * obj [I] Gdi object to delete
940 * Success: TRUE. If obj was not returned from GetStockObject(), any resources
941 * it consumed are released.
942 * Failure: FALSE, if obj is not a valid Gdi object, or is currently selected
945 BOOL WINAPI
DeleteObject( HGDIOBJ obj
)
947 struct gdi_handle_entry
*entry
;
948 struct hdc_list
*hdcs_head
;
949 const struct gdi_obj_funcs
*funcs
= NULL
;
951 EnterCriticalSection( &gdi_section
);
952 if (!(entry
= handle_entry( obj
)))
954 LeaveCriticalSection( &gdi_section
);
960 TRACE("Preserving system object %p\n", obj
);
961 LeaveCriticalSection( &gdi_section
);
965 obj
= entry_to_handle( entry
); /* make it a full handle */
967 hdcs_head
= entry
->hdcs
;
972 TRACE("delayed for %p because object in use, count %u\n", obj
, entry
->selcount
);
973 entry
->deleted
= 1; /* mark for delete */
975 else funcs
= entry
->funcs
;
977 LeaveCriticalSection( &gdi_section
);
981 struct hdc_list
*next
= hdcs_head
->next
;
982 DC
*dc
= get_dc_ptr(hdcs_head
->hdc
);
984 TRACE("hdc %p has interest in %p\n", hdcs_head
->hdc
, obj
);
987 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pDeleteObject
);
988 physdev
->funcs
->pDeleteObject( physdev
, obj
);
989 release_dc_ptr( dc
);
991 HeapFree(GetProcessHeap(), 0, hdcs_head
);
997 if (funcs
&& funcs
->pDeleteObject
) return funcs
->pDeleteObject( obj
);
1001 /***********************************************************************
1002 * GDI_hdc_using_object
1004 * Call this if the dc requires DeleteObject notification
1006 void GDI_hdc_using_object(HGDIOBJ obj
, HDC hdc
)
1008 struct gdi_handle_entry
*entry
;
1009 struct hdc_list
*phdc
;
1011 TRACE("obj %p hdc %p\n", obj
, hdc
);
1013 EnterCriticalSection( &gdi_section
);
1014 if ((entry
= handle_entry( obj
)) && !entry
->system
)
1016 for (phdc
= entry
->hdcs
; phdc
; phdc
= phdc
->next
)
1017 if (phdc
->hdc
== hdc
) break;
1021 phdc
= HeapAlloc(GetProcessHeap(), 0, sizeof(*phdc
));
1023 phdc
->next
= entry
->hdcs
;
1027 LeaveCriticalSection( &gdi_section
);
1030 /***********************************************************************
1031 * GDI_hdc_not_using_object
1034 void GDI_hdc_not_using_object(HGDIOBJ obj
, HDC hdc
)
1036 struct gdi_handle_entry
*entry
;
1037 struct hdc_list
**pphdc
;
1039 TRACE("obj %p hdc %p\n", obj
, hdc
);
1041 EnterCriticalSection( &gdi_section
);
1042 if ((entry
= handle_entry( obj
)) && !entry
->system
)
1044 for (pphdc
= &entry
->hdcs
; *pphdc
; pphdc
= &(*pphdc
)->next
)
1045 if ((*pphdc
)->hdc
== hdc
)
1047 struct hdc_list
*phdc
= *pphdc
;
1048 *pphdc
= phdc
->next
;
1049 HeapFree(GetProcessHeap(), 0, phdc
);
1053 LeaveCriticalSection( &gdi_section
);
1056 /***********************************************************************
1057 * GetStockObject (GDI32.@)
1059 HGDIOBJ WINAPI
GetStockObject( INT obj
)
1061 if ((obj
< 0) || (obj
>= NB_STOCK_OBJECTS
)) return 0;
1064 case OEM_FIXED_FONT
:
1066 case SYSTEM_FIXED_FONT
:
1067 case DEFAULT_GUI_FONT
:
1068 if (get_system_dpi() != 96) return scaled_stock_objects
[obj
];
1071 return stock_objects
[obj
];
1075 /***********************************************************************
1076 * GetObjectA (GDI32.@)
1078 INT WINAPI
GetObjectA( HGDIOBJ handle
, INT count
, LPVOID buffer
)
1080 struct gdi_handle_entry
*entry
;
1081 const struct gdi_obj_funcs
*funcs
= NULL
;
1084 TRACE("%p %d %p\n", handle
, count
, buffer
);
1086 EnterCriticalSection( &gdi_section
);
1087 if ((entry
= handle_entry( handle
)))
1089 funcs
= entry
->funcs
;
1090 handle
= entry_to_handle( entry
); /* make it a full handle */
1092 LeaveCriticalSection( &gdi_section
);
1096 if (!funcs
->pGetObjectA
)
1097 SetLastError( ERROR_INVALID_HANDLE
);
1098 else if (buffer
&& ((ULONG_PTR
)buffer
>> 16) == 0) /* catch apps getting argument order wrong */
1099 SetLastError( ERROR_NOACCESS
);
1101 result
= funcs
->pGetObjectA( handle
, count
, buffer
);
1106 /***********************************************************************
1107 * GetObjectW (GDI32.@)
1109 INT WINAPI
GetObjectW( HGDIOBJ handle
, INT count
, LPVOID buffer
)
1111 struct gdi_handle_entry
*entry
;
1112 const struct gdi_obj_funcs
*funcs
= NULL
;
1115 TRACE("%p %d %p\n", handle
, count
, buffer
);
1117 EnterCriticalSection( &gdi_section
);
1118 if ((entry
= handle_entry( handle
)))
1120 funcs
= entry
->funcs
;
1121 handle
= entry_to_handle( entry
); /* make it a full handle */
1123 LeaveCriticalSection( &gdi_section
);
1127 if (!funcs
->pGetObjectW
)
1128 SetLastError( ERROR_INVALID_HANDLE
);
1129 else if (buffer
&& ((ULONG_PTR
)buffer
>> 16) == 0) /* catch apps getting argument order wrong */
1130 SetLastError( ERROR_NOACCESS
);
1132 result
= funcs
->pGetObjectW( handle
, count
, buffer
);
1137 /***********************************************************************
1138 * GetObjectType (GDI32.@)
1140 DWORD WINAPI
GetObjectType( HGDIOBJ handle
)
1142 struct gdi_handle_entry
*entry
;
1145 EnterCriticalSection( &gdi_section
);
1146 if ((entry
= handle_entry( handle
))) result
= entry
->type
;
1147 LeaveCriticalSection( &gdi_section
);
1149 TRACE("%p -> %u\n", handle
, result
);
1150 if (!result
) SetLastError( ERROR_INVALID_HANDLE
);
1154 /***********************************************************************
1155 * GetCurrentObject (GDI32.@)
1157 * Get the currently selected object of a given type in a device context.
1160 * hdc [I] Device context to get the current object from
1161 * type [I] Type of current object to get (OBJ_* defines from "wingdi.h")
1164 * Success: The current object of the given type selected in hdc.
1165 * Failure: A NULL handle.
1168 * - only the following object types are supported:
1175 HGDIOBJ WINAPI
GetCurrentObject(HDC hdc
,UINT type
)
1178 DC
* dc
= get_dc_ptr( hdc
);
1183 case OBJ_EXTPEN
: /* fall through */
1184 case OBJ_PEN
: ret
= dc
->hPen
; break;
1185 case OBJ_BRUSH
: ret
= dc
->hBrush
; break;
1186 case OBJ_PAL
: ret
= dc
->hPalette
; break;
1187 case OBJ_FONT
: ret
= dc
->hFont
; break;
1188 case OBJ_BITMAP
: ret
= dc
->hBitmap
; break;
1190 /* tests show that OBJ_REGION is explicitly ignored */
1191 case OBJ_REGION
: break;
1193 /* the SDK only mentions those above */
1194 FIXME("(%p,%d): unknown type.\n",hdc
,type
);
1197 release_dc_ptr( dc
);
1202 /***********************************************************************
1203 * SelectObject (GDI32.@)
1205 * Select a Gdi object into a device context.
1208 * hdc [I] Device context to associate the object with
1209 * hObj [I] Gdi object to associate with hdc
1212 * Success: A non-NULL handle representing the previously selected object of
1213 * the same type as hObj.
1214 * Failure: A NULL object. If hdc is invalid, GetLastError() returns ERROR_INVALID_HANDLE.
1215 * if hObj is not a valid object handle, no last error is set. In either
1216 * case, hdc is unaffected by the call.
1218 HGDIOBJ WINAPI
SelectObject( HDC hdc
, HGDIOBJ hObj
)
1220 struct gdi_handle_entry
*entry
;
1221 const struct gdi_obj_funcs
*funcs
= NULL
;
1223 TRACE( "(%p,%p)\n", hdc
, hObj
);
1225 EnterCriticalSection( &gdi_section
);
1226 if ((entry
= handle_entry( hObj
)))
1228 funcs
= entry
->funcs
;
1229 hObj
= entry_to_handle( entry
); /* make it a full handle */
1231 LeaveCriticalSection( &gdi_section
);
1233 if (funcs
&& funcs
->pSelectObject
) return funcs
->pSelectObject( hObj
, hdc
);
1238 /***********************************************************************
1239 * UnrealizeObject (GDI32.@)
1241 BOOL WINAPI
UnrealizeObject( HGDIOBJ obj
)
1243 const struct gdi_obj_funcs
*funcs
= NULL
;
1244 struct gdi_handle_entry
*entry
;
1246 EnterCriticalSection( &gdi_section
);
1247 if ((entry
= handle_entry( obj
)))
1249 funcs
= entry
->funcs
;
1250 obj
= entry_to_handle( entry
); /* make it a full handle */
1252 LeaveCriticalSection( &gdi_section
);
1254 if (funcs
&& funcs
->pUnrealizeObject
) return funcs
->pUnrealizeObject( obj
);
1255 return funcs
!= NULL
;
1259 /* Solid colors to enumerate */
1260 static const COLORREF solid_colors
[] =
1261 { RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff),
1262 RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00),
1263 RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00),
1264 RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff),
1265 RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00),
1266 RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80),
1267 RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
1268 RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
1272 /***********************************************************************
1273 * EnumObjects (GDI32.@)
1275 INT WINAPI
EnumObjects( HDC hdc
, INT nObjType
,
1276 GOBJENUMPROC lpEnumFunc
, LPARAM lParam
)
1283 TRACE("%p %d %p %08lx\n", hdc
, nObjType
, lpEnumFunc
, lParam
);
1287 /* Enumerate solid pens */
1288 for (i
= 0; i
< ARRAY_SIZE( solid_colors
); i
++)
1290 pen
.lopnStyle
= PS_SOLID
;
1291 pen
.lopnWidth
.x
= 1;
1292 pen
.lopnWidth
.y
= 0;
1293 pen
.lopnColor
= solid_colors
[i
];
1294 retval
= lpEnumFunc( &pen
, lParam
);
1295 TRACE("solid pen %08x, ret=%d\n",
1296 solid_colors
[i
], retval
);
1302 /* Enumerate solid brushes */
1303 for (i
= 0; i
< ARRAY_SIZE( solid_colors
); i
++)
1305 brush
.lbStyle
= BS_SOLID
;
1306 brush
.lbColor
= solid_colors
[i
];
1308 retval
= lpEnumFunc( &brush
, lParam
);
1309 TRACE("solid brush %08x, ret=%d\n",
1310 solid_colors
[i
], retval
);
1314 /* Now enumerate hatched brushes */
1315 if (retval
) for (i
= HS_HORIZONTAL
; i
<= HS_DIAGCROSS
; i
++)
1317 brush
.lbStyle
= BS_HATCHED
;
1318 brush
.lbColor
= RGB(0,0,0);
1320 retval
= lpEnumFunc( &brush
, lParam
);
1321 TRACE("hatched brush %d, ret=%d\n",
1328 /* FIXME: implement Win32 types */
1329 WARN("(%d): Invalid type\n", nObjType
);
1336 /***********************************************************************
1337 * SetObjectOwner (GDI32.@)
1339 void WINAPI
SetObjectOwner( HGDIOBJ handle
, HANDLE owner
)
1344 /***********************************************************************
1345 * GdiInitializeLanguagePack (GDI32.@)
1347 DWORD WINAPI
GdiInitializeLanguagePack( DWORD arg
)
1353 /***********************************************************************
1354 * GdiFlush (GDI32.@)
1356 BOOL WINAPI
GdiFlush(void)
1358 return TRUE
; /* FIXME */
1362 /***********************************************************************
1363 * GdiGetBatchLimit (GDI32.@)
1365 DWORD WINAPI
GdiGetBatchLimit(void)
1367 return 1; /* FIXME */
1371 /***********************************************************************
1372 * GdiSetBatchLimit (GDI32.@)
1374 DWORD WINAPI
GdiSetBatchLimit( DWORD limit
)
1376 return 1; /* FIXME */
1380 /*******************************************************************
1381 * GetColorAdjustment [GDI32.@]
1385 BOOL WINAPI
GetColorAdjustment(HDC hdc
, LPCOLORADJUSTMENT lpca
)
1391 /*******************************************************************
1392 * GdiComment [GDI32.@]
1396 BOOL WINAPI
GdiComment(HDC hdc
, UINT cbSize
, const BYTE
*lpData
)
1398 DC
*dc
= get_dc_ptr(hdc
);
1403 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, pGdiComment
);
1404 ret
= physdev
->funcs
->pGdiComment( physdev
, cbSize
, lpData
);
1405 release_dc_ptr( dc
);
1410 /*******************************************************************
1411 * SetColorAdjustment [GDI32.@]
1415 BOOL WINAPI
SetColorAdjustment(HDC hdc
, const COLORADJUSTMENT
* lpca
)