ReactOS 0.4.17-dev-116-ga4b6fe9
dc.c
Go to the documentation of this file.
1/*
2 * Unit tests for dc functions
3 *
4 * Copyright (c) 2005 Huw Davies
5 * Copyright (c) 2005,2016 Dmitry Timoshkov
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include <assert.h>
23#include <stdio.h>
24
25#include "wine/test.h"
26#include "winbase.h"
27#include "wingdi.h"
28#include "winuser.h"
29#include "winspool.h"
30#include "winerror.h"
31
32#ifndef LAYOUT_LTR
33#define LAYOUT_LTR 0
34#endif
35
36static void test_dc_values(void)
37{
38 HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
40 int extra, attr;
41 float limit;
42 BOOL ret;
43
44 ok( hdc != NULL, "CreateDC failed\n" );
45 color = SetBkColor( hdc, 0x12345678 );
46 ok( color == 0xffffff, "initial color %08lx\n", color );
47 color = GetBkColor( hdc );
48 ok( color == 0x12345678, "wrong color %08lx\n", color );
49 color = SetBkColor( hdc, 0xffffffff );
50 ok( color == 0x12345678, "wrong color %08lx\n", color );
51 color = GetBkColor( hdc );
52 ok( color == 0xffffffff, "wrong color %08lx\n", color );
53 color = SetBkColor( hdc, 0 );
54 ok( color == 0xffffffff, "wrong color %08lx\n", color );
55 color = GetBkColor( hdc );
56 ok( color == 0, "wrong color %08lx\n", color );
57
58 color = SetTextColor( hdc, 0xffeeddcc );
59 ok( color == 0, "initial color %08lx\n", color );
61 ok( color == 0xffeeddcc, "wrong color %08lx\n", color );
62 color = SetTextColor( hdc, 0xffffffff );
63 ok( color == 0xffeeddcc, "wrong color %08lx\n", color );
65 ok( color == 0xffffffff, "wrong color %08lx\n", color );
66 color = SetTextColor( hdc, 0 );
67 ok( color == 0xffffffff, "wrong color %08lx\n", color );
69 ok( color == 0, "wrong color %08lx\n", color );
70
72 ok( extra == 0, "initial extra %d\n", extra );
75 ok( extra == 123, "initial extra %d\n", extra );
78 ok( extra == 123, "initial extra %d\n", extra );
81 ok( extra == 123, "initial extra %d\n", extra );
82
83 SetLastError(0xdeadbeef);
84 attr = SetBkMode(ULongToHandle(0xdeadbeef), OPAQUE);
85 ok(!attr, "attr = %x\n", attr);
86 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
87
88 attr = GetBkColor(ULongToHandle(0xdeadbeef));
89 ok(attr == CLR_INVALID, "attr = %x\n", attr);
90
91 SetLastError(0xdeadbeef);
93 ok(!attr, "GetDeviceCaps rets %d\n", attr);
94 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
95
96 /* Miter limit */
97 limit = 123.0f;
99 ok(ret, "Unexpected return value.\n");
100 ok(limit == 10.0f, "Unexpected default miter limit %f.\n", limit);
101
102 limit = 456.0;
103 ret = SetMiterLimit(hdc, 0.9f, &limit);
104 ok(!ret, "Unexpected return value.\n");
105 ok(limit == 456.0f, "Unexpected default miter limit %f.\n", limit);
106
107 limit = 0.0;
108 ret = SetMiterLimit(hdc, 1.0f, &limit);
109 ok(ret, "Unexpected return value.\n");
110 ok(limit == 10.0f, "Unexpected default miter limit %f.\n", limit);
111
112 DeleteDC( hdc );
113}
114
115static void test_savedc_2(void)
116{
117 char buffer[100];
118 RGNDATA *rgndata = (RGNDATA *)buffer;
119 HWND hwnd;
120 HDC hdc;
121 HRGN hrgn;
122 RECT rc, rc_clip;
123 int ret;
124
125 hwnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,
126 0, 0, 0, NULL);
127 assert(hwnd != 0);
130
131 hrgn = CreateRectRgn(0, 0, 0, 0);
132 assert(hrgn != 0);
133
134 hdc = GetDC(hwnd);
135 ok(hdc != NULL, "GetDC failed\n");
136
137 ret = GetClipBox(hdc, &rc_clip);
138 /* all versions of Windows return SIMPLEREGION despite returning an empty region */
139 todo_wine ok(ret == NULLREGION || broken(ret == SIMPLEREGION), "wrong region type %d\n", ret);
141 ok(ret == 0, "GetClipRgn returned %d instead of 0\n", ret);
142 ret = GetRgnBox(hrgn, &rc);
143 ok(ret == NULLREGION, "GetRgnBox returned %d %s instead of NULLREGION\n",
144 ret, wine_dbgstr_rect(&rc));
145 ret = GetRegionData(hrgn, sizeof(buffer), rgndata);
146 ok(ret == sizeof(RGNDATAHEADER), "got %u\n", ret);
147 ok(!rgndata->rdh.nCount, "got %lu rectangles\n", rgndata->rdh.nCount);
148 SetRect(&rc, 0, 0, 100, 100);
149 ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
150 wine_dbgstr_rect(&rc_clip));
151
152 ret = SaveDC(hdc);
153 ok(ret == 1, "ret = %d\n", ret);
154
155 ret = IntersectClipRect(hdc, 0, 0, 50, 50);
156 /* all versions of Windows return COMPLEXREGION despite the region comprising one rectangle */
157 ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "wrong region type %d\n", ret);
159 ok(ret == 1, "GetClipRgn returned %d instead of 1\n", ret);
160 ret = GetRegionData(hrgn, sizeof(buffer), rgndata);
161 ok(ret == sizeof(RGNDATAHEADER) + sizeof(RECT), "got %u\n", ret);
162 ok(rgndata->rdh.nCount == 1, "got %lu rectangles\n", rgndata->rdh.nCount);
163 SetRect(&rc, 0, 0, 50, 50);
164 ok(EqualRect((RECT *)rgndata->Buffer, &rc), "got rect %s\n", wine_dbgstr_rect((RECT *)rgndata->Buffer));
165
166 ret = GetClipBox(hdc, &rc_clip);
167 ok(ret == SIMPLEREGION, "wrong region type %d\n", ret);
168 SetRect(&rc, 0, 0, 50, 50);
169 ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
170 wine_dbgstr_rect(&rc_clip));
171
172 ret = RestoreDC(hdc, 1);
173 ok(ret, "ret = %d\n", ret);
174
175 ret = GetClipBox(hdc, &rc_clip);
176 ok(ret == SIMPLEREGION, "wrong region type %d\n", ret);
177 SetRect(&rc, 0, 0, 100, 100);
178 ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
179 wine_dbgstr_rect(&rc_clip));
180
184}
185
186static void test_savedc(void)
187{
188 HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
189 int ret;
190
191 ok(hdc != NULL, "CreateDC rets %p\n", hdc);
192
193 ret = SaveDC(hdc);
194 ok(ret == 1, "ret = %d\n", ret);
195 ret = SaveDC(hdc);
196 ok(ret == 2, "ret = %d\n", ret);
197 ret = SaveDC(hdc);
198 ok(ret == 3, "ret = %d\n", ret);
199 ret = RestoreDC(hdc, -1);
200 ok(ret, "ret = %d\n", ret);
201 ret = SaveDC(hdc);
202 ok(ret == 3, "ret = %d\n", ret);
203 ret = RestoreDC(hdc, 1);
204 ok(ret, "ret = %d\n", ret);
205 ret = SaveDC(hdc);
206 ok(ret == 1, "ret = %d\n", ret);
207 ret = SaveDC(hdc);
208 ok(ret == 2, "ret = %d\n", ret);
209 ret = SaveDC(hdc);
210 ok(ret == 3, "ret = %d\n", ret);
211 ret = RestoreDC(hdc, -2);
212 ok(ret, "ret = %d\n", ret);
213 ret = SaveDC(hdc);
214 ok(ret == 2, "ret = %d\n", ret);
215 ret = RestoreDC(hdc, -2);
216 ok(ret, "ret = %d\n", ret);
217 ret = SaveDC(hdc);
218 ok(ret == 1, "ret = %d\n", ret);
219 ret = SaveDC(hdc);
220 ok(ret == 2, "ret = %d\n", ret);
221 ret = RestoreDC(hdc, -4);
222 ok(!ret, "ret = %d\n", ret);
223 ret = RestoreDC(hdc, 3);
224 ok(!ret, "ret = %d\n", ret);
225
226 /* Under Win9x the following RestoreDC call succeeds and clears the save stack. */
227 ret = RestoreDC(hdc, -3);
228 ok(!ret ||
229 broken(ret), /* Win9x */
230 "ret = %d\n", ret);
231
232 /* Trying to clear an empty save stack fails. */
233 ret = RestoreDC(hdc, -3);
234 ok(!ret, "ret = %d\n", ret);
235
236 ret = SaveDC(hdc);
237 ok(ret == 3 ||
238 broken(ret == 1), /* Win9x */
239 "ret = %d\n", ret);
240
241 /* Under Win9x the following RestoreDC call succeeds and clears the save stack. */
242 ret = RestoreDC(hdc, 0);
243 ok(!ret ||
244 broken(ret), /* Win9x */
245 "ret = %d\n", ret);
246
247 /* Trying to clear an empty save stack fails. */
248 ret = RestoreDC(hdc, 0);
249 ok(!ret, "ret = %d\n", ret);
250
251 ret = RestoreDC(hdc, 1);
252 ok(ret ||
253 broken(!ret), /* Win9x */
254 "ret = %d\n", ret);
255
256 DeleteDC(hdc);
257
258 SetLastError(0xdeadbeef);
259 ret = SaveDC(ULongToHandle(0xdeadbeef));
260 ok(!ret, "SaveDC returned %u\n", ret);
261 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
262}
263
265{
266 DEVMODEW * (WINAPI *pGdiConvertToDevmodeW)(const DEVMODEA *);
267 DEVMODEA dmA;
268 DEVMODEW *dmW;
269 BOOL ret;
270
271 pGdiConvertToDevmodeW = (void *)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GdiConvertToDevmodeW");
272 if (!pGdiConvertToDevmodeW)
273 {
274 win_skip("GdiConvertToDevmodeW is not available on this platform\n");
275 return;
276 }
277
278 memset(&dmA, 0, sizeof(dmA));
279 dmA.dmSize = sizeof(dmA);
281 ok(ret, "EnumDisplaySettingsExA error %lu\n", GetLastError());
282 ok(dmA.dmSize >= FIELD_OFFSET(DEVMODEA, dmICMMethod), "dmSize is too small: %04x\n", dmA.dmSize);
283 ok(dmA.dmSize <= sizeof(DEVMODEA), "dmSize is too large: %04x\n", dmA.dmSize);
284
285 dmW = pGdiConvertToDevmodeW(&dmA);
286 ok(dmW->dmSize >= FIELD_OFFSET(DEVMODEW, dmICMMethod), "dmSize is too small: %04x\n", dmW->dmSize);
287 ok(dmW->dmSize <= sizeof(DEVMODEW), "dmSize is too large: %04x\n", dmW->dmSize);
288 HeapFree(GetProcessHeap(), 0, dmW);
289
290 dmA.dmSize = FIELD_OFFSET(DEVMODEA, dmFields) + sizeof(dmA.dmFields);
291 dmW = pGdiConvertToDevmodeW(&dmA);
292 ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmFields) + sizeof(dmW->dmFields),
293 "wrong size %u\n", dmW->dmSize);
294 HeapFree(GetProcessHeap(), 0, dmW);
295
296 dmA.dmICMMethod = DMICMMETHOD_NONE;
297 dmA.dmSize = FIELD_OFFSET(DEVMODEA, dmICMMethod) + sizeof(dmA.dmICMMethod);
298 dmW = pGdiConvertToDevmodeW(&dmA);
299 ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmICMMethod) + sizeof(dmW->dmICMMethod),
300 "wrong size %u\n", dmW->dmSize);
301 ok(dmW->dmICMMethod == DMICMMETHOD_NONE,
302 "expected DMICMMETHOD_NONE, got %lu\n", dmW->dmICMMethod);
303 HeapFree(GetProcessHeap(), 0, dmW);
304
305 dmA.dmSize = 1024;
306 dmW = pGdiConvertToDevmodeW(&dmA);
307 ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmPanningHeight) + sizeof(dmW->dmPanningHeight),
308 "wrong size %u\n", dmW->dmSize);
309 HeapFree(GetProcessHeap(), 0, dmW);
310
311 SetLastError(0xdeadbeef);
312 dmA.dmSize = 0;
313 dmW = pGdiConvertToDevmodeW(&dmA);
314 ok(!dmW, "GdiConvertToDevmodeW should fail\n");
315 ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", GetLastError());
316
317 /* this is the minimal dmSize that XP accepts */
318 dmA.dmSize = FIELD_OFFSET(DEVMODEA, dmFields);
319 dmW = pGdiConvertToDevmodeW(&dmA);
320 ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmFields),
321 "expected %04lx, got %04x\n", FIELD_OFFSET(DEVMODEW, dmFields), dmW->dmSize);
322 HeapFree(GetProcessHeap(), 0, dmW);
323}
324
325static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale )
326{
327 static const int caps[] =
328 {
331 HORZSIZE,
332 VERTSIZE,
333 HORZRES,
334 VERTRES,
335 BITSPIXEL,
336 PLANES,
338 NUMPENS,
340 NUMFONTS,
341 NUMCOLORS,
343 CURVECAPS,
344 LINECAPS,
346 /* TEXTCAPS broken on printer DC on winxp */
347 CLIPCAPS,
349 ASPECTX,
350 ASPECTY,
351 ASPECTXY,
356 COLORRES,
363 VREFRESH,
367 SHADEBLENDCAPS
368 };
369 unsigned int i;
370 WORD ramp[3][256];
371 BOOL ret;
372 RECT rect;
373 UINT type;
374
375 if (GetObjectType( hdc ) == OBJ_METADC)
376 {
377 for (i = 0; i < ARRAY_SIZE(caps); i++)
378 ok( GetDeviceCaps( hdc, caps[i] ) == (caps[i] == TECHNOLOGY ? DT_METAFILE : 0),
379 "wrong caps on %s for %u: %u\n", descr, caps[i],
380 GetDeviceCaps( hdc, caps[i] ) );
381
382 type = GetClipBox( hdc, &rect );
383 ok( type == ERROR, "GetClipBox returned %d on %s\n", type, descr );
384
387 Rectangle( hdc, 2, 2, 5, 5 );
389 ok( !type, "GetBoundsRect succeeded on %s\n", descr );
391 ok( !type, "SetBoundsRect succeeded on %s\n", descr );
392 }
393 else
394 {
395 for (i = 0; i < ARRAY_SIZE(caps); i++)
396 {
397 INT precision = 0;
398 INT hdc_caps = GetDeviceCaps( hdc, caps[i] );
399
400 switch (caps[i])
401 {
402 case HORZSIZE:
403 case VERTSIZE:
404 hdc_caps /= scale;
405 precision = 1;
406 break;
407 case LOGPIXELSX:
408 case LOGPIXELSY:
409 hdc_caps *= scale;
410 break;
411 case VREFRESH:
413 ok( hdc_caps > 0, "expected a positive value on %s, got %d\n", descr, hdc_caps );
414 else
415 ok( hdc_caps == 0, "expected 0 on %s, got %d\n", descr, hdc_caps );
416 break;
417 }
418
419 ok( abs(hdc_caps - GetDeviceCaps( ref_dc, caps[i] )) <= precision,
420 "mismatched caps on %s for %u: %u/%u (scale %d)\n", descr, caps[i],
421 hdc_caps, GetDeviceCaps( ref_dc, caps[i] ), scale );
422 }
423
424 type = GetBoundsRect( hdc, &rect, 0 );
425 ok( type == DCB_RESET || broken(type == DCB_SET) /* XP */,
426 "GetBoundsRect returned type %x for %s\n", type, descr );
427 if (type == DCB_RESET)
428 ok( rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0,
429 "GetBoundsRect returned %s type %x for %s\n", wine_dbgstr_rect( &rect ),
430 type, descr );
432 ok( type == (DCB_RESET | DCB_DISABLE) || broken(type == (DCB_SET | DCB_ENABLE)) /* XP */,
433 "SetBoundsRect returned %x for %s (hdc type %ld)\n", type, descr, GetObjectType( hdc ) );
434
436 Rectangle( hdc, 2, 2, 4, 4 );
439 ok( rect.left == 2 && rect.top == 2 && rect.right == 4 && rect.bottom == 4 && type == DCB_SET,
440 "GetBoundsRect returned %s type %x for %s\n", wine_dbgstr_rect( &rect ),
441 type, descr );
442 }
443
444 type = GetClipBox( ref_dc, &rect );
445 if (type != COMPLEXREGION && type != ERROR) /* region can be complex on multi-monitor setups */
446 {
447 RECT ref_rect;
448
449 ok( type == SIMPLEREGION, "GetClipBox returned %d on %s\n", type, descr );
450 if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY)
451 {
454 "Got DESKTOPHORZRES %d on %s, expected %d\n",
456
459 "Got DESKTOPVERTRES %d on %s, expected %d\n",
461
465 }
466 else
467 {
468 ok( GetDeviceCaps( ref_dc, DESKTOPHORZRES ) == GetDeviceCaps( ref_dc, HORZRES ),
469 "Got DESKTOPHORZRES %d on %s, expected %d\n",
470 GetDeviceCaps( ref_dc, DESKTOPHORZRES ), descr, GetDeviceCaps( ref_dc, HORZRES ));
471 ok( GetDeviceCaps( ref_dc, DESKTOPVERTRES ) == GetDeviceCaps( ref_dc, VERTRES ),
472 "Got DESKTOPVERTRES %d on %s, expected %d\n",
473 GetDeviceCaps( ref_dc, DESKTOPVERTRES ), descr, GetDeviceCaps( ref_dc, VERTRES ));
474 SetRect( &ref_rect, 0, 0, GetDeviceCaps( ref_dc, DESKTOPHORZRES ),
475 GetDeviceCaps( ref_dc, DESKTOPVERTRES ) );
476 }
477
480 ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %s on %s\n",
482 }
483
485 SetMapMode( ref_dc, MM_TEXT );
486 Rectangle( ref_dc, 3, 3, 5, 5 );
487 type = GetBoundsRect( ref_dc, &rect, DCB_RESET );
488 /* it may or may not work on non-memory DCs */
489 ok( (rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0 && type == DCB_RESET) ||
490 (rect.left == 3 && rect.top == 3 && rect.right == 5 && rect.bottom == 5 && type == DCB_SET),
491 "GetBoundsRect returned %s type %x on %s\n", wine_dbgstr_rect( &rect ), type, descr );
492
493 if (GetObjectType( hdc ) == OBJ_MEMDC)
494 {
495 char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
497 HBITMAP dib, old;
498
499 memset( buffer, 0, sizeof(buffer) );
500 info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
501 info->bmiHeader.biWidth = 16;
502 info->bmiHeader.biHeight = 16;
503 info->bmiHeader.biPlanes = 1;
504 info->bmiHeader.biBitCount = 8;
505 info->bmiHeader.biCompression = BI_RGB;
506 dib = CreateDIBSection( ref_dc, info, DIB_RGB_COLORS, NULL, NULL, 0 );
507 old = SelectObject( hdc, dib );
508
509 for (i = 0; i < ARRAY_SIZE(caps); i++)
510 ok( GetDeviceCaps( hdc, caps[i] ) == GetDeviceCaps( ref_dc, caps[i] ),
511 "mismatched caps on %s and DIB for %u: %u/%u\n", descr, caps[i],
512 GetDeviceCaps( hdc, caps[i] ), GetDeviceCaps( ref_dc, caps[i] ) );
513
514 type = GetClipBox( hdc, &rect );
515 ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr );
516 ok( rect.left == 0 && rect.top == 0 && rect.right == 16 && rect.bottom == 16,
517 "GetClipBox returned %s on memdc for %s\n", wine_dbgstr_rect( &rect ), descr );
518
521 Rectangle( hdc, 5, 5, 12, 14 );
523 ok( rect.left == 5 && rect.top == 5 && rect.right == 12 && rect.bottom == 14 && type == DCB_SET,
524 "GetBoundsRect returned %s type %x on memdc for %s\n", wine_dbgstr_rect( &rect ),
525 type, descr );
526
527 SelectObject( hdc, old );
528 DeleteObject( dib );
529 }
530
531 /* Memory DC, metafile DC and enhanced metafile DC support gamma ramp on Win10 1909+. Exclude
532 * these types from tests as they return different results depending on Windows versions */
533 if (GetObjectType( hdc ) != OBJ_MEMDC
536 {
537 SetLastError( 0xdeadbeef );
540 {
541 ok( !ret, "GetDeviceGammaRamp succeeded on %s (type %ld)\n", descr, GetObjectType( hdc ) );
543 || broken(GetLastError() == 0xdeadbeef) /* nt4 */
544 || broken(GetLastError() == NO_ERROR), /* Printer DC on Win10 1909+ */
545 "wrong error %lu on %s\n", GetLastError(), descr );
546 }
547 else
548 {
549 ok( ret || broken(!ret) /* NT4 */, "GetDeviceGammaRamp failed on %s (type %ld), error %lu\n",
551 }
552 }
553
554 /* restore hdc state */
557}
558
559static void test_CreateDC(void)
560{
561 DISPLAY_DEVICEW display_device = {sizeof(display_device)};
562 WCHAR adapter_name[CCHDEVICENAME];
563 DWORD i, j;
564 HDC hdc;
565
566 hdc = CreateDCW( NULL, NULL, NULL, NULL );
567 ok( !hdc, "CreateDC succeeded\n" );
568
569 hdc = CreateDCW( NULL, L"display", NULL, NULL );
570 todo_wine ok( !hdc, "CreateDC succeeded\n" );
571
572 hdc = CreateDCW( L"display", NULL, NULL, NULL );
573 ok( hdc != NULL, "CreateDC failed\n" );
574 DeleteDC( hdc );
575
576 hdc = CreateDCW( L"display", L"deadbeef", NULL, NULL );
577 ok( hdc != NULL, "CreateDC failed\n" );
578 DeleteDC( hdc );
579
580 for (i = 0; EnumDisplayDevicesW( NULL, i, &display_device, 0 ); ++i)
581 {
582 if (!(display_device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP))
583 {
584 hdc = CreateDCW( display_device.DeviceName, NULL, NULL, NULL );
585 todo_wine ok( !hdc, "CreateDC succeeded\n" );
586
587 hdc = CreateDCW( NULL, display_device.DeviceName, NULL, NULL );
588 todo_wine ok( !hdc, "CreateDC succeeded\n" );
589 continue;
590 }
591
592 hdc = CreateDCW( display_device.DeviceName, NULL, NULL, NULL );
593 ok( hdc != NULL, "CreateDC failed %s\n", wine_dbgstr_w( display_device.DeviceName ) );
594 DeleteDC( hdc );
595
596 hdc = CreateDCW( NULL, display_device.DeviceName, NULL, NULL );
597 ok( hdc != NULL, "CreateDC failed\n" );
598 DeleteDC( hdc );
599
600 hdc = CreateDCW( display_device.DeviceName, display_device.DeviceName, NULL, NULL );
601 ok( hdc != NULL, "CreateDC failed\n" );
602 DeleteDC( hdc );
603
604 hdc = CreateDCW( display_device.DeviceName, L"deadbeef", NULL, NULL );
605 ok( hdc != NULL, "CreateDC failed\n" );
606 DeleteDC( hdc );
607
608 lstrcpyW( adapter_name, display_device.DeviceName );
609 for (j = 0; EnumDisplayDevicesW( adapter_name, j, &display_device, 0 ); ++j)
610 {
611 hdc = CreateDCW( display_device.DeviceName, NULL, NULL, NULL );
612 ok( !hdc, "CreateDC succeeded\n" );
613
614 hdc = CreateDCW( NULL, display_device.DeviceName, NULL, NULL );
615 ok( !hdc, "CreateDC succeeded\n" );
616 }
617 }
618}
619
620static void test_CreateCompatibleDC(void)
621{
622 BOOL bRet;
623 HDC hdc, hNewDC, hdcMetafile, screen_dc;
625 INT caps;
626 DEVMODEA dm;
627
628 bitmap = CreateBitmap( 10, 10, 1, 1, NULL );
629
630 memset(&dm, 0, sizeof(dm));
631 dm.dmSize = sizeof(dm);
633 ok(bRet, "EnumDisplaySettingsEx failed\n");
634 dm.dmScale = 200;
635 dm.dmFields |= DM_SCALE;
636 hdc = CreateDCA( "DISPLAY", NULL, NULL, &dm );
637
638 screen_dc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
639 test_device_caps( hdc, screen_dc, "display dc", 1 );
640 ResetDCA( hdc, &dm );
641 test_device_caps( hdc, screen_dc, "display dc", 1 );
642 DeleteDC( hdc );
643
644 /* Create a DC compatible with the screen */
646 ok(hdc != NULL, "CreateCompatibleDC returned %p\n", hdc);
647 ok( SelectObject( hdc, bitmap ) != 0, "SelectObject failed\n" );
648 caps = GetDeviceCaps( hdc, TECHNOLOGY );
649 ok( caps == DT_RASDISPLAY, "wrong caps %u\n", caps );
650
651 test_device_caps( hdc, screen_dc, "display dc", 1 );
652
653 /* Delete this DC, this should succeed */
654 bRet = DeleteDC(hdc);
655 ok(bRet == TRUE, "DeleteDC returned %u\n", bRet);
656
657 /* Try to create a DC compatible to the deleted DC. This has to fail */
658 hNewDC = CreateCompatibleDC(hdc);
659 ok(hNewDC == NULL, "CreateCompatibleDC returned %p\n", hNewDC);
660
661 hdc = GetDC( 0 );
662 hdcMetafile = CreateEnhMetaFileA(hdc, NULL, NULL, NULL);
663 ok(hdcMetafile != 0, "CreateEnhMetaFileA failed\n");
664 hNewDC = CreateCompatibleDC( hdcMetafile );
665 ok(hNewDC != NULL, "CreateCompatibleDC failed\n");
666 ok( SelectObject( hNewDC, bitmap ) != 0, "SelectObject failed\n" );
667 caps = GetDeviceCaps( hdcMetafile, TECHNOLOGY );
668 ok( caps == DT_RASDISPLAY, "wrong caps %u\n", caps );
669 test_device_caps( hdcMetafile, hdc, "enhmetafile dc", 1 );
670 ResetDCA( hdcMetafile, &dm );
671 test_device_caps( hdcMetafile, hdc, "enhmetafile dc", 1 );
672 DeleteDC( hNewDC );
673 DeleteEnhMetaFile( CloseEnhMetaFile( hdcMetafile ));
674 ReleaseDC( 0, hdc );
675
676 hdcMetafile = CreateMetaFileA(NULL);
677 ok(hdcMetafile != 0, "CreateEnhMetaFileA failed\n");
678 hNewDC = CreateCompatibleDC( hdcMetafile );
679 ok(hNewDC == NULL, "CreateCompatibleDC succeeded\n");
680 caps = GetDeviceCaps( hdcMetafile, TECHNOLOGY );
681 ok( caps == DT_METAFILE, "wrong caps %u\n", caps );
682 test_device_caps( hdcMetafile, screen_dc, "metafile dc", 1 );
683 ResetDCA( hdcMetafile, &dm );
684 test_device_caps( hdcMetafile, screen_dc, "metafile dc", 1 );
685 DeleteMetaFile( CloseMetaFile( hdcMetafile ));
686
688 DeleteDC( screen_dc );
689}
690
691static void test_DC_bitmap(void)
692{
694 HDC hdc, hdcmem;
695 DWORD bits[64];
696 HBITMAP hbmp, oldhbmp;
697 COLORREF col;
698 int i, bitspixel;
699 int ret, ret2;
700
701 /* fill bitmap data with b&w pattern */
702 for( i = 0; i < 64; i++) bits[i] = i & 1 ? 0 : 0xffffff;
703
704 hdc = GetDC(0);
705 ok( hdc != NULL, "CreateDC rets %p\n", hdc);
706 bitspixel = GetDeviceCaps( hdc, BITSPIXEL);
707 /* create a memory dc */
708 hdcmem = CreateCompatibleDC( hdc);
709 ok( hdcmem != NULL, "CreateCompatibleDC rets %p\n", hdcmem);
710
711 /* test DescribePixelFormat with descr == NULL */
712 ret2 = DescribePixelFormat(hdcmem, 0, sizeof(descr), NULL);
713 ok(ret2 > 0, "expected ret2 > 0, got %d\n", ret2);
714 ret = DescribePixelFormat(hdcmem, 1, sizeof(descr), NULL);
715 ok(ret == ret2, "expected ret == %d, got %d\n", ret2, ret);
716 ret = DescribePixelFormat(hdcmem, 0x10000, sizeof(descr), NULL);
717 ok(ret == ret2, "expected ret == %d, got %d\n", ret2, ret);
718
719 /* test DescribePixelFormat with descr != NULL */
720 memset(&descr, 0, sizeof(descr));
721 ret = DescribePixelFormat(hdcmem, 0, sizeof(descr), &descr);
722 ok(ret == 0, "expected ret == 0, got %d\n", ret);
723 ok(descr.nSize == 0, "expected descr.nSize == 0, got %d\n", descr.nSize);
724
725 memset(&descr, 0, sizeof(descr));
726 ret = DescribePixelFormat(hdcmem, 1, sizeof(descr), &descr);
727 ok(ret == ret2, "expected ret == %d, got %d\n", ret2, ret);
728 ok(descr.nSize == sizeof(descr), "expected desc.nSize == sizeof(descr), got %d\n", descr.nSize);
729
730 memset(&descr, 0, sizeof(descr));
731 ret = DescribePixelFormat(hdcmem, 0x10000, sizeof(descr), &descr);
732 ok(ret == 0, "expected ret == 0, got %d\n", ret);
733 ok(descr.nSize == 0, "expected descr.nSize == 0, got %d\n", descr.nSize);
734
735 /* test monochrome bitmap: should always work */
736 hbmp = CreateBitmap(32, 32, 1, 1, bits);
737 ok( hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
738 oldhbmp = SelectObject( hdcmem, hbmp);
739 ok( oldhbmp != NULL, "SelectObject returned NULL\n" ); /* a memdc always has a bitmap selected */
740 col = GetPixel( hdcmem, 0, 0);
741 ok( col == 0xffffff, "GetPixel returned %08lx, expected 00ffffff\n", col);
742 col = GetPixel( hdcmem, 1, 1);
743 ok( col == 0x000000, "GetPixel returned %08lx, expected 00000000\n", col);
744 col = GetPixel( hdcmem, 100, 1);
745 ok( col == CLR_INVALID, "GetPixel returned %08lx, expected ffffffff\n", col);
746 SelectObject( hdcmem, oldhbmp);
748
749 /* test with 2 bits color depth, not likely to succeed */
750 hbmp = CreateBitmap(16, 16, 1, 2, bits);
751 ok( hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
752 oldhbmp = SelectObject( hdcmem, hbmp);
753 if( bitspixel != 2)
754 ok( !oldhbmp, "SelectObject of a bitmap with 2 bits/pixel should return NULL\n");
755 if( oldhbmp) SelectObject( hdcmem, oldhbmp);
757
758 /* test with 16 bits color depth, might succeed */
759 hbmp = CreateBitmap(6, 6, 1, 16, bits);
760 ok( hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
761 oldhbmp = SelectObject( hdcmem, hbmp);
762 if( bitspixel == 16) {
763 ok( oldhbmp != NULL, "SelectObject returned NULL\n" );
764 col = GetPixel( hdcmem, 0, 0);
765 ok( col == 0xffffff,
766 "GetPixel of a bitmap with 16 bits/pixel returned %08lx, expected 00ffffff\n", col);
767 col = GetPixel( hdcmem, 1, 1);
768 ok( col == 0x000000,
769 "GetPixel of a bitmap with 16 bits/pixel returned returned %08lx, expected 00000000\n", col);
770 }
771 if( oldhbmp) SelectObject( hdcmem, oldhbmp);
773
774 /* test with 32 bits color depth, probably succeed */
775 hbmp = CreateBitmap(4, 4, 1, 32, bits);
776 ok( hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
777 oldhbmp = SelectObject( hdcmem, hbmp);
778 if( bitspixel == 32) {
779 ok( oldhbmp != NULL, "SelectObject returned NULL\n" );
780 col = GetPixel( hdcmem, 0, 0);
781 ok( col == 0xffffff,
782 "GetPixel of a bitmap with 32 bits/pixel returned %08lx, expected 00ffffff\n", col);
783 col = GetPixel( hdcmem, 1, 1);
784 ok( col == 0x000000,
785 "GetPixel of a bitmap with 32 bits/pixel returned returned %08lx, expected 00000000\n", col);
786 }
787 if( oldhbmp) SelectObject( hdcmem, oldhbmp);
789 ReleaseDC( 0, hdc );
790}
791
792static void test_DeleteDC(void)
793{
794 HWND hwnd;
795 HDC hdc, hdc_test;
796 WNDCLASSEXA cls;
797 int ret;
798
799 /* window DC */
800 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
801 0, 0, 0, NULL);
802 ok(hwnd != 0, "CreateWindowExA failed\n");
803
804 hdc = GetDC(hwnd);
805 ok(hdc != 0, "GetDC failed\n");
807 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
809 ok(ret == DT_RASDISPLAY, "GetDeviceCaps rets %d\n", ret);
810 ret = DeleteDC(hdc);
811 ok(ret, "DeleteDC failed\n");
813 ok(!ret, "GetDeviceCaps should fail for a deleted DC\n");
814
816 ok(hdc != 0, "GetDC failed\n");
818 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
820 ok(ret == DT_RASDISPLAY, "GetDeviceCaps rets %d\n", ret);
821 ret = DeleteDC(hdc);
822 ok(ret, "DeleteDC failed\n");
824 ok(!ret, "GetDeviceCaps should fail for a deleted DC\n");
825
827
828 /* desktop window DC */
830 ok(hwnd != 0, "GetDesktopWindow failed\n");
831
832 hdc = GetDC(hwnd);
833 ok(hdc != 0, "GetDC failed\n");
835 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
837 ok(ret == DT_RASDISPLAY, "GetDeviceCaps rets %d\n", ret);
838 ret = DeleteDC(hdc);
839 ok(ret, "DeleteDC failed\n");
841 ok(!ret, "GetDeviceCaps should fail for a deleted DC\n");
842
844 ok(hdc != 0, "GetDC failed\n");
846 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
848 ok(ret == DT_RASDISPLAY, "GetDeviceCaps rets %d\n", ret);
849 ret = DeleteDC(hdc);
850 ok(ret, "DeleteDC failed\n");
852 ok(!ret, "GetDeviceCaps should fail for a deleted DC\n");
853
854 /* CS_CLASSDC */
855 memset(&cls, 0, sizeof(cls));
856 cls.cbSize = sizeof(cls);
857 cls.style = CS_CLASSDC;
859 cls.lpszClassName = "Wine class DC";
861 ret = RegisterClassExA(&cls);
862 ok(ret, "RegisterClassExA failed\n");
863
864 hwnd = CreateWindowExA(0, "Wine class DC", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
865 0, 0, 0, NULL);
866 ok(hwnd != 0, "CreateWindowExA failed\n");
867
868 hdc = GetDC(hwnd);
869 ok(hdc != 0, "GetDC failed\n");
871 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
872 ret = DeleteDC(hdc);
873 ok(ret, "DeleteDC failed\n");
875 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
876 ret = ReleaseDC(hwnd, hdc);
877 ok(ret, "ReleaseDC failed\n");
879 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
880
881 hdc_test = hdc;
882
884 ok(hdc != 0, "GetDC failed\n");
886 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
888 ok(ret == DT_RASDISPLAY, "GetDeviceCaps rets %d\n", ret);
889 ret = DeleteDC(hdc);
890 ok(ret, "DeleteDC failed\n");
892 ok(!ret, "GetDeviceCaps should fail for a deleted DC\n");
893
895
896 ret = GetObjectType(hdc_test);
897 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
898 ret = GetDeviceCaps(hdc_test, TECHNOLOGY);
899 ok(ret == DT_RASDISPLAY, "GetDeviceCaps rets %d\n", ret);
900
901 ret = UnregisterClassA("Wine class DC", GetModuleHandleA(NULL));
902 ok(ret, "UnregisterClassA failed\n");
903
904 ret = GetDeviceCaps(hdc_test, TECHNOLOGY);
905 ok(!ret, "GetDeviceCaps should fail for a deleted DC\n");
906
907 /* CS_OWNDC */
908 memset(&cls, 0, sizeof(cls));
909 cls.cbSize = sizeof(cls);
910 cls.style = CS_OWNDC;
912 cls.lpszClassName = "Wine own DC";
914 ret = RegisterClassExA(&cls);
915 ok(ret, "RegisterClassExA failed\n");
916
917 hwnd = CreateWindowExA(0, "Wine own DC", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
918 0, 0, 0, NULL);
919 ok(hwnd != 0, "CreateWindowExA failed\n");
920
921 hdc = GetDC(hwnd);
922 ok(hdc != 0, "GetDC failed\n");
924 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
925 ret = DeleteDC(hdc);
926 ok(ret, "DeleteDC failed\n");
928 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
929 ret = ReleaseDC(hwnd, hdc);
930 ok(ret, "ReleaseDC failed\n");
932 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
933
935 ok(hdc != 0, "GetDC failed\n");
937 ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
939 ok(ret == DT_RASDISPLAY, "GetDeviceCaps rets %d\n", ret);
940 ret = DeleteDC(hdc);
941 ok(ret, "DeleteDC failed\n");
943 ok(!ret, "GetDeviceCaps should fail for a deleted DC\n");
944
946
947 ret = UnregisterClassA("Wine own DC", GetModuleHandleA(NULL));
948 ok(ret, "UnregisterClassA failed\n");
949}
950
951static void test_boundsrect(void)
952{
953 char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
955 HDC hdc;
956 HBITMAP bitmap, dib, old;
957 RECT rect, expect, set_rect;
958 UINT ret;
959 int i, level;
960
962 ok(hdc != NULL, "CreateCompatibleDC failed\n");
963 bitmap = CreateCompatibleBitmap( hdc, 200, 200 );
964 old = SelectObject( hdc, bitmap );
965
966 ret = GetBoundsRect(hdc, NULL, 0);
967 ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
968
969 ret = GetBoundsRect(hdc, NULL, ~0U);
970 ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
971
972 /* Test parameter handling order. */
973 SetRect(&set_rect, 10, 20, 40, 50);
974 ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
975 ok(ret & DCB_RESET,
976 "Expected return flag DCB_RESET to be set, got %u\n", ret);
977
979 ok(ret == 0,
980 "Expected GetBoundsRect to return 0, got %u\n", ret);
981
982 ret = GetBoundsRect(hdc, &rect, 0);
983 ok(ret == DCB_RESET,
984 "Expected GetBoundsRect to return DCB_RESET, got %u\n", ret);
986 ok(EqualRect(&rect, &expect), "Expected output rectangle (0,0)-(0,0), got %s\n",
988
989 ret = GetBoundsRect(NULL, NULL, 0);
990 ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
991
992 ret = GetBoundsRect(NULL, NULL, ~0U);
993 ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
994
995 ret = SetBoundsRect(NULL, NULL, 0);
996 ok(ret == 0, "Expected SetBoundsRect to return 0, got %u\n", ret);
997
998 ret = SetBoundsRect(NULL, NULL, ~0U);
999 ok(ret == 0, "Expected SetBoundsRect to return 0, got %u\n", ret);
1000
1001 SetRect(&set_rect, 10, 20, 40, 50);
1002 ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
1003 ok(ret == (DCB_RESET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
1004
1005 ret = GetBoundsRect(hdc, &rect, 0);
1006 ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
1007 SetRect(&expect, 10, 20, 40, 50);
1008 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1009
1011 SetViewportExtEx( hdc, 2, 2, NULL );
1012 ret = GetBoundsRect(hdc, &rect, 0);
1013 ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
1014 SetRect(&expect, 5, 10, 20, 25);
1015 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1016
1017 SetViewportOrgEx( hdc, 20, 30, NULL );
1018 ret = GetBoundsRect(hdc, &rect, 0);
1019 ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
1020 SetRect(&expect, -5, -5, 10, 10);
1021 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1022
1023 SetRect(&set_rect, 10, 20, 40, 50);
1024 ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
1025 ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
1026
1027 ret = GetBoundsRect(hdc, &rect, 0);
1028 ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
1029 SetRect(&expect, 10, 20, 40, 50);
1030 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1031
1033 SetViewportOrgEx( hdc, 0, 0, NULL );
1034 ret = GetBoundsRect(hdc, &rect, 0);
1035 ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
1036 SetRect(&expect, 40, 70, 100, 130);
1037 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1038
1040 ret = GetBoundsRect(hdc, &rect, 0);
1041 ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
1042 SetRect(&expect, 159, 70, 99, 130);
1043 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1044 SetRect(&set_rect, 50, 25, 30, 35);
1045 ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
1046 ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
1047 ret = GetBoundsRect(hdc, &rect, 0);
1048 ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
1049 SetRect(&expect, 50, 25, 30, 35);
1050 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1051
1053 ret = GetBoundsRect(hdc, &rect, 0);
1054 ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
1055 SetRect(&expect, 149, 25, 169, 35);
1056 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1057
1058 /* empty rect resets, except on nt4 */
1059 SetRect(&expect, 20, 20, 10, 10);
1060 ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
1061 ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
1062 ret = GetBoundsRect(hdc, &rect, 0);
1063 ok(ret == DCB_RESET || broken(ret == DCB_SET) /* nt4 */,
1064 "GetBoundsRect returned %x\n", ret);
1065 if (ret == DCB_RESET)
1066 {
1068 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1069
1070 SetRect(&expect, 20, 20, 20, 20);
1071 ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
1072 ok(ret == (DCB_RESET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
1073 ret = GetBoundsRect(hdc, &rect, 0);
1074 ok(ret == DCB_RESET, "GetBoundsRect returned %x\n", ret);
1076 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1077 }
1078
1080 MoveToEx( hdc, 10, 10, NULL );
1081 LineTo( hdc, 20, 20 );
1082 ret = GetBoundsRect( hdc, &rect, 0 );
1083 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1084 SetRect( &expect, 10, 10, 21, 21 );
1085 ok( EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1086 SetRect( &rect, 8, 8, 23, 23 );
1087 expect = rect;
1089 ret = GetBoundsRect( hdc, &rect, 0 );
1090 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1091 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1092
1093 level = SaveDC( hdc );
1094 LineTo( hdc, 30, 25 );
1095 ret = GetBoundsRect( hdc, &rect, 0 );
1096 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1097 SetRect( &expect, 8, 8, 31, 26 );
1098 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1100 LineTo( hdc, 40, 40 );
1101 ret = GetBoundsRect( hdc, &rect, 0 );
1102 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1103 SetRect( &expect, 8, 8, 31, 26 );
1104 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1105 SetRect( &rect, 6, 6, 30, 30 );
1107 ret = GetBoundsRect( hdc, &rect, 0 );
1108 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1109 SetRect( &expect, 6, 6, 31, 30 );
1110 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1111
1112 RestoreDC( hdc, level );
1113 ret = GetBoundsRect( hdc, &rect, 0 );
1114 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1115 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1116 LineTo( hdc, 40, 40 );
1117 ret = GetBoundsRect( hdc, &rect, 0 );
1118 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1119 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1120
1121 SelectObject( hdc, old );
1122 ret = GetBoundsRect( hdc, &rect, 0 );
1123 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1124 SetRect( &expect, 6, 6, 1, 1 );
1125 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1127 LineTo( hdc, 50, 40 );
1128
1130 ret = GetBoundsRect( hdc, &rect, 0 );
1131 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1132 SetRect( &expect, 6, 6, 51, 41 );
1133 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1135 LineTo( hdc, 50, 50 );
1136 ret = GetBoundsRect( hdc, &rect, 0 );
1137 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1138 SetRect( &expect, 6, 6, 51, 51 );
1139 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1140
1141 memset( buffer, 0, sizeof(buffer) );
1142 info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1143 info->bmiHeader.biWidth = 256;
1144 info->bmiHeader.biHeight = 256;
1145 info->bmiHeader.biPlanes = 1;
1146 info->bmiHeader.biBitCount = 8;
1147 info->bmiHeader.biCompression = BI_RGB;
1148 dib = CreateDIBSection( 0, info, DIB_RGB_COLORS, NULL, NULL, 0 );
1149 ok( dib != 0, "failed to create DIB\n" );
1150 SelectObject( hdc, dib );
1151 ret = GetBoundsRect( hdc, &rect, 0 );
1152 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1153 SetRect( &expect, 6, 6, 51, 51 );
1154 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1155 LineTo( hdc, 55, 30 );
1156 ret = GetBoundsRect( hdc, &rect, 0 );
1157 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1158 SetRect( &expect, 6, 6, 56, 51 );
1159 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1160 LineTo( hdc, 300, 30 );
1161 ret = GetBoundsRect( hdc, &rect, 0 );
1162 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1163 SetRect( &expect, 6, 6, 256, 51 );
1164 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1165 LineTo( hdc, -300, -300 );
1166 ret = GetBoundsRect( hdc, &rect, 0 );
1167 ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1168 SetRect( &expect, 0, 0, 256, 51 );
1169 ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1170
1171 /* test the wide pen heuristics */
1173 for (i = 0; i < 1000; i++)
1174 {
1175 static const UINT endcaps[3] = { PS_ENDCAP_ROUND, PS_ENDCAP_SQUARE, PS_ENDCAP_FLAT };
1176 static const UINT joins[3] = { PS_JOIN_ROUND, PS_JOIN_BEVEL, PS_JOIN_MITER };
1177 LOGBRUSH brush = { BS_SOLID, RGB(0,0,0), 0 };
1178 UINT join = joins[i % 3];
1179 UINT endcap = endcaps[(i / 3) % 3];
1180 INT inflate, width = 1 + i / 9;
1181 HPEN pen = ExtCreatePen( PS_GEOMETRIC | join | endcap | PS_SOLID, width, &brush, 0, NULL );
1182 HPEN old = SelectObject( hdc, pen );
1183 MoveToEx( hdc, 100, 100, NULL );
1184 LineTo( hdc, 160, 100 );
1185 LineTo( hdc, 100, 160 );
1186 LineTo( hdc, 160, 160 );
1188 SetRect( &expect, 100, 100, 161, 161 );
1189
1190 inflate = width + 2;
1191 if (join == PS_JOIN_MITER)
1192 {
1193 inflate *= 5;
1194 if (endcap == PS_ENDCAP_SQUARE)
1195 InflateRect( &expect, (inflate * 3 + 1) / 2, (inflate * 3 + 1) / 2 );
1196 else
1198 }
1199 else
1200 {
1201 if (endcap == PS_ENDCAP_SQUARE)
1202 InflateRect( &expect, inflate - inflate / 4, inflate - inflate / 4 );
1203 else
1204 InflateRect( &expect, (inflate + 1) / 2, (inflate + 1) / 2 );
1205 }
1206 expect.left = max( expect.left, 0 );
1207 expect.top = max( expect.top, 0 );
1208 expect.right = min( expect.right, 256 );
1209 expect.bottom = min( expect.bottom, 256 );
1210 ok(EqualRect(&rect, &expect), "Got %s expected %s %u/%x/%x\n", wine_dbgstr_rect(&rect),
1211 wine_dbgstr_rect(&expect), width, endcap, join);
1212 DeleteObject( SelectObject( hdc, old ));
1213 }
1214
1215 DeleteDC( hdc );
1217 DeleteObject( dib );
1218}
1219
1220static void test_desktop_colorres(void)
1221{
1222 HDC hdc = GetDC(NULL);
1223 int bitspixel, colorres;
1224
1225 bitspixel = GetDeviceCaps(hdc, BITSPIXEL);
1226 ok(bitspixel != 0, "Expected to get valid BITSPIXEL capability value\n");
1227
1228 colorres = GetDeviceCaps(hdc, COLORRES);
1229 ok(colorres != 0 ||
1230 broken(colorres == 0), /* Win9x */
1231 "Expected to get valid COLORRES capability value\n");
1232
1233 if (colorres)
1234 {
1235 switch (bitspixel)
1236 {
1237 case 8:
1238 ok(colorres == 18,
1239 "Expected COLORRES to be 18, got %d\n", colorres);
1240 break;
1241 case 16:
1242 ok(colorres == 16,
1243 "Expected COLORRES to be 16, got %d\n", colorres);
1244 break;
1245 case 24:
1246 case 32:
1247 ok(colorres == 24,
1248 "Expected COLORRES to be 24, got %d\n", bitspixel);
1249 break;
1250 default:
1251 ok(0, "Got unknown BITSPIXEL %d with COLORRES %d\n", bitspixel, colorres);
1252 break;
1253 }
1254 }
1255
1256 ReleaseDC(NULL, hdc);
1257}
1258
1259static void test_gamma(void)
1260{
1261 BOOL ret;
1262 HDC hdc = GetDC(NULL);
1263 WORD oldramp[3][256], ramp[3][256];
1264 INT i;
1265
1266 ret = GetDeviceGammaRamp(hdc, &oldramp);
1267 if (!ret)
1268 {
1269 win_skip("GetDeviceGammaRamp failed, skipping tests\n");
1270 goto done;
1271 }
1272
1273 /* try to set back old ramp */
1274 ret = SetDeviceGammaRamp(hdc, &oldramp);
1275 if (!ret)
1276 {
1277 win_skip("SetDeviceGammaRamp failed, skipping tests\n");
1278 goto done;
1279 }
1280
1281 memcpy(ramp, oldramp, sizeof(ramp));
1282
1283 /* set one color ramp to zeros */
1284 memset(ramp[0], 0, sizeof(ramp[0]));
1286 ok(!ret || broken(ret /* win1909 */),
1287 "SetDeviceGammaRamp(zeroes) succeeded\n");
1288
1289 /* set one color ramp to a flat straight rising line */
1290 for (i = 0; i < 256; i++) ramp[0][i] = i;
1292 todo_wine ok(!ret || broken(ret /* win1909 */),
1293 "SetDeviceGammaRamp(low) succeeded\n");
1294
1295 /* set one color ramp to a steep straight rising line */
1296 for (i = 0; i < 256; i++) ramp[0][i] = i * 256;
1298 ok(ret, "SetDeviceGammaRamp(steep) failed\n");
1299
1300 /* try a bright gamma ramp */
1301 ramp[0][0] = 0;
1302 ramp[0][1] = 0x7FFF;
1303 for (i = 2; i < 256; i++) ramp[0][i] = 0xFFFF;
1305 ok(!ret || broken(ret /* win1909 */),
1306 "SetDeviceGammaRam(bright) succeeded\n");
1307
1308 /* try ramps which are not uniform */
1309 for (i = 0; i < 256; i++) ramp[0][i] = 512 * i; /* wraps midway */
1311 ok(ret, "SetDeviceGammaRamp(wrap) failed\n");
1312 for (i = 0; i < 256; i += 2)
1313 ramp[0][i] = ramp[0][i + 1] = 256 * i; /* stairs */
1315 ok(ret, "SetDeviceGammaRamp(stairs) failed\n");
1316
1317 /* cleanup: set old ramp again */
1318 ret = SetDeviceGammaRamp(hdc, &oldramp);
1319 ok(ret, "SetDeviceGammaRamp(old) failed\n");
1320
1321done:
1322 ReleaseDC(NULL, hdc);
1323}
1324
1326{
1327 char tech[256];
1328
1329 if (ExtEscape(hdc, GETTECHNOLOGY, 0, NULL, sizeof(tech), tech) > 0)
1330 return strcmp(tech, "PostScript") == 0;
1331
1332 return FALSE;
1333}
1334
1336{
1337 char buffer[260];
1338 DWORD len;
1340 DRIVER_INFO_3A *dbuf = NULL;
1341 HANDLE hprn = 0;
1342 HDC hdc = 0;
1343 HMODULE winspool = LoadLibraryA( "winspool.drv" );
1344 BOOL (WINAPI *pOpenPrinterA)(LPSTR, HANDLE *, LPPRINTER_DEFAULTSA);
1345 BOOL (WINAPI *pGetDefaultPrinterA)(LPSTR, LPDWORD);
1346 BOOL (WINAPI *pGetPrinterA)(HANDLE, DWORD, LPBYTE, DWORD, LPDWORD);
1347 BOOL (WINAPI *pGetPrinterDriverA)(HANDLE, LPSTR, DWORD, LPBYTE, DWORD, LPDWORD);
1348 BOOL (WINAPI *pClosePrinter)(HANDLE);
1349
1350 pGetDefaultPrinterA = (void *)GetProcAddress( winspool, "GetDefaultPrinterA" );
1351 pOpenPrinterA = (void *)GetProcAddress( winspool, "OpenPrinterA" );
1352 pGetPrinterA = (void *)GetProcAddress( winspool, "GetPrinterA" );
1353 pGetPrinterDriverA = (void *)GetProcAddress( winspool, "GetPrinterDriverA" );
1354 pClosePrinter = (void *)GetProcAddress( winspool, "ClosePrinter" );
1355
1356 if (!pGetDefaultPrinterA || !pOpenPrinterA || !pGetPrinterA || !pGetPrinterDriverA || !pClosePrinter)
1357 goto done;
1358
1359 len = sizeof(buffer);
1360 if (!pGetDefaultPrinterA( buffer, &len )) goto done;
1361 if (!pOpenPrinterA( buffer, &hprn, NULL )) goto done;
1362
1363 pGetPrinterA( hprn, 2, NULL, 0, &len );
1364 pbuf = malloc( len );
1365 if (!pGetPrinterA( hprn, 2, (LPBYTE)pbuf, len, &len )) goto done;
1366
1367 pGetPrinterDriverA( hprn, NULL, 3, NULL, 0, &len );
1368 dbuf = malloc( len );
1369 if (!pGetPrinterDriverA( hprn, NULL, 3, (LPBYTE)dbuf, len, &len )) goto done;
1370
1371 pbuf->pDevMode->dmScale = scale;
1372 pbuf->pDevMode->dmFields |= DM_SCALE;
1373
1374 hdc = CreateDCA( dbuf->pDriverPath, pbuf->pPrinterName, pbuf->pPortName, pbuf->pDevMode );
1375 trace( "hdc %p for driver '%s' printer '%s' port '%s' is %sPostScript\n", hdc,
1376 dbuf->pDriverPath, pbuf->pPrinterName, pbuf->pPortName,
1377 is_postscript_printer(hdc) ? "" : "NOT " );
1378
1379 if (reset) ResetDCA( hdc, pbuf->pDevMode );
1380done:
1381 free( dbuf );
1382 free( pbuf );
1383 if (hprn) pClosePrinter( hprn );
1384 if (winspool) FreeLibrary( winspool );
1385 if (!hdc) skip( "could not create a DC for the default printer\n" );
1386 return hdc;
1387}
1388
1389static void test_printer_dc(void)
1390{
1391 HDC memdc, display_memdc, enhmf_dc;
1392 HBITMAP orig, bmp;
1393 DWORD ret;
1394 HDC hdc, hdc_200;
1395
1396 hdc = create_printer_dc(100, FALSE);
1397 hdc_200 = create_printer_dc(200, FALSE);
1398
1399 if (!hdc || !hdc_200) return;
1400
1401 test_device_caps( hdc, hdc_200, "printer dc", is_postscript_printer(hdc) ? 2 : 1 );
1402 DeleteDC( hdc_200 );
1403
1404 hdc_200 = create_printer_dc(200, TRUE);
1405 test_device_caps( hdc, hdc_200, "printer dc", is_postscript_printer(hdc) ? 2 : 1 );
1406 DeleteDC( hdc_200 );
1407
1408 memdc = CreateCompatibleDC( hdc );
1409 display_memdc = CreateCompatibleDC( 0 );
1410
1411 ok( memdc != NULL, "CreateCompatibleDC failed for printer\n" );
1412 ok( display_memdc != NULL, "CreateCompatibleDC failed for screen\n" );
1413
1415 ok( ret == DT_RASPRINTER, "wrong type %lu\n", ret );
1416
1417 ret = GetDeviceCaps( memdc, TECHNOLOGY );
1418 ok( ret == DT_RASPRINTER, "wrong type %lu\n", ret );
1419
1420 ret = GetDeviceCaps( display_memdc, TECHNOLOGY );
1421 ok( ret == DT_RASDISPLAY, "wrong type %lu\n", ret );
1422
1423 bmp = CreateBitmap( 100, 100, 1, GetDeviceCaps( hdc, BITSPIXEL ), NULL );
1424 orig = SelectObject( memdc, bmp );
1425 ok( orig != NULL, "SelectObject failed\n" );
1426 ok( BitBlt( hdc, 10, 10, 20, 20, memdc, 0, 0, SRCCOPY ), "BitBlt failed\n" );
1427
1428 test_device_caps( memdc, hdc, "printer dc", 1 );
1429
1430 ok( !SelectObject( display_memdc, bmp ), "SelectObject succeeded\n" );
1431 SelectObject( memdc, orig );
1432 DeleteObject( bmp );
1433
1434 bmp = CreateBitmap( 100, 100, 1, 1, NULL );
1435 orig = SelectObject( display_memdc, bmp );
1436 ok( orig != NULL, "SelectObject failed\n" );
1437 ok( !SelectObject( memdc, bmp ), "SelectObject succeeded\n" );
1438 ok( BitBlt( hdc, 10, 10, 20, 20, display_memdc, 0, 0, SRCCOPY ), "BitBlt failed\n" );
1439 ok( BitBlt( memdc, 10, 10, 20, 20, display_memdc, 0, 0, SRCCOPY ), "BitBlt failed\n" );
1440 ok( BitBlt( display_memdc, 10, 10, 20, 20, memdc, 0, 0, SRCCOPY ), "BitBlt failed\n" );
1441
1442 ret = GetPixel( hdc, 0, 0 );
1443 ok( ret == CLR_INVALID, "wrong pixel value %lx\n", ret );
1444
1445 enhmf_dc = CreateEnhMetaFileA( hdc, NULL, NULL, NULL );
1446 ok(enhmf_dc != 0, "CreateEnhMetaFileA failed\n");
1447 test_device_caps( enhmf_dc, hdc, "enhmetafile printer dc", 1 );
1448 DeleteEnhMetaFile( CloseEnhMetaFile( enhmf_dc ));
1449
1450 enhmf_dc = CreateEnhMetaFileA( hdc, NULL, NULL, NULL );
1451 ok(enhmf_dc != 0, "CreateEnhMetaFileA failed\n");
1452 test_device_caps( enhmf_dc, hdc, "enhmetafile printer dc", 1 );
1453 DeleteEnhMetaFile( CloseEnhMetaFile( enhmf_dc ));
1454
1455 DeleteDC( memdc );
1456 DeleteDC( display_memdc );
1457 DeleteDC( hdc );
1458 DeleteObject( bmp );
1459}
1460
1462{
1463 static const char psadobe[10] = "%!PS-Adobe";
1464 char buf[1024], *p;
1466 DOCINFOA di;
1467 DWORD ret;
1468 HANDLE hfile;
1469
1472
1473 di.cbSize = sizeof(di);
1474 di.lpszDocName = "Let's dance";
1475 di.lpszOutput = file_name;
1476 di.lpszDatatype = NULL;
1477 di.fwType = 0;
1478 ret = StartDocA(hdc, &di);
1479 ok(ret > 0, "StartDoc failed: %ld\n", ret);
1480
1481 strcpy(buf + 2, "\n% ===> before DOWNLOADHEADER <===\n");
1482 *(WORD *)buf = strlen(buf + 2);
1484 ok(ret == *(WORD *)buf, "POSTSCRIPT_PASSTHROUGH failed: %ld\n", ret);
1485
1486 strcpy(buf, "deadbeef");
1487 ret = ExtEscape(hdc, DOWNLOADHEADER, 0, NULL, sizeof(buf), buf );
1488 ok(ret == 1, "DOWNLOADHEADER failed\n");
1489 ok(strcmp(buf, "deadbeef") != 0, "DOWNLOADHEADER failed\n");
1490
1491 strcpy(buf + 2, "\n% ===> after DOWNLOADHEADER <===\n");
1492 *(WORD *)buf = strlen(buf + 2);
1494 ok(ret == *(WORD *)buf, "POSTSCRIPT_PASSTHROUGH failed: %ld\n", ret);
1495
1496 ret = EndDoc(hdc);
1497 ok(ret == 1, "EndDoc failed\n");
1498
1500 ok(hfile != INVALID_HANDLE_VALUE, "CreateFile failed\n");
1501 memset(buf, 0, sizeof(buf));
1502 ret = ReadFile(hfile, buf, sizeof(buf), &ret, NULL);
1503 ok(ret, "ReadFile failed\n");
1504 CloseHandle(hfile);
1505
1506 /* skip the HP PCL language selector */
1507 buf[sizeof(buf) - 1] = 0;
1508 p = buf;
1509 while (*p)
1510 {
1511 if (!(p[0] == 0x1b && p[1] == '%') && memcmp(p, "@PJL", 4) != 0)
1512 break;
1513
1514 p = strchr(p, '\n');
1515 if (!p) break;
1516
1517 while (*p == '\r' || *p == '\n') p++;
1518 }
1519 ok(p && !memcmp(p, psadobe, sizeof(psadobe)), "wrong signature: %.14s\n", p ? p : buf);
1520
1522}
1523
1525{
1526 HDC hdc;
1527 char buf[256];
1528 DWORD query, ret;
1529
1530 hdc = create_printer_dc(100, FALSE);
1531
1532 if (!hdc) return;
1533
1535 {
1536 skip("Default printer is not a PostScript device\n");
1537 DeleteDC( hdc );
1538 return;
1539 }
1540
1543 ok(!ret, "GETFACENAME is supported\n");
1544
1547 ok(ret == 1, "DOWNLOADFACE is not supported\n");
1548
1551 ok(ret == 1, "OPENCHANNEL is not supported\n");
1552
1555 ok(ret == 1, "DOWNLOADHEADER is not supported\n");
1556
1559 ok(ret == 1, "CLOSECHANNEL is not supported\n");
1560
1563 ok(ret == 1, "POSTSCRIPT_PASSTHROUGH is not supported\n");
1564
1565 ret = ExtEscape(hdc, GETFACENAME, 0, NULL, sizeof(buf), buf);
1566 ok(ret == 1, "GETFACENAME failed\n");
1567 trace("face name: %s\n", buf);
1568
1570
1571 DeleteDC(hdc);
1572}
1573
1575{
1578};
1579
1581{
1583 HRGN region;
1584
1585 if (!info->region)
1586 {
1587 info->region = CreateRectRgnIndirect(rect);
1588 info->type = SIMPLEREGION;
1589 }
1590 else
1591 {
1593 info->type = CombineRgn(info->region, info->region, region, RGN_OR);
1595 }
1596 return TRUE;
1597}
1598
1600{
1602
1604 DeleteObject(info.region);
1605 return info.type;
1606}
1607
1608static void test_clip_box(void)
1609{
1610 DEVMODEA scale_mode = {.dmSize = sizeof(DEVMODEA)};
1611 HBITMAP bitmap = CreateBitmap(10, 10, 1, 1, NULL);
1612 HDC dc, desktop_dc, printer_dc;
1613 RECT rect, expect, screen_rect;
1614 int type, screen_type;
1615
1617 scale_mode.dmFields |= DM_SCALE;
1618 scale_mode.dmScale = 200;
1619
1623 screen_type = get_screen_region_type();
1624
1625 dc = CreateDCA("DISPLAY", NULL, NULL, NULL);
1626 type = GetClipBox(dc, &rect);
1627 todo_wine_if(screen_type == COMPLEXREGION)
1628 ok(type == screen_type, "wrong region type %d\n", type);
1629 ok(EqualRect(&rect, &screen_rect), "expected %s, got %s\n",
1630 wine_dbgstr_rect(&screen_rect), wine_dbgstr_rect(&rect));
1631 DeleteDC(dc);
1632
1633 dc = CreateDCA("DISPLAY", NULL, NULL, &scale_mode);
1634 type = GetClipBox(dc, &rect);
1635 todo_wine_if(screen_type == COMPLEXREGION)
1636 ok(type == screen_type, "wrong region type %d\n", type);
1637 ok(EqualRect(&rect, &screen_rect), "expected %s, got %s\n",
1638 wine_dbgstr_rect(&screen_rect), wine_dbgstr_rect(&rect));
1639 ResetDCA(dc, &scale_mode);
1640 type = GetClipBox(dc, &rect);
1641 todo_wine_if(screen_type == COMPLEXREGION)
1642 ok(type == screen_type, "wrong region type %d\n", type);
1643 ok(EqualRect(&rect, &screen_rect), "expected %s, got %s\n",
1644 wine_dbgstr_rect(&screen_rect), wine_dbgstr_rect(&rect));
1645 DeleteDC(dc);
1646
1648 type = GetClipBox(dc, &rect);
1649 ok(type == SIMPLEREGION, "wrong region type %d\n", type);
1650 SetRect(&expect, 0, 0, 1, 1);
1651 ok(EqualRect(&rect, &expect), "got %s\n", wine_dbgstr_rect(&rect));
1653 type = GetClipBox(dc, &rect);
1654 ok(type == SIMPLEREGION, "wrong region type %d\n", type);
1655 SetRect(&expect, 0, 0, 10, 10);
1656 ok(EqualRect(&rect, &expect), "got %s\n", wine_dbgstr_rect(&rect));
1657 DeleteDC(dc);
1658
1659 desktop_dc = GetDC(0);
1660 type = GetClipBox(desktop_dc, &rect);
1661 todo_wine_if(screen_type == COMPLEXREGION)
1662 ok(type == screen_type, "wrong region type %d\n", type);
1663 ok(EqualRect(&rect, &screen_rect), "expected %s, got %s\n",
1664 wine_dbgstr_rect(&screen_rect), wine_dbgstr_rect(&rect));
1665
1666 dc = CreateEnhMetaFileA(desktop_dc, NULL, NULL, NULL);
1667 ok(!!dc, "CreateEnhMetaFile() failed\n");
1668 type = GetClipBox(dc, &rect);
1669 todo_wine ok(type == SIMPLEREGION, "wrong region type %d\n", type);
1670 if (type != ERROR)
1671 ok(EqualRect(&rect, &screen_rect), "expected %s, got %s\n",
1672 wine_dbgstr_rect(&screen_rect), wine_dbgstr_rect(&rect));
1674
1675 ReleaseDC(0, desktop_dc);
1676
1678 ok(!!dc, "CreateEnhMetaFile() failed\n");
1679 type = GetClipBox(dc, &rect);
1680 ok(type == ERROR, "wrong region type %d\n", type);
1682
1683 if ((printer_dc = create_printer_dc(100, FALSE)))
1684 {
1685 type = GetClipBox(printer_dc, &rect);
1686 ok(type == SIMPLEREGION, "wrong region type %d\n", type);
1687
1688 dc = CreateCompatibleDC(printer_dc);
1689 type = GetClipBox(dc, &rect);
1690 ok(type == SIMPLEREGION, "wrong region type %d\n", type);
1691 SetRect(&expect, 0, 0, 1, 1);
1692 ok(EqualRect(&rect, &expect), "got %s\n", wine_dbgstr_rect(&rect));
1693 DeleteDC(dc);
1694
1695 dc = CreateEnhMetaFileA(printer_dc, NULL, NULL, NULL);
1696 type = GetClipBox(dc, &rect);
1697 todo_wine ok(type == SIMPLEREGION, "wrong region type %d\n", type);
1699
1700 DeleteDC(printer_dc);
1701 }
1702
1704}
1705
1706static void test_SetPixel(void)
1707{
1708 COLORREF c;
1709
1710 c = SetPixel((HDC)0xdeadbeef, 0, 0, 0);
1711 ok(c == ~0, "SetPixel returned: %lx\n", c);
1712}
1713
1714
1716{
1718 test_savedc();
1719 test_savedc_2();
1721 test_CreateDC();
1724 test_DeleteDC();
1727 test_gamma();
1730 test_clip_box();
1731 test_SetPixel();
1732}
static HRGN hrgn
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
@ lparam
Definition: SystemMenu.c:31
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: bootvid.c:52
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define ARRAY_SIZE(A)
Definition: main.h:20
#define U(x)
Definition: wordpad.c:45
#define ULongToHandle(h)
Definition: basetsd.h:75
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
HBITMAP hbmp
RECT rect
Definition: combotst.c:67
HDC dc
Definition: cylfrac.c:34
#define NO_ERROR
Definition: dderror.h:5
#define CCHDEVICENAME
Definition: ddrawi.h:63
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define FreeLibrary(x)
Definition: compat.h:748
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
int inflate(z_streamp strm, int flush)
Definition: inflate.c:1257
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:1973
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3286
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
#define RGB(r, g, b)
Definition: precomp.h:67
ULONG RGBQUAD
Definition: precomp.h:47
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define ERROR(name)
Definition: error_private.h:53
#define abs(i)
Definition: fconv.c:206
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
STRING Escape(const STRING &str)
Definition: fontsub.cpp:1030
pKey DeleteObject()
DWORD WINAPI SetLayout(_In_ HDC hdc, _In_ DWORD dwLayout)
Definition: coord.c:780
GLint level
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLsizei width
Definition: gl.h:1546
GLboolean reset
Definition: glext.h:5666
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
GLuint buffer
Definition: glext.h:5915
GLuint color
Definition: glext.h:6243
const GLubyte * c
Definition: glext.h:8905
GLint limit
Definition: glext.h:10326
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLint GLint * precision
Definition: glext.h:7539
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
@ extra
Definition: id3.c:95
#define c
Definition: ke_i.h:80
#define wine_dbgstr_w
Definition: kernel32.h:34
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
LONG_PTR LPARAM
Definition: minwindef.h:175
LOCAL int join(int *aux, int a, int b)
Definition: match.c:560
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BITMAP bmp
Definition: alphablend.c:62
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static void test_CreateCompatibleDC(void)
Definition: dc.c:620
static void test_desktop_colorres(void)
Definition: dc.c:1220
static void test_dc_values(void)
Definition: dc.c:36
static void test_pscript_printer_dc(void)
Definition: dc.c:1524
static INT get_screen_region_type(void)
Definition: dc.c:1599
static HDC create_printer_dc(int scale, BOOL reset)
Definition: dc.c:1335
static void test_boundsrect(void)
Definition: dc.c:951
static BOOL is_postscript_printer(HDC hdc)
Definition: dc.c:1325
static void test_DeleteDC(void)
Definition: dc.c:792
static BOOL CALLBACK enum_monitor_proc(HMONITOR monitor, HDC hdc, RECT *rect, LPARAM lparam)
Definition: dc.c:1580
static void print_something(HDC hdc)
Definition: dc.c:1461
static void test_printer_dc(void)
Definition: dc.c:1389
static void test_SetPixel(void)
Definition: dc.c:1706
#define LAYOUT_LTR
Definition: dc.c:33
static void test_CreateDC(void)
Definition: dc.c:559
static void test_device_caps(HDC hdc, HDC ref_dc, const char *descr, int scale)
Definition: dc.c:325
static void test_savedc(void)
Definition: dc.c:186
static void test_clip_box(void)
Definition: dc.c:1608
static void test_savedc_2(void)
Definition: dc.c:115
static void test_GdiConvertToDevmodeW(void)
Definition: dc.c:264
static void test_gamma(void)
Definition: dc.c:1259
static void test_DC_bitmap(void)
Definition: dc.c:691
static const BYTE ramp[17]
Definition: dib.c:2957
static LPCWSTR file_name
Definition: protocol.c:147
#define min(a, b)
Definition: monoChain.cc:55
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
unsigned int UINT
Definition: ndis.h:50
#define LPDWORD
Definition: nt_native.h:46
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define OBJ_DC
Definition: objidl.idl:1016
#define OBJ_METADC
Definition: objidl.idl:1017
#define OBJ_ENHMETADC
Definition: objidl.idl:1025
#define OBJ_MEMDC
Definition: objidl.idl:1023
short WCHAR
Definition: pedump.c:58
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
strcpy
Definition: string.h:131
const char * descr
Definition: boot.c:45
#define memset(x, y, z)
Definition: compat.h:39
WCHAR DeviceName[32]
Definition: wingdi.h:3264
DWORD StateFlags
Definition: wingdi.h:3266
int cbSize
Definition: wingdi.h:2122
LPCSTR lpszOutput
Definition: wingdi.h:2124
LPCSTR lpszDatatype
Definition: wingdi.h:2125
LPCSTR lpszDocName
Definition: wingdi.h:2123
DWORD fwType
Definition: wingdi.h:2126
LPSTR pDriverPath
Definition: winspool.h:406
RGNDATAHEADER rdh
Definition: axextend.idl:399
char Buffer[1]
Definition: axextend.idl:400
HINSTANCE hInstance
Definition: winuser.h:3314
UINT style
Definition: winuser.h:3310
UINT cbSize
Definition: winuser.h:3309
WNDPROC lpfnWndProc
Definition: winuser.h:3311
LPCSTR lpszClassName
Definition: winuser.h:3319
DWORD dmFields
Definition: wingdi.h:2016
short dmScale
Definition: wingdi.h:2023
WORD dmSize
Definition: wingdi.h:2014
DWORD dmFields
Definition: wingdi.h:2068
WORD dmSize
Definition: wingdi.h:2066
Definition: cookie.c:202
Definition: uimain.c:89
Definition: pbuf.h:186
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#define max(a, b)
Definition: svc.c:63
const char * LPCSTR
Definition: typedefs.h:52
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char * LPBYTE
Definition: typedefs.h:53
PVOID HANDLE
Definition: typedefs.h:73
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
#define BI_RGB
Definition: uefivid.c:46
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:78
BOOL WINAPI EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode)
Definition: display.c:312
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
DWORD COLORREF
Definition: windef.h:100
#define WINAPI
Definition: msvc.h:6
#define COMPLEXREGION
Definition: wingdi.h:363
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
#define NUMRESERVED
Definition: wingdi.h:733
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define PHYSICALOFFSETY
Definition: wingdi.h:738
#define NUMBRUSHES
Definition: wingdi.h:722
int WINAPI GetTextCharacterExtra(_In_ HDC)
Definition: text.c:165
#define RASTERCAPS
Definition: wingdi.h:745
#define DIB_RGB_COLORS
Definition: wingdi.h:367
#define HORZRES
Definition: wingdi.h:716
HGDIOBJ WINAPI GetStockObject(_In_ int)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
#define DCB_RESET
Definition: wingdi.h:687
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
#define ASPECTX
Definition: wingdi.h:727
#define DT_RASDISPLAY
Definition: wingdi.h:708
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define DCB_SET
Definition: wingdi.h:688
#define PS_JOIN_BEVEL
Definition: wingdi.h:597
#define DT_RASPRINTER
Definition: wingdi.h:709
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)
#define PHYSICALHEIGHT
Definition: wingdi.h:736
#define COLORRES
Definition: wingdi.h:734
HDC WINAPI CreateMetaFileA(_In_opt_ LPCSTR)
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:860
#define DCB_DISABLE
Definition: wingdi.h:685
#define SCALINGFACTORX
Definition: wingdi.h:739
#define PS_ENDCAP_SQUARE
Definition: wingdi.h:595
#define BLTALIGNMENT
Definition: wingdi.h:744
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
Definition: coord.c:465
#define PS_JOIN_ROUND
Definition: wingdi.h:599
#define NULLREGION
Definition: wingdi.h:361
#define VERTSIZE
Definition: wingdi.h:715
#define LOGPIXELSY
Definition: wingdi.h:719
BOOL WINAPI GetMiterLimit(_In_ HDC, _Out_ PFLOAT)
#define PHYSICALOFFSETX
Definition: wingdi.h:737
#define SIZEPALETTE
Definition: wingdi.h:732
HDC WINAPI ResetDCA(_In_ HDC, _In_ const DEVMODEA *)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define DRIVERVERSION
Definition: wingdi.h:705
#define NUMCOLORS
Definition: wingdi.h:725
#define POLYGONALCAPS
Definition: wingdi.h:779
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HDC WINAPI CreateDCA(_In_opt_ LPCSTR pszDriver, _In_opt_ LPCSTR pszDevice, _In_opt_ LPCSTR pszOutput, _In_opt_ const DEVMODEA *pdmInit)
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
#define DOWNLOADHEADER
Definition: wingdi.h:1067
#define PS_ENDCAP_ROUND
Definition: wingdi.h:594
#define PS_GEOMETRIC
Definition: wingdi.h:583
#define MM_ANISOTROPIC
Definition: wingdi.h:867
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI EndDoc(_In_ HDC)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
int WINAPI SetTextCharacterExtra(_In_ HDC, _In_ int)
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
int WINAPI StartDocA(_In_ HDC, _In_ const DOCINFOA *)
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
#define DCB_ACCUMULATE
Definition: wingdi.h:689
#define DOWNLOADFACE
Definition: wingdi.h:1041
#define HORZSIZE
Definition: wingdi.h:714
#define PDEVICESIZE
Definition: wingdi.h:730
#define SCALINGFACTORY
Definition: wingdi.h:740
BOOL WINAPI SetMiterLimit(_In_ HDC, _In_ FLOAT, _Out_opt_ PFLOAT)
#define CLR_INVALID
Definition: wingdi.h:883
#define VREFRESH
Definition: wingdi.h:741
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)
#define SRCCOPY
Definition: wingdi.h:333
#define VERTRES
Definition: wingdi.h:717
#define LAYOUT_RTL
Definition: wingdi.h:1371
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
int WINAPI DescribePixelFormat(_In_ HDC hdc, _In_ int iPixelFormat, _In_ UINT nBytes, _Out_writes_bytes_opt_(nBytes) LPPIXELFORMATDESCRIPTOR ppfd)
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
#define POSTSCRIPT_PASSTHROUGH
Definition: wingdi.h:1069
#define DM_SCALE
Definition: wingdi.h:1254
#define MM_LOMETRIC
Definition: wingdi.h:872
#define SIMPLEREGION
Definition: wingdi.h:362
#define CURVECAPS
Definition: wingdi.h:759
#define PHYSICALWIDTH
Definition: wingdi.h:735
#define OPAQUE
Definition: wingdi.h:949
#define RGN_OR
Definition: wingdi.h:359
#define NULL_PEN
Definition: wingdi.h:904
#define NUMMARKERS
Definition: wingdi.h:726
#define PLANES
Definition: wingdi.h:721
#define MM_TEXT
Definition: wingdi.h:873
#define DCB_ENABLE
Definition: wingdi.h:686
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
#define GETFACENAME
Definition: wingdi.h:1040
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define DESKTOPHORZRES
Definition: wingdi.h:742
#define LOGPIXELSX
Definition: wingdi.h:718
#define BITSPIXEL
Definition: wingdi.h:720
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
Definition: wingdi.h:1396
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define NUMFONTS
Definition: wingdi.h:724
BOOL WINAPI GetDeviceGammaRamp(_In_ HDC hdc, _Out_writes_bytes_(3 *256 *2) LPVOID lpRamp)
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
BOOL WINAPI SetDeviceGammaRamp(_In_ HDC hdc, _In_reads_bytes_(3 *256 *2) LPVOID lpRamp)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917
#define LINECAPS
Definition: wingdi.h:770
#define ASPECTY
Definition: wingdi.h:728
#define NUMPENS
Definition: wingdi.h:723
struct _devicemodeA DEVMODEA
HRGN WINAPI CreateRectRgnIndirect(_In_ LPCRECT)
BOOL WINAPI DeleteDC(_In_ HDC)
#define DT_METAFILE
Definition: wingdi.h:712
#define DESKTOPVERTRES
Definition: wingdi.h:743
#define DMICMMETHOD_NONE
Definition: wingdi.h:1285
UINT WINAPI SetBoundsRect(_In_ HDC, _In_opt_ LPCRECT, _In_ UINT)
#define GETTECHNOLOGY
Definition: wingdi.h:1015
int WINAPI ExtEscape(_In_ HDC hdc, _In_ int iEscape, _In_ int cjInput, _In_reads_bytes_opt_(cjInput) LPCSTR lpInData, _In_ int cjOutput, _Out_writes_bytes_opt_(cjOutput) LPSTR lpOutData)
#define QUERYESCSUPPORT
Definition: wingdi.h:1001
#define PS_JOIN_MITER
Definition: wingdi.h:598
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define BS_SOLID
Definition: wingdi.h:1086
#define OPENCHANNEL
Definition: wingdi.h:1066
#define CLOSECHANNEL
Definition: wingdi.h:1068
#define PS_SOLID
Definition: wingdi.h:586
int WINAPI SaveDC(_In_ HDC)
#define CLIPCAPS
Definition: wingdi.h:731
int WINAPI GetRgnBox(_In_ HRGN, _Out_ LPRECT)
#define ASPECTXY
Definition: wingdi.h:729
#define TECHNOLOGY
Definition: wingdi.h:706
UINT WINAPI GetBoundsRect(_In_ HDC, _Out_ LPRECT, _In_ UINT)
#define PS_ENDCAP_FLAT
Definition: wingdi.h:596
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)
struct _PRINTER_DEFAULTSA * LPPRINTER_DEFAULTSA
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1050
HDC WINAPI GetWindowDC(_In_opt_ HWND)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define SM_CYSCREEN
Definition: winuser.h:971
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EnumDisplayMonitors(_In_opt_ HDC, _In_opt_ LPCRECT, _In_ MONITORENUMPROC, _In_ LPARAM)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1049
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
BOOL WINAPI UpdateWindow(_In_ HWND)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define CS_OWNDC
Definition: winuser.h:663
#define SW_SHOW
Definition: winuser.h:786
#define CS_CLASSDC
Definition: winuser.h:658
#define SM_CXSCREEN
Definition: winuser.h:970
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1047
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
int WINAPI GetSystemMetrics(_In_ int)
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1048
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)