Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * GDI functions |
| 3 | * |
| 4 | * Copyright 1993 Alexandre Julliard |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 5 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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 |
Alexandre Julliard | a2f2e01 | 1995-06-06 16:40:35 +0000 | [diff] [blame] | 19 | */ |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 20 | |
Patrik Stridvall | d96e1f1 | 1999-07-04 13:31:03 +0000 | [diff] [blame] | 21 | #include "config.h" |
| 22 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 23 | #include <assert.h> |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 24 | #include <stdlib.h> |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 25 | #include <stdarg.h> |
Jeremy White | d3e22d9 | 2000-02-10 19:03:02 +0000 | [diff] [blame] | 26 | #include <stdio.h> |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 27 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 28 | #include "windef.h" |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 29 | #include "winbase.h" |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 30 | #include "wingdi.h" |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 31 | #include "winreg.h" |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 32 | #include "winerror.h" |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 33 | |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 34 | #include "bitmap.h" |
Alexandre Julliard | db0747d | 2000-12-13 20:23:41 +0000 | [diff] [blame] | 35 | #include "local.h" |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 36 | #include "palette.h" |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 37 | #include "gdi.h" |
Alexandre Julliard | 6ec42c0 | 2004-01-15 00:35:38 +0000 | [diff] [blame] | 38 | #include "gdi_private.h" |
Alexandre Julliard | 9169729 | 2002-12-03 19:18:41 +0000 | [diff] [blame] | 39 | #include "wine/debug.h" |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 40 | |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 41 | WINE_DEFAULT_DEBUG_CHANNEL(gdi); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 42 | |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 43 | #define HGDIOBJ_32(h16) ((HGDIOBJ)(ULONG_PTR)(h16)) |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 44 | |
Alexandre Julliard | 6ec42c0 | 2004-01-15 00:35:38 +0000 | [diff] [blame] | 45 | #define GDI_HEAP_SIZE 0xffe0 |
| 46 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 47 | /*********************************************************************** |
Vincent BĂ©ron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 48 | * GDI stock objects |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 49 | */ |
| 50 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 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 }; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 54 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 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 }; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 58 | |
Alexandre Julliard | 33072e1 | 1997-06-29 18:08:02 +0000 | [diff] [blame] | 59 | /* This is BS_HATCHED, for 1 bitperpixel. This makes the spray work in pbrush */ |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 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) }; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 62 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 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 }; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 66 | |
Ulrich Czekalla | 16ff668 | 2003-11-05 01:43:57 +0000 | [diff] [blame] | 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) }; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 69 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 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) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 73 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 74 | static HGDIOBJ stock_objects[NB_STOCK_OBJECTS]; |
Gerard Patel | d1795f6 | 2000-01-09 20:52:53 +0000 | [diff] [blame] | 75 | |
Alexandre Julliard | 19b6a49 | 2003-08-12 23:50:54 +0000 | [diff] [blame] | 76 | static SYSLEVEL GDI_level; |
| 77 | static CRITICAL_SECTION_DEBUG critsect_debug = |
| 78 | { |
| 79 | 0, 0, &GDI_level.crst, |
| 80 | { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, |
| 81 | 0, 0, { 0, (DWORD)(__FILE__ ": GDI_level") } |
| 82 | }; |
| 83 | static SYSLEVEL GDI_level = { { &critsect_debug, -1, 0, 0, 0, 0 }, 3 }; |
| 84 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 85 | static WORD GDI_HeapSel; |
| 86 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 87 | inline static BOOL get_bool(char *buffer) |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 88 | { |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 89 | return (buffer[0] == 'y' || buffer[0] == 'Y' || |
| 90 | buffer[0] == 't' || buffer[0] == 'T' || |
| 91 | buffer[0] == '1'); |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 92 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 93 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 94 | |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 95 | /**************************************************************************** |
| 96 | * |
| 97 | * language-independent stock fonts |
| 98 | * |
| 99 | */ |
| 100 | |
| 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'} }; |
| 104 | |
| 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'} }; |
| 108 | |
| 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'} }; |
| 113 | |
| 114 | /****************************************************************************** |
| 115 | * |
| 116 | * language-dependent stock fonts |
| 117 | * |
| 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. |
| 122 | * |
| 123 | * 'System' font seems to be an alias for language-dependent font. |
| 124 | */ |
| 125 | |
| 126 | /* |
| 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. |
| 131 | */ |
| 132 | struct DefaultFontInfo |
| 133 | { |
| 134 | UINT charset; |
| 135 | LOGFONTW SystemFont; |
| 136 | LOGFONTW DeviceDefaultFont; |
| 137 | LOGFONTW SystemFixedFont; |
| 138 | LOGFONTW DefaultGuiFont; |
| 139 | }; |
| 140 | |
| 141 | static const struct DefaultFontInfo default_fonts[] = |
| 142 | { |
| 143 | { ANSI_CHARSET, |
| 144 | { /* System */ |
| 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'} |
| 148 | }, |
| 149 | { /* Device Default */ |
| 150 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, |
| 151 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 152 | {'\0'} |
| 153 | }, |
| 154 | { /* System Fixed */ |
| 155 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, |
| 156 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 157 | {'\0'} |
| 158 | }, |
| 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'} |
| 163 | }, |
| 164 | }, |
| 165 | { EASTEUROPE_CHARSET, |
| 166 | { /* System */ |
| 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'} |
| 170 | }, |
| 171 | { /* Device Default */ |
| 172 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET, |
| 173 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 174 | {'\0'} |
| 175 | }, |
| 176 | { /* System Fixed */ |
| 177 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET, |
| 178 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 179 | {'\0'} |
| 180 | }, |
| 181 | { /* DefaultGuiFont */ |
| 182 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET, |
| 183 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Dmitry Timoshkov | 5cd279a | 2002-06-13 23:59:53 +0000 | [diff] [blame] | 184 | {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 185 | }, |
| 186 | }, |
| 187 | { RUSSIAN_CHARSET, |
| 188 | { /* System */ |
| 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'} |
| 192 | }, |
| 193 | { /* Device Default */ |
| 194 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET, |
| 195 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 196 | {'\0'} |
| 197 | }, |
| 198 | { /* System Fixed */ |
| 199 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET, |
| 200 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 201 | {'\0'} |
| 202 | }, |
| 203 | { /* DefaultGuiFont */ |
| 204 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET, |
| 205 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Dmitry Timoshkov | 5cd279a | 2002-06-13 23:59:53 +0000 | [diff] [blame] | 206 | {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 207 | }, |
| 208 | }, |
| 209 | { GREEK_CHARSET, |
| 210 | { /* System */ |
| 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'} |
| 214 | }, |
| 215 | { /* Device Default */ |
| 216 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET, |
| 217 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 218 | {'\0'} |
| 219 | }, |
| 220 | { /* System Fixed */ |
| 221 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET, |
| 222 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 223 | {'\0'} |
| 224 | }, |
| 225 | { /* DefaultGuiFont */ |
| 226 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET, |
| 227 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Dmitry Timoshkov | 5cd279a | 2002-06-13 23:59:53 +0000 | [diff] [blame] | 228 | {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 229 | }, |
| 230 | }, |
| 231 | { TURKISH_CHARSET, |
| 232 | { /* System */ |
| 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'} |
| 236 | }, |
| 237 | { /* Device Default */ |
| 238 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET, |
| 239 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 240 | {'\0'} |
| 241 | }, |
| 242 | { /* System Fixed */ |
| 243 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET, |
| 244 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 245 | {'\0'} |
| 246 | }, |
| 247 | { /* DefaultGuiFont */ |
| 248 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET, |
| 249 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Dmitry Timoshkov | 5cd279a | 2002-06-13 23:59:53 +0000 | [diff] [blame] | 250 | {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 251 | }, |
| 252 | }, |
| 253 | { HEBREW_CHARSET, |
| 254 | { /* System */ |
| 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'} |
| 258 | }, |
| 259 | { /* Device Default */ |
| 260 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET, |
| 261 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 262 | {'\0'} |
| 263 | }, |
| 264 | { /* System Fixed */ |
| 265 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET, |
| 266 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 267 | {'\0'} |
| 268 | }, |
| 269 | { /* DefaultGuiFont */ |
| 270 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET, |
| 271 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Dmitry Timoshkov | 5cd279a | 2002-06-13 23:59:53 +0000 | [diff] [blame] | 272 | {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 273 | }, |
| 274 | }, |
| 275 | { ARABIC_CHARSET, |
| 276 | { /* System */ |
| 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'} |
| 280 | }, |
| 281 | { /* Device Default */ |
| 282 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET, |
| 283 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 284 | {'\0'} |
| 285 | }, |
| 286 | { /* System Fixed */ |
| 287 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET, |
| 288 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 289 | {'\0'} |
| 290 | }, |
| 291 | { /* DefaultGuiFont */ |
| 292 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET, |
| 293 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Dmitry Timoshkov | 5cd279a | 2002-06-13 23:59:53 +0000 | [diff] [blame] | 294 | {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 295 | }, |
| 296 | }, |
| 297 | { BALTIC_CHARSET, |
| 298 | { /* System */ |
| 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'} |
| 302 | }, |
| 303 | { /* Device Default */ |
| 304 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET, |
| 305 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 306 | {'\0'} |
| 307 | }, |
| 308 | { /* System Fixed */ |
| 309 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET, |
| 310 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 311 | {'\0'} |
| 312 | }, |
| 313 | { /* DefaultGuiFont */ |
| 314 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET, |
| 315 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Dmitry Timoshkov | 5cd279a | 2002-06-13 23:59:53 +0000 | [diff] [blame] | 316 | {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 317 | }, |
| 318 | }, |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 319 | { THAI_CHARSET, |
| 320 | { /* System */ |
| 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'} |
| 324 | }, |
| 325 | { /* Device Default */ |
| 326 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET, |
| 327 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 328 | {'\0'} |
| 329 | }, |
| 330 | { /* System Fixed */ |
| 331 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET, |
| 332 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 333 | {'\0'} |
| 334 | }, |
| 335 | { /* DefaultGuiFont */ |
| 336 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET, |
| 337 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Dmitry Timoshkov | 5cd279a | 2002-06-13 23:59:53 +0000 | [diff] [blame] | 338 | {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 339 | }, |
| 340 | }, |
| 341 | { SHIFTJIS_CHARSET, |
| 342 | { /* System */ |
| 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'} |
| 346 | }, |
| 347 | { /* Device Default */ |
| 348 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, |
| 349 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 350 | {'\0'} |
| 351 | }, |
| 352 | { /* System Fixed */ |
| 353 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, |
| 354 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 355 | {'\0'} |
| 356 | }, |
| 357 | { /* DefaultGuiFont */ |
| 358 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, |
| 359 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Vik Kumar | 103f989 | 2003-12-12 05:59:14 +0000 | [diff] [blame] | 360 | {'M','S',' ','U','I',' ','G','o','t','h','i','c','\0'} |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 361 | }, |
| 362 | }, |
| 363 | { GB2312_CHARSET, |
| 364 | { /* System */ |
| 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'} |
| 368 | }, |
| 369 | { /* Device Default */ |
| 370 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET, |
| 371 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 372 | {'\0'} |
| 373 | }, |
| 374 | { /* System Fixed */ |
| 375 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET, |
| 376 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 377 | {'\0'} |
| 378 | }, |
| 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? */ |
| 383 | }, |
| 384 | }, |
| 385 | { HANGEUL_CHARSET, |
| 386 | { /* System */ |
| 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'} |
| 390 | }, |
| 391 | { /* Device Default */ |
| 392 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET, |
| 393 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 394 | {'\0'} |
| 395 | }, |
| 396 | { /* System Fixed */ |
| 397 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET, |
| 398 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 399 | {'\0'} |
| 400 | }, |
| 401 | { /* DefaultGuiFont */ |
| 402 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET, |
| 403 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Won Kyu Park | c6228b3 | 2002-06-13 19:10:55 +0000 | [diff] [blame] | 404 | {'G','u','l','i','m'}, |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 405 | }, |
| 406 | }, |
| 407 | { CHINESEBIG5_CHARSET, |
| 408 | { /* System */ |
| 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'} |
| 412 | }, |
| 413 | { /* Device Default */ |
| 414 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET, |
| 415 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 416 | {'\0'} |
| 417 | }, |
| 418 | { /* System Fixed */ |
| 419 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET, |
| 420 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 421 | {'\0'} |
| 422 | }, |
| 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??? */ |
| 427 | }, |
| 428 | }, |
| 429 | { JOHAB_CHARSET, |
| 430 | { /* System */ |
| 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'} |
| 434 | }, |
| 435 | { /* Device Default */ |
| 436 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET, |
| 437 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
| 438 | {'\0'} |
| 439 | }, |
| 440 | { /* System Fixed */ |
| 441 | 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET, |
| 442 | 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, |
| 443 | {'\0'} |
| 444 | }, |
| 445 | { /* DefaultGuiFont */ |
| 446 | -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET, |
| 447 | 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, |
Dmitry Timoshkov | 5cd279a | 2002-06-13 23:59:53 +0000 | [diff] [blame] | 448 | {'M','S',' ','M','i','n','g','l','i','u','\0'} /* FIXME: Is this correct? */ |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 449 | }, |
| 450 | }, |
| 451 | }; |
| 452 | |
| 453 | |
| 454 | /****************************************************************************** |
| 455 | * get_default_fonts |
| 456 | */ |
| 457 | static const struct DefaultFontInfo* get_default_fonts(UINT charset) |
| 458 | { |
| 459 | int n; |
| 460 | |
| 461 | for(n=0;n<(sizeof(default_fonts)/sizeof(default_fonts[0]));n++) |
| 462 | { |
| 463 | if ( default_fonts[n].charset == charset ) |
| 464 | return &default_fonts[n]; |
| 465 | } |
| 466 | |
| 467 | FIXME( "unhandled charset 0x%08x - use ANSI_CHARSET for default stock objects\n", charset ); |
| 468 | return &default_fonts[0]; |
| 469 | } |
| 470 | |
| 471 | |
| 472 | /****************************************************************************** |
| 473 | * get_default_charset (internal) |
| 474 | * |
| 475 | * get the language-dependent charset that can handle CP_ACP correctly. |
| 476 | */ |
| 477 | static UINT get_default_charset( void ) |
| 478 | { |
| 479 | CHARSETINFO csi; |
| 480 | UINT uACP; |
| 481 | |
| 482 | uACP = GetACP(); |
| 483 | csi.ciCharset = ANSI_CHARSET; |
| 484 | if ( ! TranslateCharsetInfo( (LPDWORD)uACP, &csi, TCI_SRCCODEPAGE ) ) |
| 485 | { |
| 486 | FIXME( "unhandled codepage %u - use ANSI_CHARSET for default stock objects\n", uACP ); |
| 487 | return ANSI_CHARSET; |
| 488 | } |
| 489 | |
| 490 | return csi.ciCharset; |
| 491 | } |
| 492 | |
| 493 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 494 | /****************************************************************************** |
| 495 | * create_stock_font |
| 496 | */ |
| 497 | static HFONT create_stock_font( char const *fontName, const LOGFONTW *font, HKEY hkey ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 498 | { |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 499 | LOGFONTW lf; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 500 | char key[256]; |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 501 | char buffer[MAX_PATH]; |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 502 | DWORD type, count; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 503 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 504 | if (!hkey) return CreateFontIndirectW( font ); |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 505 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 506 | lf = *font; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 507 | sprintf(key, "%s.Height", fontName); |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 508 | count = sizeof(buffer); |
| 509 | if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count)) |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 510 | lf.lfHeight = atoi(buffer); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 511 | |
| 512 | sprintf(key, "%s.Bold", fontName); |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 513 | count = sizeof(buffer); |
| 514 | if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count)) |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 515 | lf.lfWeight = get_bool(buffer) ? FW_BOLD : FW_NORMAL; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 516 | |
| 517 | sprintf(key, "%s.Italic", fontName); |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 518 | count = sizeof(buffer); |
| 519 | if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count)) |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 520 | lf.lfItalic = get_bool(buffer); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 521 | |
| 522 | sprintf(key, "%s.Underline", fontName); |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 523 | count = sizeof(buffer); |
| 524 | if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count)) |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 525 | lf.lfUnderline = get_bool(buffer); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 526 | |
| 527 | sprintf(key, "%s.StrikeOut", fontName); |
Dmitry Timoshkov | 4328e51 | 2001-05-22 19:18:06 +0000 | [diff] [blame] | 528 | count = sizeof(buffer); |
| 529 | if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count)) |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 530 | lf.lfStrikeOut = get_bool(buffer); |
| 531 | return CreateFontIndirectW( &lf ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 532 | } |
| 533 | |
Francis Beaudet | 12668f5 | 1999-10-31 17:32:26 +0000 | [diff] [blame] | 534 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 535 | #define TRACE_SEC(handle,text) \ |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 536 | TRACE("(%p): " text " %ld\n", (handle), GDI_level.crst.RecursionCount) |
Francis Beaudet | 12668f5 | 1999-10-31 17:32:26 +0000 | [diff] [blame] | 537 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 538 | |
Francis Beaudet | 12668f5 | 1999-10-31 17:32:26 +0000 | [diff] [blame] | 539 | /*********************************************************************** |
Uwe Bonnes | 8e5e003 | 2001-08-20 19:17:28 +0000 | [diff] [blame] | 540 | * inc_ref_count |
| 541 | * |
| 542 | * Increment the reference count of a GDI object. |
| 543 | */ |
| 544 | inline static void inc_ref_count( HGDIOBJ handle ) |
| 545 | { |
| 546 | GDIOBJHDR *header; |
| 547 | |
| 548 | if ((header = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) |
| 549 | { |
| 550 | header->dwCount++; |
| 551 | GDI_ReleaseObj( handle ); |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | |
| 556 | /*********************************************************************** |
| 557 | * dec_ref_count |
| 558 | * |
| 559 | * Decrement the reference count of a GDI object. |
| 560 | */ |
| 561 | inline static void dec_ref_count( HGDIOBJ handle ) |
| 562 | { |
| 563 | GDIOBJHDR *header; |
| 564 | |
| 565 | if ((header = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) |
| 566 | { |
| 567 | if (header->dwCount) header->dwCount--; |
| 568 | if (header->dwCount != 0x80000000) GDI_ReleaseObj( handle ); |
| 569 | else |
| 570 | { |
| 571 | /* handle delayed DeleteObject*/ |
| 572 | header->dwCount = 0; |
| 573 | GDI_ReleaseObj( handle ); |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 574 | TRACE( "executing delayed DeleteObject for %p\n", handle ); |
Uwe Bonnes | 8e5e003 | 2001-08-20 19:17:28 +0000 | [diff] [blame] | 575 | DeleteObject( handle ); |
| 576 | } |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | |
| 581 | /*********************************************************************** |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 582 | * GDI_Init |
| 583 | * |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 584 | * GDI initialization. |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 585 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 586 | BOOL GDI_Init(void) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 587 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 588 | HINSTANCE16 instance; |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 589 | HKEY hkey; |
| 590 | GDIOBJHDR *ptr; |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 591 | const struct DefaultFontInfo* deffonts; |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 592 | int i; |
| 593 | |
| 594 | if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Fonts", &hkey)) |
| 595 | hkey = 0; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 596 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 597 | /* create GDI heap */ |
Alexandre Julliard | 9842b19 | 2002-10-02 02:36:20 +0000 | [diff] [blame] | 598 | if ((instance = LoadLibrary16( "GDI.EXE" )) >= 32) GDI_HeapSel = instance | 7; |
Richard Cohen | 05bf534 | 1999-09-03 15:16:23 +0000 | [diff] [blame] | 599 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 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 ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 607 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 608 | stock_objects[WHITE_PEN] = CreatePenIndirect( &WhitePen ); |
| 609 | stock_objects[BLACK_PEN] = CreatePenIndirect( &BlackPen ); |
| 610 | stock_objects[NULL_PEN] = CreatePenIndirect( &NullPen ); |
Patrik Stridvall | b87fe2e | 1999-04-01 08:16:08 +0000 | [diff] [blame] | 611 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 612 | stock_objects[DEFAULT_PALETTE] = PALETTE_Init(); |
| 613 | stock_objects[DEFAULT_BITMAP] = CreateBitmap( 1, 1, 1, 1, NULL ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 614 | |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 615 | /* language-independent stock fonts */ |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 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 ); |
Hidenori Takeshima | 44f1a98 | 2002-03-20 00:51:26 +0000 | [diff] [blame] | 619 | |
| 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 ); |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 626 | |
Ulrich Czekalla | 16ff668 | 2003-11-05 01:43:57 +0000 | [diff] [blame] | 627 | stock_objects[DC_BRUSH] = CreateBrushIndirect( &DCBrush ); |
| 628 | stock_objects[DC_PEN] = CreatePenIndirect( &DCPen ); |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 629 | |
| 630 | /* clear the NOSYSTEM bit on all stock objects*/ |
| 631 | for (i = 0; i < NB_STOCK_OBJECTS; i++) |
| 632 | { |
| 633 | if (!stock_objects[i]) |
| 634 | { |
| 635 | if (i == 9) continue; /* there's no stock object 9 */ |
| 636 | ERR( "could not create stock object %d\n", i ); |
| 637 | return FALSE; |
| 638 | } |
| 639 | ptr = GDI_GetObjPtr( stock_objects[i], MAGIC_DONTCARE ); |
| 640 | ptr->wMagic &= ~OBJECT_NOSYSTEM; |
| 641 | GDI_ReleaseObj( stock_objects[i] ); |
| 642 | } |
| 643 | |
| 644 | if (hkey) RegCloseKey( hkey ); |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 645 | |
| 646 | WineEngInit(); |
| 647 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 648 | return TRUE; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 649 | } |
| 650 | |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 651 | #define FIRST_LARGE_HANDLE 16 |
Lionel Ulmer | 5687823 | 2000-11-29 17:42:20 +0000 | [diff] [blame] | 652 | #define MAX_LARGE_HANDLES ((GDI_HEAP_SIZE >> 2) - FIRST_LARGE_HANDLE) |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 653 | static GDIOBJHDR *large_handles[MAX_LARGE_HANDLES]; |
| 654 | static int next_large_handle; |
| 655 | |
| 656 | /*********************************************************************** |
| 657 | * alloc_large_heap |
| 658 | * |
| 659 | * Allocate a GDI handle from the large heap. Helper for GDI_AllocObject |
| 660 | */ |
| 661 | inline static GDIOBJHDR *alloc_large_heap( WORD size, HGDIOBJ *handle ) |
| 662 | { |
| 663 | int i; |
| 664 | GDIOBJHDR *obj; |
| 665 | |
| 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; |
| 670 | *handle = 0; |
| 671 | return NULL; |
| 672 | |
| 673 | found: |
| 674 | if ((obj = HeapAlloc( GetProcessHeap(), 0, size ))) |
| 675 | { |
| 676 | large_handles[i] = obj; |
Alexandre Julliard | 1c4b5c4 | 2002-08-16 00:42:06 +0000 | [diff] [blame] | 677 | *handle = (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2); |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 678 | next_large_handle = i; |
| 679 | } |
| 680 | return obj; |
| 681 | } |
| 682 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 683 | |
| 684 | /*********************************************************************** |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 685 | * GDI_AllocObject |
| 686 | */ |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 687 | void *GDI_AllocObject( WORD size, WORD magic, HGDIOBJ *handle, const struct gdi_obj_funcs *funcs ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 688 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 689 | GDIOBJHDR *obj; |
Alexandre Julliard | 1c4b5c4 | 2002-08-16 00:42:06 +0000 | [diff] [blame] | 690 | HLOCAL16 hlocal; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 691 | |
| 692 | _EnterSysLevel( &GDI_level ); |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 693 | switch(magic) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 694 | { |
Alexandre Julliard | 9842b19 | 2002-10-02 02:36:20 +0000 | [diff] [blame] | 695 | default: |
| 696 | if (GDI_HeapSel) |
| 697 | { |
| 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; |
| 702 | break; |
| 703 | } |
| 704 | /* fall through */ |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 705 | case DC_MAGIC: |
| 706 | case DISABLED_DC_MAGIC: |
| 707 | case META_DC_MAGIC: |
| 708 | case METAFILE_MAGIC: |
| 709 | case METAFILE_DC_MAGIC: |
| 710 | case ENHMETAFILE_MAGIC: |
| 711 | case ENHMETAFILE_DC_MAGIC: |
Alexandre Julliard | e1147ba | 2003-05-13 23:56:12 +0000 | [diff] [blame] | 712 | case MEMORY_DC_MAGIC: |
Vincent BĂ©ron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 713 | case BITMAP_MAGIC: |
Rein Klazes | e8d7f24 | 2003-01-21 19:27:59 +0000 | [diff] [blame] | 714 | case PALETTE_MAGIC: |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 715 | if (!(obj = alloc_large_heap( size, handle ))) goto error; |
| 716 | break; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 717 | } |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 718 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 719 | obj->hNext = 0; |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 720 | obj->wMagic = magic|OBJECT_NOSYSTEM; |
Uwe Bonnes | 8e5e003 | 2001-08-20 19:17:28 +0000 | [diff] [blame] | 721 | obj->dwCount = 0; |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 722 | obj->funcs = funcs; |
Huw Davies | 9e8ce63 | 2003-11-25 05:03:09 +0000 | [diff] [blame] | 723 | obj->hdcs = NULL; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 724 | |
| 725 | TRACE_SEC( *handle, "enter" ); |
| 726 | return obj; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 727 | |
| 728 | error: |
| 729 | _LeaveSysLevel( &GDI_level ); |
| 730 | *handle = 0; |
| 731 | return NULL; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | |
| 735 | /*********************************************************************** |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 736 | * GDI_ReallocObject |
| 737 | * |
| 738 | * The object ptr must have been obtained with GDI_GetObjPtr. |
| 739 | * The new pointer must be released with GDI_ReleaseObj. |
| 740 | */ |
| 741 | void *GDI_ReallocObject( WORD size, HGDIOBJ handle, void *object ) |
| 742 | { |
| 743 | HGDIOBJ new_handle; |
| 744 | |
Alexandre Julliard | 613ead7 | 2002-10-04 00:27:10 +0000 | [diff] [blame] | 745 | if ((UINT_PTR)handle & 2) /* GDI heap handle */ |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 746 | { |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 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 ))) |
Alexandre Julliard | 9842b19 | 2002-10-02 02:36:20 +0000 | [diff] [blame] | 750 | { |
| 751 | assert( new_handle == handle ); /* moveable handle cannot change */ |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 752 | return LOCAL_Lock( GDI_HeapSel, h ); |
Alexandre Julliard | 9842b19 | 2002-10-02 02:36:20 +0000 | [diff] [blame] | 753 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 754 | } |
Alexandre Julliard | 9842b19 | 2002-10-02 02:36:20 +0000 | [diff] [blame] | 755 | else |
| 756 | { |
| 757 | int i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE; |
| 758 | if (i >= 0 && i < MAX_LARGE_HANDLES && large_handles[i]) |
| 759 | { |
| 760 | void *new_ptr = HeapReAlloc( GetProcessHeap(), 0, large_handles[i], size ); |
| 761 | if (new_ptr) |
| 762 | { |
| 763 | large_handles[i] = new_ptr; |
| 764 | return new_ptr; |
| 765 | } |
| 766 | } |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 767 | else ERR( "Invalid handle %p\n", handle ); |
Alexandre Julliard | 9842b19 | 2002-10-02 02:36:20 +0000 | [diff] [blame] | 768 | } |
| 769 | TRACE_SEC( handle, "leave" ); |
| 770 | _LeaveSysLevel( &GDI_level ); |
| 771 | return NULL; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 772 | } |
Vincent BĂ©ron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 773 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 774 | |
| 775 | /*********************************************************************** |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 776 | * GDI_FreeObject |
| 777 | */ |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 778 | BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 779 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 780 | GDIOBJHDR *object = ptr; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 781 | |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 782 | object->wMagic = 0; /* Mark it as invalid */ |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 783 | object->funcs = NULL; |
Alexandre Julliard | 613ead7 | 2002-10-04 00:27:10 +0000 | [diff] [blame] | 784 | if ((UINT_PTR)handle & 2) /* GDI heap handle */ |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 785 | { |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 786 | HLOCAL16 h = LOWORD(handle); |
| 787 | LOCAL_Unlock( GDI_HeapSel, h ); |
| 788 | LOCAL_Free( GDI_HeapSel, h ); |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 789 | } |
| 790 | else /* large heap handle */ |
| 791 | { |
Alexandre Julliard | 1c4b5c4 | 2002-08-16 00:42:06 +0000 | [diff] [blame] | 792 | int i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE; |
Gerard Patel | 4bd80ea | 2001-08-18 16:08:27 +0000 | [diff] [blame] | 793 | if (i >= 0 && i < MAX_LARGE_HANDLES && large_handles[i]) |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 794 | { |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 795 | HeapFree( GetProcessHeap(), 0, large_handles[i] ); |
| 796 | large_handles[i] = NULL; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 797 | } |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 798 | else ERR( "Invalid handle %p\n", handle ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 799 | } |
| 800 | TRACE_SEC( handle, "leave" ); |
| 801 | _LeaveSysLevel( &GDI_level ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 802 | return TRUE; |
| 803 | } |
| 804 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 805 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 806 | /*********************************************************************** |
| 807 | * GDI_GetObjPtr |
| 808 | * |
| 809 | * Return a pointer to the GDI object associated to the handle. |
| 810 | * Return NULL if the object has the wrong magic number. |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 811 | * The object must be released with GDI_ReleaseObj. |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 812 | */ |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 813 | void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 814 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 815 | GDIOBJHDR *ptr = NULL; |
| 816 | |
| 817 | _EnterSysLevel( &GDI_level ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 818 | |
Alexandre Julliard | 613ead7 | 2002-10-04 00:27:10 +0000 | [diff] [blame] | 819 | if ((UINT_PTR)handle & 2) /* GDI heap handle */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 820 | { |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 821 | HLOCAL16 h = LOWORD(handle); |
| 822 | ptr = (GDIOBJHDR *)LOCAL_Lock( GDI_HeapSel, h ); |
Alexandre Julliard | 89b415f | 2001-08-27 19:10:06 +0000 | [diff] [blame] | 823 | if (ptr) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 824 | { |
Alexandre Julliard | 89b415f | 2001-08-27 19:10:06 +0000 | [diff] [blame] | 825 | if (((magic != MAGIC_DONTCARE) && (GDIMAGIC(ptr->wMagic) != magic)) || |
| 826 | (GDIMAGIC(ptr->wMagic) < FIRST_MAGIC) || |
| 827 | (GDIMAGIC(ptr->wMagic) > LAST_MAGIC)) |
| 828 | { |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 829 | LOCAL_Unlock( GDI_HeapSel, h ); |
Alexandre Julliard | 89b415f | 2001-08-27 19:10:06 +0000 | [diff] [blame] | 830 | ptr = NULL; |
| 831 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 832 | } |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 833 | } |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 834 | else /* large heap handle */ |
| 835 | { |
Alexandre Julliard | 613ead7 | 2002-10-04 00:27:10 +0000 | [diff] [blame] | 836 | int i = ((UINT_PTR)handle >> 2) - FIRST_LARGE_HANDLE; |
Gerard Patel | 4bd80ea | 2001-08-18 16:08:27 +0000 | [diff] [blame] | 837 | if (i >= 0 && i < MAX_LARGE_HANDLES) |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 838 | { |
| 839 | ptr = large_handles[i]; |
| 840 | if (ptr && (magic != MAGIC_DONTCARE) && (GDIMAGIC(ptr->wMagic) != magic)) ptr = NULL; |
| 841 | } |
| 842 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 843 | |
| 844 | if (!ptr) |
| 845 | { |
| 846 | _LeaveSysLevel( &GDI_level ); |
| 847 | SetLastError( ERROR_INVALID_HANDLE ); |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 848 | WARN( "Invalid handle %p\n", handle ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 849 | } |
| 850 | else TRACE_SEC( handle, "enter" ); |
| 851 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 852 | return ptr; |
| 853 | } |
| 854 | |
| 855 | |
| 856 | /*********************************************************************** |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 857 | * GDI_ReleaseObj |
| 858 | * |
| 859 | */ |
| 860 | void GDI_ReleaseObj( HGDIOBJ handle ) |
| 861 | { |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 862 | if ((UINT_PTR)handle & 2) LOCAL_Unlock( GDI_HeapSel, LOWORD(handle) ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 863 | TRACE_SEC( handle, "leave" ); |
| 864 | _LeaveSysLevel( &GDI_level ); |
| 865 | } |
| 866 | |
| 867 | |
| 868 | /*********************************************************************** |
Alexandre Julliard | 658cdb4 | 2001-08-15 23:33:20 +0000 | [diff] [blame] | 869 | * GDI_CheckNotLock |
| 870 | */ |
| 871 | void GDI_CheckNotLock(void) |
| 872 | { |
| 873 | _CheckNotSysLevel( &GDI_level ); |
| 874 | } |
| 875 | |
| 876 | |
| 877 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 878 | * DeleteObject (GDI32.@) |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 879 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 880 | BOOL WINAPI DeleteObject( HGDIOBJ obj ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 881 | { |
| 882 | /* Check if object is valid */ |
| 883 | |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 884 | GDIOBJHDR * header; |
| 885 | if (HIWORD(obj)) return FALSE; |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 886 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 887 | if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 888 | |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 889 | if (!(header->wMagic & OBJECT_NOSYSTEM) |
| 890 | && (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC)) |
| 891 | { |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 892 | TRACE("Preserving system object %p\n", obj); |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 893 | GDI_ReleaseObj( obj ); |
| 894 | return TRUE; |
| 895 | } |
Uwe Bonnes | 8e5e003 | 2001-08-20 19:17:28 +0000 | [diff] [blame] | 896 | |
Huw Davies | 9e8ce63 | 2003-11-25 05:03:09 +0000 | [diff] [blame] | 897 | while (header->hdcs) |
| 898 | { |
| 899 | DC *dc = DC_GetDCPtr(header->hdcs->hdc); |
| 900 | struct hdc_list *tmp; |
| 901 | |
| 902 | TRACE("hdc %p has interest in %p\n", header->hdcs->hdc, obj); |
| 903 | if(dc) |
| 904 | { |
| 905 | if(dc->funcs->pDeleteObject) |
| 906 | dc->funcs->pDeleteObject( dc->physDev, obj ); |
| 907 | GDI_ReleaseObj( header->hdcs->hdc ); |
| 908 | } |
| 909 | tmp = header->hdcs; |
| 910 | header->hdcs = header->hdcs->next; |
| 911 | HeapFree(GetProcessHeap(), 0, tmp); |
| 912 | } |
| 913 | |
Uwe Bonnes | 8e5e003 | 2001-08-20 19:17:28 +0000 | [diff] [blame] | 914 | if (header->dwCount) |
| 915 | { |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 916 | TRACE("delayed for %p because object in use, count %ld\n", obj, header->dwCount ); |
Uwe Bonnes | 8e5e003 | 2001-08-20 19:17:28 +0000 | [diff] [blame] | 917 | header->dwCount |= 0x80000000; /* mark for delete */ |
| 918 | GDI_ReleaseObj( obj ); |
| 919 | return TRUE; |
| 920 | } |
| 921 | |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 922 | TRACE("%p\n", obj ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 923 | |
| 924 | /* Delete object */ |
| 925 | |
Huw D M Davies | 6b5aaa1 | 2002-08-15 23:19:40 +0000 | [diff] [blame] | 926 | if (header->funcs && header->funcs->pDeleteObject) |
| 927 | return header->funcs->pDeleteObject( obj, header ); |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 928 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 929 | GDI_ReleaseObj( obj ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 930 | return FALSE; |
| 931 | } |
| 932 | |
Huw Davies | 9e8ce63 | 2003-11-25 05:03:09 +0000 | [diff] [blame] | 933 | /*********************************************************************** |
| 934 | * GDI_hdc_using_object |
| 935 | * |
| 936 | * Call this if the dc requires DeleteObject notification |
| 937 | */ |
| 938 | BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) |
| 939 | { |
| 940 | GDIOBJHDR * header; |
| 941 | struct hdc_list **pphdc; |
| 942 | |
| 943 | TRACE("obj %p hdc %p\n", obj, hdc); |
| 944 | |
| 945 | if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE; |
| 946 | |
| 947 | if (!(header->wMagic & OBJECT_NOSYSTEM) && |
| 948 | (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC)) |
| 949 | { |
| 950 | GDI_ReleaseObj(obj); |
| 951 | return FALSE; |
| 952 | } |
| 953 | |
| 954 | for(pphdc = &header->hdcs; *pphdc; pphdc = &(*pphdc)->next) |
| 955 | if((*pphdc)->hdc == hdc) |
| 956 | break; |
| 957 | |
| 958 | if(!*pphdc) { |
| 959 | *pphdc = HeapAlloc(GetProcessHeap(), 0, sizeof(**pphdc)); |
| 960 | (*pphdc)->hdc = hdc; |
| 961 | (*pphdc)->next = NULL; |
| 962 | } |
| 963 | |
| 964 | GDI_ReleaseObj(obj); |
| 965 | return TRUE; |
| 966 | } |
| 967 | |
| 968 | /*********************************************************************** |
| 969 | * GDI_hdc_not_using_object |
| 970 | * |
| 971 | */ |
| 972 | BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) |
| 973 | { |
| 974 | GDIOBJHDR * header; |
| 975 | struct hdc_list *phdc, **prev; |
| 976 | |
| 977 | TRACE("obj %p hdc %p\n", obj, hdc); |
| 978 | |
| 979 | if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE; |
| 980 | |
| 981 | if (!(header->wMagic & OBJECT_NOSYSTEM) && |
| 982 | (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC)) |
| 983 | { |
| 984 | GDI_ReleaseObj(obj); |
| 985 | return FALSE; |
| 986 | } |
| 987 | |
| 988 | phdc = header->hdcs; |
| 989 | prev = &header->hdcs; |
| 990 | |
| 991 | while(phdc) { |
| 992 | if(phdc->hdc == hdc) { |
| 993 | *prev = phdc->next; |
| 994 | HeapFree(GetProcessHeap(), 0, phdc); |
| 995 | phdc = *prev; |
| 996 | } else { |
| 997 | prev = &phdc->next; |
| 998 | phdc = phdc->next; |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | GDI_ReleaseObj(obj); |
| 1003 | return TRUE; |
| 1004 | } |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1005 | |
| 1006 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1007 | * GetStockObject (GDI32.@) |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1008 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1009 | HGDIOBJ WINAPI GetStockObject( INT obj ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1010 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1011 | HGDIOBJ ret; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1012 | if ((obj < 0) || (obj >= NB_STOCK_OBJECTS)) return 0; |
Alexandre Julliard | 78f9fae | 2001-08-17 00:07:13 +0000 | [diff] [blame] | 1013 | ret = stock_objects[obj]; |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1014 | TRACE("returning %p\n", ret ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1015 | return ret; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1016 | } |
| 1017 | |
| 1018 | |
| 1019 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1020 | * GetObject (GDI.82) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1021 | */ |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 1022 | INT16 WINAPI GetObject16( HANDLE16 handle16, INT16 count, LPVOID buffer ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1023 | { |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1024 | GDIOBJHDR * ptr; |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 1025 | HGDIOBJ handle = HGDIOBJ_32( handle16 ); |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1026 | INT16 result = 0; |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 1027 | |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1028 | TRACE("%p %d %p\n", handle, count, buffer ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1029 | if (!count) return 0; |
| 1030 | |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1031 | if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0; |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 1032 | |
| 1033 | if (ptr->funcs && ptr->funcs->pGetObject16) |
| 1034 | result = ptr->funcs->pGetObject16( handle, ptr, count, buffer ); |
| 1035 | else |
| 1036 | SetLastError( ERROR_INVALID_HANDLE ); |
| 1037 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1038 | GDI_ReleaseObj( handle ); |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1039 | return result; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1040 | } |
| 1041 | |
| 1042 | |
| 1043 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1044 | * GetObjectA (GDI32.@) |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1045 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1046 | INT WINAPI GetObjectA( HANDLE handle, INT count, LPVOID buffer ) |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1047 | { |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1048 | GDIOBJHDR * ptr; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1049 | INT result = 0; |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1050 | TRACE("%p %d %p\n", handle, count, buffer ); |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1051 | |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1052 | if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0; |
| 1053 | |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 1054 | if (ptr->funcs && ptr->funcs->pGetObjectA) |
| 1055 | result = ptr->funcs->pGetObjectA( handle, ptr, count, buffer ); |
| 1056 | else |
| 1057 | SetLastError( ERROR_INVALID_HANDLE ); |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1058 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1059 | GDI_ReleaseObj( handle ); |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1060 | return result; |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1061 | } |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1062 | |
Juergen Schmied | cba8488 | 1998-10-23 13:27:36 +0000 | [diff] [blame] | 1063 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1064 | * GetObjectW (GDI32.@) |
Juergen Schmied | cba8488 | 1998-10-23 13:27:36 +0000 | [diff] [blame] | 1065 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1066 | INT WINAPI GetObjectW( HANDLE handle, INT count, LPVOID buffer ) |
Juergen Schmied | cba8488 | 1998-10-23 13:27:36 +0000 | [diff] [blame] | 1067 | { |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1068 | GDIOBJHDR * ptr; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1069 | INT result = 0; |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1070 | TRACE("%p %d %p\n", handle, count, buffer ); |
Juergen Schmied | cba8488 | 1998-10-23 13:27:36 +0000 | [diff] [blame] | 1071 | |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1072 | if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0; |
| 1073 | |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 1074 | if (ptr->funcs && ptr->funcs->pGetObjectW) |
| 1075 | result = ptr->funcs->pGetObjectW( handle, ptr, count, buffer ); |
| 1076 | else |
| 1077 | SetLastError( ERROR_INVALID_HANDLE ); |
| 1078 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1079 | GDI_ReleaseObj( handle ); |
Juergen Schmied | cba8488 | 1998-10-23 13:27:36 +0000 | [diff] [blame] | 1080 | return result; |
| 1081 | } |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1082 | |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1083 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1084 | * GetObjectType (GDI32.@) |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1085 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1086 | DWORD WINAPI GetObjectType( HANDLE handle ) |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1087 | { |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1088 | GDIOBJHDR * ptr; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1089 | INT result = 0; |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1090 | TRACE("%p\n", handle ); |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1091 | |
Matthew Cline | 20512fd | 2000-02-13 16:00:17 +0000 | [diff] [blame] | 1092 | if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0; |
Vincent BĂ©ron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1093 | |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 1094 | switch(GDIMAGIC(ptr->wMagic)) |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1095 | { |
| 1096 | case PEN_MAGIC: |
| 1097 | result = OBJ_PEN; |
| 1098 | break; |
Vincent BĂ©ron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1099 | case BRUSH_MAGIC: |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1100 | result = OBJ_BRUSH; |
| 1101 | break; |
Vincent BĂ©ron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1102 | case BITMAP_MAGIC: |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1103 | result = OBJ_BITMAP; |
| 1104 | break; |
| 1105 | case FONT_MAGIC: |
| 1106 | result = OBJ_FONT; |
| 1107 | break; |
| 1108 | case PALETTE_MAGIC: |
| 1109 | result = OBJ_PAL; |
| 1110 | break; |
| 1111 | case REGION_MAGIC: |
| 1112 | result = OBJ_REGION; |
| 1113 | break; |
| 1114 | case DC_MAGIC: |
| 1115 | result = OBJ_DC; |
| 1116 | break; |
| 1117 | case META_DC_MAGIC: |
| 1118 | result = OBJ_METADC; |
| 1119 | break; |
| 1120 | case METAFILE_MAGIC: |
| 1121 | result = OBJ_METAFILE; |
| 1122 | break; |
| 1123 | case METAFILE_DC_MAGIC: |
| 1124 | result = OBJ_METADC; |
| 1125 | break; |
Huw D M Davies | 7603dea | 1999-04-25 09:24:23 +0000 | [diff] [blame] | 1126 | case ENHMETAFILE_MAGIC: |
| 1127 | result = OBJ_ENHMETAFILE; |
| 1128 | break; |
| 1129 | case ENHMETAFILE_DC_MAGIC: |
| 1130 | result = OBJ_ENHMETADC; |
| 1131 | break; |
Alexandre Julliard | e1147ba | 2003-05-13 23:56:12 +0000 | [diff] [blame] | 1132 | case MEMORY_DC_MAGIC: |
| 1133 | result = OBJ_MEMDC; |
| 1134 | break; |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 1135 | default: |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 1136 | FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr->wMagic) ); |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1137 | break; |
| 1138 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1139 | GDI_ReleaseObj( handle ); |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1140 | return result; |
| 1141 | } |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1142 | |
| 1143 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1144 | * GetCurrentObject (GDI32.@) |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1145 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1146 | HANDLE WINAPI GetCurrentObject(HDC hdc,UINT type) |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1147 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1148 | HANDLE ret = 0; |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1149 | DC * dc = DC_GetDCPtr( hdc ); |
| 1150 | |
Vincent BĂ©ron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1151 | if (dc) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1152 | { |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1153 | switch (type) { |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 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; |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1159 | default: |
| 1160 | /* the SDK only mentions those above */ |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1161 | FIXME("(%p,%d): unknown type.\n",hdc,type); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1162 | break; |
| 1163 | } |
| 1164 | GDI_ReleaseObj( hdc ); |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1165 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1166 | return ret; |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 1167 | } |
Alexandre Julliard | 92b376d | 2002-05-07 02:08:46 +0000 | [diff] [blame] | 1168 | |
| 1169 | |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1170 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1171 | * SelectObject (GDI32.@) |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1172 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1173 | HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ handle ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1174 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1175 | HGDIOBJ ret = 0; |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 1176 | GDIOBJHDR *header = GDI_GetObjPtr( handle, MAGIC_DONTCARE ); |
| 1177 | if (!header) return 0; |
| 1178 | |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1179 | TRACE("hdc=%p %p\n", hdc, handle ); |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1180 | |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 1181 | if (header->funcs && header->funcs->pSelectObject) |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame] | 1182 | { |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 1183 | ret = header->funcs->pSelectObject( handle, header, hdc ); |
| 1184 | if (ret && ret != handle && (INT)ret > COMPLEXREGION) |
| 1185 | { |
| 1186 | inc_ref_count( handle ); |
| 1187 | dec_ref_count( ret ); |
| 1188 | } |
Alexandre Julliard | e21c15e | 2002-03-28 22:22:05 +0000 | [diff] [blame] | 1189 | } |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 1190 | GDI_ReleaseObj( handle ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1191 | return ret; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1192 | } |
| 1193 | |
| 1194 | |
| 1195 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1196 | * UnrealizeObject (GDI32.@) |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1197 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1198 | BOOL WINAPI UnrealizeObject( HGDIOBJ obj ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1199 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1200 | BOOL result = TRUE; |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1201 | /* Check if object is valid */ |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 1202 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1203 | GDIOBJHDR * header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ); |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 1204 | if (!header) return FALSE; |
| 1205 | |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1206 | TRACE("%p\n", obj ); |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 1207 | |
| 1208 | /* Unrealize object */ |
| 1209 | |
Alexandre Julliard | d8a9244 | 2002-05-31 18:43:22 +0000 | [diff] [blame] | 1210 | if (header->funcs && header->funcs->pUnrealizeObject) |
| 1211 | result = header->funcs->pUnrealizeObject( obj, header ); |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 1212 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1213 | GDI_ReleaseObj( obj ); |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1214 | return result; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1215 | } |
Alexandre Julliard | 1f57929 | 1994-05-25 16:25:21 +0000 | [diff] [blame] | 1216 | |
| 1217 | |
Andreas Mohr | f16b401 | 2002-02-27 21:34:54 +0000 | [diff] [blame] | 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) |
| 1228 | }; |
Vincent BĂ©ron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1229 | |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1230 | |
| 1231 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1232 | * EnumObjects (GDI32.@) |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1233 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1234 | INT WINAPI EnumObjects( HDC hdc, INT nObjType, |
| 1235 | GOBJENUMPROC lpEnumFunc, LPARAM lParam ) |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1236 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1237 | INT i, retval = 0; |
| 1238 | LOGPEN pen; |
| 1239 | LOGBRUSH brush; |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1240 | |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1241 | TRACE("%p %d %p %08lx\n", hdc, nObjType, lpEnumFunc, lParam ); |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1242 | switch(nObjType) |
| 1243 | { |
| 1244 | case OBJ_PEN: |
| 1245 | /* Enumerate solid pens */ |
| 1246 | for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++) |
| 1247 | { |
| 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 ); |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 1253 | TRACE("solid pen %08lx, ret=%d\n", |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1254 | solid_colors[i], retval); |
| 1255 | if (!retval) break; |
| 1256 | } |
| 1257 | break; |
| 1258 | |
| 1259 | case OBJ_BRUSH: |
| 1260 | /* Enumerate solid brushes */ |
| 1261 | for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++) |
| 1262 | { |
| 1263 | brush.lbStyle = BS_SOLID; |
| 1264 | brush.lbColor = solid_colors[i]; |
| 1265 | brush.lbHatch = 0; |
| 1266 | retval = lpEnumFunc( &brush, lParam ); |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 1267 | TRACE("solid brush %08lx, ret=%d\n", |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1268 | solid_colors[i], retval); |
| 1269 | if (!retval) break; |
| 1270 | } |
| 1271 | |
| 1272 | /* Now enumerate hatched brushes */ |
| 1273 | if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++) |
| 1274 | { |
| 1275 | brush.lbStyle = BS_HATCHED; |
| 1276 | brush.lbColor = RGB(0,0,0); |
| 1277 | brush.lbHatch = i; |
| 1278 | retval = lpEnumFunc( &brush, lParam ); |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 1279 | TRACE("hatched brush %d, ret=%d\n", |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1280 | i, retval); |
| 1281 | if (!retval) break; |
| 1282 | } |
| 1283 | break; |
| 1284 | |
| 1285 | default: |
| 1286 | /* FIXME: implement Win32 types */ |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 1287 | WARN("(%d): Invalid type\n", nObjType ); |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 1288 | break; |
| 1289 | } |
| 1290 | return retval; |
Alexandre Julliard | 1f57929 | 1994-05-25 16:25:21 +0000 | [diff] [blame] | 1291 | } |
Alexandre Julliard | 7cc9c0c | 1994-06-15 15:45:11 +0000 | [diff] [blame] | 1292 | |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 1293 | |
Alexandre Julliard | 7cc9c0c | 1994-06-15 15:45:11 +0000 | [diff] [blame] | 1294 | /*********************************************************************** |
Alexandre Julliard | 59730ae | 1996-03-24 16:20:51 +0000 | [diff] [blame] | 1295 | * IsGDIObject (GDI.462) |
Vincent BĂ©ron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1296 | * |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1297 | * returns type of object if valid (W95 system programming secrets p. 264-5) |
Alexandre Julliard | 7cc9c0c | 1994-06-15 15:45:11 +0000 | [diff] [blame] | 1298 | */ |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 1299 | BOOL16 WINAPI IsGDIObject16( HGDIOBJ16 handle16 ) |
Alexandre Julliard | 7cc9c0c | 1994-06-15 15:45:11 +0000 | [diff] [blame] | 1300 | { |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1301 | UINT16 magic = 0; |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 1302 | HGDIOBJ handle = HGDIOBJ_32( handle16 ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1303 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1304 | GDIOBJHDR *object = GDI_GetObjPtr( handle, MAGIC_DONTCARE ); |
| 1305 | if (object) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1306 | { |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 1307 | magic = GDIMAGIC(object->wMagic) - PEN_MAGIC + 1; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1308 | GDI_ReleaseObj( handle ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1309 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1310 | return magic; |
Alexandre Julliard | 7cc9c0c | 1994-06-15 15:45:11 +0000 | [diff] [blame] | 1311 | } |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 1312 | |
| 1313 | |
| 1314 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1315 | * SetObjectOwner (GDI32.@) |
Alexandre Julliard | 17216f5 | 1997-10-12 16:30:17 +0000 | [diff] [blame] | 1316 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1317 | void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner ) |
Alexandre Julliard | 17216f5 | 1997-10-12 16:30:17 +0000 | [diff] [blame] | 1318 | { |
| 1319 | /* Nothing to do */ |
| 1320 | } |
| 1321 | |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 1322 | |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1323 | /*********************************************************************** |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1324 | * MakeObjectPrivate (GDI.463) |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 1325 | * |
| 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. |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1332 | */ |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 1333 | void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle16, BOOL16 private ) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1334 | { |
Alexandre Julliard | 6c428e5 | 2002-11-22 21:58:03 +0000 | [diff] [blame] | 1335 | HGDIOBJ handle = HGDIOBJ_32( handle16 ); |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 1336 | GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ); |
| 1337 | if (!ptr) |
| 1338 | { |
Alexandre Julliard | 547cdc2 | 2002-11-22 22:16:53 +0000 | [diff] [blame] | 1339 | ERR("invalid GDI object %p !\n", handle); |
Andreas Mohr | 007fb24 | 2000-09-16 20:53:51 +0000 | [diff] [blame] | 1340 | return; |
| 1341 | } |
| 1342 | ptr->wMagic |= OBJECT_PRIVATE; |
| 1343 | GDI_ReleaseObj( handle ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1344 | } |
| 1345 | |
| 1346 | |
| 1347 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1348 | * GdiFlush (GDI32.@) |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1349 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1350 | BOOL WINAPI GdiFlush(void) |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 1351 | { |
| 1352 | return TRUE; /* FIXME */ |
| 1353 | } |
| 1354 | |
Alexandre Julliard | 17216f5 | 1997-10-12 16:30:17 +0000 | [diff] [blame] | 1355 | |
| 1356 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1357 | * GdiGetBatchLimit (GDI32.@) |
Alexandre Julliard | 17216f5 | 1997-10-12 16:30:17 +0000 | [diff] [blame] | 1358 | */ |
| 1359 | DWORD WINAPI GdiGetBatchLimit(void) |
| 1360 | { |
| 1361 | return 1; /* FIXME */ |
| 1362 | } |
| 1363 | |
| 1364 | |
| 1365 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1366 | * GdiSetBatchLimit (GDI32.@) |
Alexandre Julliard | 17216f5 | 1997-10-12 16:30:17 +0000 | [diff] [blame] | 1367 | */ |
| 1368 | DWORD WINAPI GdiSetBatchLimit( DWORD limit ) |
| 1369 | { |
| 1370 | return 1; /* FIXME */ |
| 1371 | } |
| 1372 | |
| 1373 | |
| 1374 | /*********************************************************************** |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1375 | * GdiSeeGdiDo (GDI.452) |
| 1376 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1377 | DWORD WINAPI GdiSeeGdiDo16( WORD wReqType, WORD wParam1, WORD wParam2, |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1378 | WORD wParam3 ) |
| 1379 | { |
| 1380 | switch (wReqType) |
| 1381 | { |
| 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 */ |
| 1389 | return GDI_HeapSel; |
| 1390 | default: |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 1391 | WARN("(wReqType=%04x): Unknown\n", wReqType); |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1392 | return (DWORD)-1; |
| 1393 | } |
| 1394 | } |
| 1395 | |
| 1396 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 1397 | * GdiSignalProc32 (GDI.610) |
Ulrich Weigand | 466cd44 | 1999-04-01 11:46:02 +0000 | [diff] [blame] | 1398 | */ |
| 1399 | WORD WINAPI GdiSignalProc( UINT uCode, DWORD dwThreadOrProcessID, |
| 1400 | DWORD dwFlags, HMODULE16 hModule ) |
| 1401 | { |
| 1402 | return 0; |
| 1403 | } |
| 1404 | |
Ulrich Weigand | 98c3053 | 1999-07-27 17:10:06 +0000 | [diff] [blame] | 1405 | /*********************************************************************** |
Patrik Stridvall | 19d66cc | 2002-01-07 21:16:46 +0000 | [diff] [blame] | 1406 | * GdiInit2 (GDI.403) |
Andreas Mohr | cf67b00 | 2001-09-20 19:32:39 +0000 | [diff] [blame] | 1407 | * |
| 1408 | * See "Undocumented Windows" |
| 1409 | */ |
| 1410 | HANDLE16 WINAPI GdiInit216( |
Patrik Stridvall | 19d66cc | 2002-01-07 21:16:46 +0000 | [diff] [blame] | 1411 | HANDLE16 h1, /* [in] GDI object */ |
| 1412 | HANDLE16 h2 /* [in] global data */ |
Andreas Mohr | cf67b00 | 2001-09-20 19:32:39 +0000 | [diff] [blame] | 1413 | ) |
| 1414 | { |
| 1415 | FIXME("(%04x, %04x), stub.\n", h1, h2); |
| 1416 | if (h2 == 0xffff) |
| 1417 | return 0xffff; /* undefined return value */ |
| 1418 | return h1; /* FIXME: should be the memory handle of h1 */ |
| 1419 | } |
| 1420 | |
| 1421 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1422 | * FinalGdiInit (GDI.405) |
Ulrich Weigand | 98c3053 | 1999-07-27 17:10:06 +0000 | [diff] [blame] | 1423 | */ |
Patrik Stridvall | 19d66cc | 2002-01-07 21:16:46 +0000 | [diff] [blame] | 1424 | void WINAPI FinalGdiInit16( HBRUSH16 hPattern /* [in] fill pattern of desktop */ ) |
Ulrich Weigand | 98c3053 | 1999-07-27 17:10:06 +0000 | [diff] [blame] | 1425 | { |
| 1426 | } |
Ulrich Weigand | 466cd44 | 1999-04-01 11:46:02 +0000 | [diff] [blame] | 1427 | |
| 1428 | /*********************************************************************** |
Ulrich Weigand | 87dbaa9 | 1998-12-01 13:00:05 +0000 | [diff] [blame] | 1429 | * GdiFreeResources (GDI.609) |
| 1430 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1431 | WORD WINAPI GdiFreeResources16( DWORD reserve ) |
Ulrich Weigand | 87dbaa9 | 1998-12-01 13:00:05 +0000 | [diff] [blame] | 1432 | { |
| 1433 | return (WORD)( (int)LOCAL_CountFree( GDI_HeapSel ) * 100 / |
| 1434 | (int)LOCAL_HeapSize( GDI_HeapSel ) ); |
| 1435 | } |
| 1436 | |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 1437 | |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1438 | /******************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1439 | * GetColorAdjustment [GDI32.@] |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1440 | * |
| 1441 | * |
| 1442 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1443 | BOOL WINAPI GetColorAdjustment(HDC hdc, LPCOLORADJUSTMENT lpca) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1444 | { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 1445 | FIXME("GetColorAdjustment, stub\n"); |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1446 | return 0; |
| 1447 | } |
| 1448 | |
| 1449 | /******************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1450 | * GetMiterLimit [GDI32.@] |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1451 | * |
| 1452 | * |
| 1453 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1454 | BOOL WINAPI GetMiterLimit(HDC hdc, PFLOAT peLimit) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1455 | { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 1456 | FIXME("GetMiterLimit, stub\n"); |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1457 | return 0; |
| 1458 | } |
| 1459 | |
| 1460 | /******************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1461 | * SetMiterLimit [GDI32.@] |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1462 | * |
| 1463 | * |
| 1464 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1465 | BOOL WINAPI SetMiterLimit(HDC hdc, FLOAT eNewLimit, PFLOAT peOldLimit) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1466 | { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 1467 | FIXME("SetMiterLimit, stub\n"); |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1468 | return 0; |
| 1469 | } |
| 1470 | |
| 1471 | /******************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1472 | * GdiComment [GDI32.@] |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1473 | * |
| 1474 | * |
| 1475 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1476 | BOOL WINAPI GdiComment(HDC hdc, UINT cbSize, const BYTE *lpData) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1477 | { |
Mike McCormack | 399967c | 2003-05-21 18:28:49 +0000 | [diff] [blame] | 1478 | DC *dc = DC_GetDCPtr(hdc); |
| 1479 | BOOL ret = FALSE; |
| 1480 | if(dc) |
| 1481 | { |
| 1482 | if (dc->funcs->pGdiComment) |
| 1483 | ret = dc->funcs->pGdiComment( dc->physDev, cbSize, lpData ); |
| 1484 | } |
| 1485 | GDI_ReleaseObj( hdc ); |
| 1486 | return ret; |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1487 | } |
Mike McCormack | 399967c | 2003-05-21 18:28:49 +0000 | [diff] [blame] | 1488 | |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1489 | /******************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1490 | * SetColorAdjustment [GDI32.@] |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1491 | * |
| 1492 | * |
| 1493 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1494 | BOOL WINAPI SetColorAdjustment(HDC hdc, const COLORADJUSTMENT* lpca) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1495 | { |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 1496 | FIXME("SetColorAdjustment, stub\n"); |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1497 | return 0; |
| 1498 | } |