ReactOS  0.4.15-dev-1397-g19779b3
dc.c File Reference
#include <assert.h>
#include <stdio.h>
#include "wine/test.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winspool.h"
#include "winerror.h"
Include dependency graph for dc.c:

Go to the source code of this file.

Macros

#define NONAMELESSSTRUCT
 
#define NONAMELESSUNION
 
#define LAYOUT_LTR   0
 

Functions

static DWORD (WINAPI *pSetLayout)(HDC hdc
 
static void dump_region (HRGN hrgn)
 
static void test_dc_values (void)
 
static void test_savedc_2 (void)
 
static void test_savedc (void)
 
static void test_GdiConvertToDevmodeW (void)
 
static void test_device_caps (HDC hdc, HDC ref_dc, const char *descr, int scale)
 
static void test_CreateCompatibleDC (void)
 
static void test_DC_bitmap (void)
 
static void test_DeleteDC (void)
 
static void test_boundsrect (void)
 
static void test_desktop_colorres (void)
 
static void test_gamma (void)
 
static BOOL is_postscript_printer (HDC hdc)
 
static HDC create_printer_dc (int scale, BOOL reset)
 
static void test_printer_dc (void)
 
static void print_something (HDC hdc)
 
static void test_pscript_printer_dc (void)
 
 START_TEST (dc)
 

Variables

static DWORD layout
 

Macro Definition Documentation

◆ LAYOUT_LTR

#define LAYOUT_LTR   0

Definition at line 36 of file dc.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 22 of file dc.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 23 of file dc.c.

Function Documentation

◆ create_printer_dc()

static HDC create_printer_dc ( int  scale,
BOOL  reset 
)
static

Definition at line 1244 of file dc.c.

1245 {
1246  char buffer[260];
1247  DWORD len;
1249  DRIVER_INFO_3A *dbuf = NULL;
1250  HANDLE hprn = 0;
1251  HDC hdc = 0;
1252  HMODULE winspool = LoadLibraryA( "winspool.drv" );
1253  BOOL (WINAPI *pOpenPrinterA)(LPSTR, HANDLE *, LPPRINTER_DEFAULTSA);
1254  BOOL (WINAPI *pGetDefaultPrinterA)(LPSTR, LPDWORD);
1255  BOOL (WINAPI *pGetPrinterA)(HANDLE, DWORD, LPBYTE, DWORD, LPDWORD);
1256  BOOL (WINAPI *pGetPrinterDriverA)(HANDLE, LPSTR, DWORD, LPBYTE, DWORD, LPDWORD);
1257  BOOL (WINAPI *pClosePrinter)(HANDLE);
1258 
1259  pGetDefaultPrinterA = (void *)GetProcAddress( winspool, "GetDefaultPrinterA" );
1260  pOpenPrinterA = (void *)GetProcAddress( winspool, "OpenPrinterA" );
1261  pGetPrinterA = (void *)GetProcAddress( winspool, "GetPrinterA" );
1262  pGetPrinterDriverA = (void *)GetProcAddress( winspool, "GetPrinterDriverA" );
1263  pClosePrinter = (void *)GetProcAddress( winspool, "ClosePrinter" );
1264 
1265  if (!pGetDefaultPrinterA || !pOpenPrinterA || !pGetPrinterA || !pGetPrinterDriverA || !pClosePrinter)
1266  goto done;
1267 
1268  len = sizeof(buffer);
1269  if (!pGetDefaultPrinterA( buffer, &len )) goto done;
1270  if (!pOpenPrinterA( buffer, &hprn, NULL )) goto done;
1271 
1272  pGetPrinterA( hprn, 2, NULL, 0, &len );
1273  pbuf = HeapAlloc( GetProcessHeap(), 0, len );
1274  if (!pGetPrinterA( hprn, 2, (LPBYTE)pbuf, len, &len )) goto done;
1275 
1276  pGetPrinterDriverA( hprn, NULL, 3, NULL, 0, &len );
1277  dbuf = HeapAlloc( GetProcessHeap(), 0, len );
1278  if (!pGetPrinterDriverA( hprn, NULL, 3, (LPBYTE)dbuf, len, &len )) goto done;
1279 
1280  pbuf->pDevMode->u1.s1.dmScale = scale;
1281  pbuf->pDevMode->dmFields |= DM_SCALE;
1282 
1283  hdc = CreateDCA( dbuf->pDriverPath, pbuf->pPrinterName, pbuf->pPortName, pbuf->pDevMode );
1284  trace( "hdc %p for driver '%s' printer '%s' port '%s' is %sPostScript\n", hdc,
1285  dbuf->pDriverPath, pbuf->pPrinterName, pbuf->pPortName,
1286  is_postscript_printer(hdc) ? "" : "NOT " );
1287 
1288  if (reset) ResetDCA( hdc, pbuf->pDevMode );
1289 done:
1290  HeapFree( GetProcessHeap(), 0, dbuf );
1291  HeapFree( GetProcessHeap(), 0, pbuf );
1292  if (hprn) pClosePrinter( hprn );
1293  if (winspool) FreeLibrary( winspool );
1294  if (!hdc) skip( "could not create a DC for the default printer\n" );
1295  return hdc;
1296 }
HDC WINAPI ResetDCA(_In_ HDC hdc, _In_ CONST DEVMODEA *lpInitData)
Definition: dc.c:1269
static BOOL is_postscript_printer(HDC hdc)
Definition: dc.c:1234
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
static HDC
Definition: imagelist.c:92
GLuint buffer
Definition: glext.h:5915
char * LPSTR
Definition: xmlstorage.h:182
#define BOOL
Definition: nt_native.h:43
#define DM_SCALE
Definition: wingdi.h:1253
unsigned char * LPBYTE
Definition: typedefs.h:53
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define FreeLibrary(x)
Definition: compat.h:607
#define GetProcessHeap()
Definition: compat.h:595
#define trace
Definition: atltest.h:70
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: pbuf.h:79
#define WINAPI
Definition: msvc.h:6
PVOID HANDLE
Definition: typedefs.h:73
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LPDWORD
Definition: nt_native.h:46
HDC hdc
Definition: main.c:9
GLenum GLsizei len
Definition: glext.h:6722
static DWORD(WINAPI *pSetLayout)(HDC hdc
GLboolean reset
Definition: glext.h:5666
HDC WINAPI CreateDCA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, CONST DEVMODEA *lpdvmInit)
Definition: dc.c:122
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
#define GetProcAddress(x, y)
Definition: compat.h:612
#define HeapFree(x, y, z)
Definition: compat.h:594
struct _PRINTER_DEFAULTSA * LPPRINTER_DEFAULTSA

Referenced by test_printer_dc(), and test_pscript_printer_dc().

◆ dump_region()

static void dump_region ( HRGN  hrgn)
static

Definition at line 41 of file dc.c.

42 {
43  DWORD i, size;
44  RGNDATA *data = NULL;
45  RECT *rect;
46 
47  if (!hrgn)
48  {
49  printf( "(null) region\n" );
50  return;
51  }
52  if (!(size = GetRegionData( hrgn, 0, NULL ))) return;
53  if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return;
55  printf( "%d rects:", data->rdh.nCount );
56  for (i = 0, rect = (RECT *)data->Buffer; i < data->rdh.nCount; i++, rect++)
57  printf( " (%d,%d)-(%d,%d)", rect->left, rect->top, rect->right, rect->bottom );
58  printf( "\n" );
59  HeapFree( GetProcessHeap(), 0, data );
60 }
& rect
Definition: startmenu.cpp:1413
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static HRGN hrgn
Definition: win.c:55
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
#define NULL
Definition: types.h:112
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
#define HeapFree(x, y, z)
Definition: compat.h:594
#define printf
Definition: config.h:203

Referenced by test_savedc_2().

◆ DWORD()

static DWORD ( WINAPI pSetLayout)
static

Referenced by create_printer_dc().

◆ is_postscript_printer()

static BOOL is_postscript_printer ( HDC  hdc)
static

Definition at line 1234 of file dc.c.

1235 {
1236  char tech[256];
1237 
1238  if (ExtEscape(hdc, GETTECHNOLOGY, 0, NULL, sizeof(tech), tech) > 0)
1239  return strcmp(tech, "PostScript") == 0;
1240 
1241  return FALSE;
1242 }
#define FALSE
Definition: types.h:117
#define GETTECHNOLOGY
Definition: wingdi.h:1014
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
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)

Referenced by create_printer_dc(), test_printer_dc(), and test_pscript_printer_dc().

◆ print_something()

static void print_something ( HDC  hdc)
static

Definition at line 1370 of file dc.c.

1371 {
1372  static const char psadobe[10] = "%!PS-Adobe";
1373  char buf[1024], *p;
1375  DOCINFOA di;
1376  DWORD ret;
1377  HANDLE hfile;
1378 
1379  GetTempPathA(sizeof(temp_path), temp_path);
1381 
1382  di.cbSize = sizeof(di);
1383  di.lpszDocName = "Let's dance";
1384  di.lpszOutput = file_name;
1385  di.lpszDatatype = NULL;
1386  di.fwType = 0;
1387  ret = StartDocA(hdc, &di);
1388  ok(ret > 0, "StartDoc failed: %d\n", ret);
1389 
1390  strcpy(buf + 2, "\n% ===> before DOWNLOADHEADER <===\n");
1391  *(WORD *)buf = strlen(buf + 2);
1393  ok(ret == *(WORD *)buf, "POSTSCRIPT_PASSTHROUGH failed: %d\n", ret);
1394 
1395  strcpy(buf, "deadbeef");
1396  ret = ExtEscape(hdc, DOWNLOADHEADER, 0, NULL, sizeof(buf), buf );
1397  ok(ret == 1, "DOWNLOADHEADER failed\n");
1398  ok(strcmp(buf, "deadbeef") != 0, "DOWNLOADHEADER failed\n");
1399 
1400  strcpy(buf + 2, "\n% ===> after DOWNLOADHEADER <===\n");
1401  *(WORD *)buf = strlen(buf + 2);
1403  ok(ret == *(WORD *)buf, "POSTSCRIPT_PASSTHROUGH failed: %d\n", ret);
1404 
1405  ret = EndDoc(hdc);
1406  ok(ret == 1, "EndDoc failed\n");
1407 
1408  hfile = CreateFileA(file_name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
1409  ok(hfile != INVALID_HANDLE_VALUE, "CreateFile failed\n");
1410  memset(buf, 0, sizeof(buf));
1411  ret = ReadFile(hfile, buf, sizeof(buf), &ret, NULL);
1412  ok(ret, "ReadFile failed\n");
1413  CloseHandle(hfile);
1414 
1415  /* skip the HP PCL language selector */
1416  buf[sizeof(buf) - 1] = 0;
1417  p = buf;
1418  while (*p)
1419  {
1420  if (!(p[0] == 0x1b && p[1] == '%') && memcmp(p, "@PJL", 4) != 0)
1421  break;
1422 
1423  p = strchr(p, '\n');
1424  if (!p) break;
1425 
1426  while (*p == '\r' || *p == '\n') p++;
1427  }
1428  ok(p && !memcmp(p, psadobe, sizeof(psadobe)), "wrong signature: %.14s\n", p ? p : buf);
1429 
1431 }
#define CloseHandle
Definition: compat.h:598
STRING Escape(const STRING &str)
Definition: fontsub.cpp:1030
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define DOWNLOADHEADER
Definition: wingdi.h:1066
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define OPEN_EXISTING
Definition: compat.h:634
#define POSTSCRIPT_PASSTHROUGH
Definition: wingdi.h:1068
DWORD fwType
Definition: wingdi.h:1679
LPCSTR lpszOutput
Definition: wingdi.h:1677
#define MAX_PATH
Definition: compat.h:34
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LPCSTR lpszDatatype
Definition: wingdi.h:1678
int ret
HDC hdc
Definition: main.c:9
#define GENERIC_READ
Definition: compat.h:135
int cbSize
Definition: wingdi.h:1675
int WINAPI StartDocA(_In_ HDC, _In_ const DOCINFOA *)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
LPCSTR lpszDocName
Definition: wingdi.h:1676
#define ok(value,...)
Definition: atltest.h:57
#define ReadFile(a, b, c, d, e)
Definition: compat.h:601
#define NULL
Definition: types.h:112
char * strchr(const char *String, int ch)
Definition: utclib.c:501
static LPCWSTR file_name
Definition: protocol.c:147
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599
GLfloat GLfloat p
Definition: glext.h:8902
#define memset(x, y, z)
Definition: compat.h:39
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
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)
int WINAPI EndDoc(_In_ HDC)
char temp_path[MAX_PATH]
Definition: mspatcha.c:123

Referenced by test_pscript_printer_dc().

◆ START_TEST()

START_TEST ( dc  )

Definition at line 1483 of file dc.c.

1484 {
1485  pSetLayout = (void *)GetProcAddress( GetModuleHandleA("gdi32.dll"), "SetLayout");
1486  test_dc_values();
1487  test_savedc();
1488  test_savedc_2();
1491  test_DC_bitmap();
1492  test_DeleteDC();
1493  test_boundsrect();
1495  test_gamma();
1496  test_printer_dc();
1498 }
static void test_boundsrect(void)
Definition: dc.c:855
static void test_CreateCompatibleDC(void)
Definition: dc.c:540
static void test_GdiConvertToDevmodeW(void)
Definition: dc.c:251
static void test_desktop_colorres(void)
Definition: dc.c:1127
static void test_DeleteDC(void)
Definition: dc.c:710
static void test_pscript_printer_dc(void)
Definition: dc.c:1433
static void test_savedc_2(void)
Definition: dc.c:110
static void test_printer_dc(void)
Definition: dc.c:1298
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static void test_DC_bitmap(void)
Definition: dc.c:609
static void test_gamma(void)
Definition: dc.c:1166
#define GetProcAddress(x, y)
Definition: compat.h:612
static void test_savedc(void)
Definition: dc.c:178
static void test_dc_values(void)
Definition: dc.c:62

◆ test_boundsrect()

static void test_boundsrect ( void  )
static

Definition at line 855 of file dc.c.

856 {
857  char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
859  HDC hdc;
860  HBITMAP bitmap, dib, old;
861  RECT rect, expect, set_rect;
862  UINT ret;
863  int i, level;
864 
865  hdc = CreateCompatibleDC(0);
866  ok(hdc != NULL, "CreateCompatibleDC failed\n");
867  bitmap = CreateCompatibleBitmap( hdc, 200, 200 );
868  old = SelectObject( hdc, bitmap );
869 
870  ret = GetBoundsRect(hdc, NULL, 0);
871  ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
872 
873  ret = GetBoundsRect(hdc, NULL, ~0U);
874  ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
875 
876  /* Test parameter handling order. */
877  SetRect(&set_rect, 10, 20, 40, 50);
878  ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
879  ok(ret & DCB_RESET,
880  "Expected return flag DCB_RESET to be set, got %u\n", ret);
881 
883  ok(ret == 0,
884  "Expected GetBoundsRect to return 0, got %u\n", ret);
885 
886  ret = GetBoundsRect(hdc, &rect, 0);
887  ok(ret == DCB_RESET,
888  "Expected GetBoundsRect to return DCB_RESET, got %u\n", ret);
890  ok(EqualRect(&rect, &expect), "Expected output rectangle (0,0)-(0,0), got %s\n",
892 
893  ret = GetBoundsRect(NULL, NULL, 0);
894  ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
895 
896  ret = GetBoundsRect(NULL, NULL, ~0U);
897  ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
898 
899  ret = SetBoundsRect(NULL, NULL, 0);
900  ok(ret == 0, "Expected SetBoundsRect to return 0, got %u\n", ret);
901 
902  ret = SetBoundsRect(NULL, NULL, ~0U);
903  ok(ret == 0, "Expected SetBoundsRect to return 0, got %u\n", ret);
904 
905  SetRect(&set_rect, 10, 20, 40, 50);
906  ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
907  ok(ret == (DCB_RESET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
908 
909  ret = GetBoundsRect(hdc, &rect, 0);
910  ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
911  SetRect(&expect, 10, 20, 40, 50);
912  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
913 
915  SetViewportExtEx( hdc, 2, 2, NULL );
916  ret = GetBoundsRect(hdc, &rect, 0);
917  ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
918  SetRect(&expect, 5, 10, 20, 25);
919  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
920 
921  SetViewportOrgEx( hdc, 20, 30, NULL );
922  ret = GetBoundsRect(hdc, &rect, 0);
923  ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
924  SetRect(&expect, -5, -5, 10, 10);
925  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
926 
927  SetRect(&set_rect, 10, 20, 40, 50);
928  ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
929  ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
930 
931  ret = GetBoundsRect(hdc, &rect, 0);
932  ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
933  SetRect(&expect, 10, 20, 40, 50);
934  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
935 
936  SetMapMode( hdc, MM_TEXT );
937  SetViewportOrgEx( hdc, 0, 0, NULL );
938  ret = GetBoundsRect(hdc, &rect, 0);
939  ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
940  SetRect(&expect, 40, 70, 100, 130);
941  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
942 
943  if (pSetLayout)
944  {
945  pSetLayout( hdc, LAYOUT_RTL );
946  ret = GetBoundsRect(hdc, &rect, 0);
947  ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
948  SetRect(&expect, 159, 70, 99, 130);
949  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
950  SetRect(&set_rect, 50, 25, 30, 35);
951  ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
952  ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
953  ret = GetBoundsRect(hdc, &rect, 0);
954  ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
955  SetRect(&expect, 50, 25, 30, 35);
956  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
957 
958  pSetLayout( hdc, LAYOUT_LTR );
959  ret = GetBoundsRect(hdc, &rect, 0);
960  ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
961  SetRect(&expect, 149, 25, 169, 35);
962  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
963  }
964 
965  /* empty rect resets, except on nt4 */
966  SetRect(&expect, 20, 20, 10, 10);
967  ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
968  ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
969  ret = GetBoundsRect(hdc, &rect, 0);
970  ok(ret == DCB_RESET || broken(ret == DCB_SET) /* nt4 */,
971  "GetBoundsRect returned %x\n", ret);
972  if (ret == DCB_RESET)
973  {
975  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
976 
977  SetRect(&expect, 20, 20, 20, 20);
978  ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
979  ok(ret == (DCB_RESET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
980  ret = GetBoundsRect(hdc, &rect, 0);
981  ok(ret == DCB_RESET, "GetBoundsRect returned %x\n", ret);
983  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
984  }
985 
987  MoveToEx( hdc, 10, 10, NULL );
988  LineTo( hdc, 20, 20 );
989  ret = GetBoundsRect( hdc, &rect, 0 );
990  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
991  SetRect( &expect, 10, 10, 21, 21 );
992  ok( EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
993  SetRect( &rect, 8, 8, 23, 23 );
994  expect = rect;
996  ret = GetBoundsRect( hdc, &rect, 0 );
997  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
998  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
999 
1000  level = SaveDC( hdc );
1001  LineTo( hdc, 30, 25 );
1002  ret = GetBoundsRect( hdc, &rect, 0 );
1003  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1004  SetRect( &expect, 8, 8, 31, 26 );
1005  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1007  LineTo( hdc, 40, 40 );
1008  ret = GetBoundsRect( hdc, &rect, 0 );
1009  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1010  SetRect( &expect, 8, 8, 31, 26 );
1011  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1012  SetRect( &rect, 6, 6, 30, 30 );
1014  ret = GetBoundsRect( hdc, &rect, 0 );
1015  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1016  SetRect( &expect, 6, 6, 31, 30 );
1017  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1018 
1019  RestoreDC( hdc, level );
1020  ret = GetBoundsRect( hdc, &rect, 0 );
1021  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1022  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1023  LineTo( hdc, 40, 40 );
1024  ret = GetBoundsRect( hdc, &rect, 0 );
1025  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1026  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1027 
1028  SelectObject( hdc, old );
1029  ret = GetBoundsRect( hdc, &rect, 0 );
1030  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1031  SetRect( &expect, 6, 6, 1, 1 );
1032  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1034  LineTo( hdc, 50, 40 );
1035 
1036  SelectObject( hdc, bitmap );
1037  ret = GetBoundsRect( hdc, &rect, 0 );
1038  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1039  SetRect( &expect, 6, 6, 51, 41 );
1040  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1042  LineTo( hdc, 50, 50 );
1043  ret = GetBoundsRect( hdc, &rect, 0 );
1044  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1045  SetRect( &expect, 6, 6, 51, 51 );
1046  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1047 
1048  memset( buffer, 0, sizeof(buffer) );
1049  info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1050  info->bmiHeader.biWidth = 256;
1051  info->bmiHeader.biHeight = 256;
1052  info->bmiHeader.biPlanes = 1;
1053  info->bmiHeader.biBitCount = 8;
1054  info->bmiHeader.biCompression = BI_RGB;
1056  ok( dib != 0, "failed to create DIB\n" );
1057  SelectObject( hdc, dib );
1058  ret = GetBoundsRect( hdc, &rect, 0 );
1059  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1060  SetRect( &expect, 6, 6, 51, 51 );
1061  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1062  LineTo( hdc, 55, 30 );
1063  ret = GetBoundsRect( hdc, &rect, 0 );
1064  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1065  SetRect( &expect, 6, 6, 56, 51 );
1066  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1067  LineTo( hdc, 300, 30 );
1068  ret = GetBoundsRect( hdc, &rect, 0 );
1069  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1070  SetRect( &expect, 6, 6, 256, 51 );
1071  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1072  LineTo( hdc, -300, -300 );
1073  ret = GetBoundsRect( hdc, &rect, 0 );
1074  ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
1075  SetRect( &expect, 0, 0, 256, 51 );
1076  ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
1077 
1078  /* test the wide pen heuristics */
1080  for (i = 0; i < 1000; i++)
1081  {
1082  static const UINT endcaps[3] = { PS_ENDCAP_ROUND, PS_ENDCAP_SQUARE, PS_ENDCAP_FLAT };
1083  static const UINT joins[3] = { PS_JOIN_ROUND, PS_JOIN_BEVEL, PS_JOIN_MITER };
1084  LOGBRUSH brush = { BS_SOLID, RGB(0,0,0), 0 };
1085  UINT join = joins[i % 3];
1086  UINT endcap = endcaps[(i / 3) % 3];
1087  INT inflate, width = 1 + i / 9;
1088  HPEN pen = ExtCreatePen( PS_GEOMETRIC | join | endcap | PS_SOLID, width, &brush, 0, NULL );
1089  HPEN old = SelectObject( hdc, pen );
1090  MoveToEx( hdc, 100, 100, NULL );
1091  LineTo( hdc, 160, 100 );
1092  LineTo( hdc, 100, 160 );
1093  LineTo( hdc, 160, 160 );
1095  SetRect( &expect, 100, 100, 161, 161 );
1096 
1097  inflate = width + 2;
1098  if (join == PS_JOIN_MITER)
1099  {
1100  inflate *= 5;
1101  if (endcap == PS_ENDCAP_SQUARE)
1102  InflateRect( &expect, (inflate * 3 + 1) / 2, (inflate * 3 + 1) / 2 );
1103  else
1105  }
1106  else
1107  {
1108  if (endcap == PS_ENDCAP_SQUARE)
1109  InflateRect( &expect, inflate - inflate / 4, inflate - inflate / 4 );
1110  else
1111  InflateRect( &expect, (inflate + 1) / 2, (inflate + 1) / 2 );
1112  }
1113  expect.left = max( expect.left, 0 );
1114  expect.top = max( expect.top, 0 );
1115  expect.right = min( expect.right, 256 );
1116  expect.bottom = min( expect.bottom, 256 );
1117  ok(EqualRect(&rect, &expect), "Got %s expected %s %u/%x/%x\n", wine_dbgstr_rect(&rect),
1118  wine_dbgstr_rect(&expect), width, endcap, join);
1119  DeleteObject( SelectObject( hdc, old ));
1120  }
1121 
1122  DeleteDC( hdc );
1123  DeleteObject( bitmap );
1124  DeleteObject( dib );
1125 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
GLint level
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define max(a, b)
Definition: svc.c:63
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define PS_ENDCAP_SQUARE
Definition: wingdi.h:594
#define LAYOUT_RTL
Definition: wingdi.h:1370
#define RGB(r, g, b)
Definition: precomp.h:62
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define DCB_DISABLE
Definition: wingdi.h:684
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
#define U(x)
Definition: wordpad.c:45
static HDC
Definition: imagelist.c:92
#define PS_JOIN_BEVEL
Definition: wingdi.h:596
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
GLuint buffer
Definition: glext.h:5915
#define PS_JOIN_MITER
Definition: wingdi.h:597
#define DCB_ENABLE
Definition: wingdi.h:685
#define PS_GEOMETRIC
Definition: wingdi.h:582
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define LAYOUT_LTR
Definition: dc.c:36
#define PS_SOLID
Definition: wingdi.h:585
UINT WINAPI SetBoundsRect(HDC hdc, CONST RECT *prc, UINT flags)
Definition: dc.c:814
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define NULL_PEN
Definition: wingdi.h:903
LOCAL int join(int *aux, int a, int b)
Definition: match.c:560
BOOL WINAPI DeleteDC(HDC hdc)
Definition: dc.c:282
#define PS_ENDCAP_ROUND
Definition: wingdi.h:593
INT WINAPI SaveDC(IN HDC hdc)
Definition: dc.c:316
Definition: uimain.c:88
ULONG RGBQUAD
Definition: precomp.h:50
#define PS_JOIN_ROUND
Definition: wingdi.h:598
const char * wine_dbgstr_rect(const RECT *rect)
int ret
HDC hdc
Definition: main.c:9
#define MM_ANISOTROPIC
Definition: wingdi.h:866
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define broken(x)
Definition: _sntprintf.h:21
#define DCB_SET
Definition: wingdi.h:687
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
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
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define ok(value,...)
Definition: atltest.h:57
#define DCB_RESET
Definition: wingdi.h:686
#define PS_ENDCAP_FLAT
Definition: wingdi.h:595
#define expect(expected, got)
Definition: combo.c:36
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
HGDIOBJ WINAPI SelectObject(_In_ HDC hdc, _In_ HGDIOBJ hobj)
Definition: dc.c:1499
static const BYTE dib[]
Definition: ole2.c:201
#define MM_TEXT
Definition: wingdi.h:872
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)
int inflate(z_streamp strm, int flush)
Definition: inflate.c:1257
static HBITMAP bitmap
Definition: clipboard.c:1344
#define BS_SOLID
Definition: wingdi.h:1085
static HBITMAP
Definition: button.c:44
BOOL WINAPI RestoreDC(IN HDC hdc, IN INT iLevel)
Definition: dc.c:328
UINT WINAPI GetBoundsRect(HDC hdc, LPRECT lprcBounds, UINT flags)
Definition: dc.c:799
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
Definition: coord.c:465
HDC WINAPI CreateCompatibleDC(_In_ HDC hdc)
Definition: dc.c:97
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define DCB_ACCUMULATE
Definition: wingdi.h:688
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:47

Referenced by START_TEST().

◆ test_CreateCompatibleDC()

static void test_CreateCompatibleDC ( void  )
static

Definition at line 540 of file dc.c.

541 {
542  BOOL bRet;
543  HDC hdc, hNewDC, hdcMetafile, screen_dc;
544  HBITMAP bitmap;
545  INT caps;
546  DEVMODEA dm;
547 
548  bitmap = CreateBitmap( 10, 10, 1, 1, NULL );
549 
551  ok(bRet, "EnumDisplaySettingsEx failed\n");
552  dm.u1.s1.dmScale = 200;
553  dm.dmFields |= DM_SCALE;
554  hdc = CreateDCA( "DISPLAY", NULL, NULL, &dm );
555 
556  screen_dc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
557  test_device_caps( hdc, screen_dc, "display dc", 1 );
558  ResetDCA( hdc, &dm );
559  test_device_caps( hdc, screen_dc, "display dc", 1 );
560  DeleteDC( hdc );
561 
562  /* Create a DC compatible with the screen */
564  ok(hdc != NULL, "CreateCompatibleDC returned %p\n", hdc);
565  ok( SelectObject( hdc, bitmap ) != 0, "SelectObject failed\n" );
566  caps = GetDeviceCaps( hdc, TECHNOLOGY );
567  ok( caps == DT_RASDISPLAY, "wrong caps %u\n", caps );
568 
569  test_device_caps( hdc, screen_dc, "display dc", 1 );
570 
571  /* Delete this DC, this should succeed */
572  bRet = DeleteDC(hdc);
573  ok(bRet == TRUE, "DeleteDC returned %u\n", bRet);
574 
575  /* Try to create a DC compatible to the deleted DC. This has to fail */
576  hNewDC = CreateCompatibleDC(hdc);
577  ok(hNewDC == NULL, "CreateCompatibleDC returned %p\n", hNewDC);
578 
579  hdc = GetDC( 0 );
580  hdcMetafile = CreateEnhMetaFileA(hdc, NULL, NULL, NULL);
581  ok(hdcMetafile != 0, "CreateEnhMetaFileA failed\n");
582  hNewDC = CreateCompatibleDC( hdcMetafile );
583  ok(hNewDC != NULL, "CreateCompatibleDC failed\n");
584  ok( SelectObject( hNewDC, bitmap ) != 0, "SelectObject failed\n" );
585  caps = GetDeviceCaps( hdcMetafile, TECHNOLOGY );
586  ok( caps == DT_RASDISPLAY, "wrong caps %u\n", caps );
587  test_device_caps( hdcMetafile, hdc, "enhmetafile dc", 1 );
588  ResetDCA( hdcMetafile, &dm );
589  test_device_caps( hdcMetafile, hdc, "enhmetafile dc", 1 );
590  DeleteDC( hNewDC );
591  DeleteEnhMetaFile( CloseEnhMetaFile( hdcMetafile ));
592  ReleaseDC( 0, hdc );
593 
594  hdcMetafile = CreateMetaFileA(NULL);
595  ok(hdcMetafile != 0, "CreateEnhMetaFileA failed\n");
596  hNewDC = CreateCompatibleDC( hdcMetafile );
597  ok(hNewDC == NULL, "CreateCompatibleDC succeeded\n");
598  caps = GetDeviceCaps( hdcMetafile, TECHNOLOGY );
599  ok( caps == DT_METAFILE, "wrong caps %u\n", caps );
600  test_device_caps( hdcMetafile, screen_dc, "metafile dc", 1 );
601  ResetDCA( hdcMetafile, &dm );
602  test_device_caps( hdcMetafile, screen_dc, "metafile dc", 1 );
603  DeleteMetaFile( CloseMetaFile( hdcMetafile ));
604 
605  DeleteObject( bitmap );
606  DeleteDC( screen_dc );
607 }
HDC WINAPI ResetDCA(_In_ HDC hdc, _In_ CONST DEVMODEA *lpInitData)
Definition: dc.c:1269
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
HDC WINAPI CreateMetaFileA(_In_opt_ LPCSTR)
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
short dmScale
Definition: wingdi.h:1576
int WINAPI ReleaseDC(HWND hWnd, HDC hDC)
Definition: dc.c:39
#define DT_RASDISPLAY
Definition: wingdi.h:707
int32_t INT
Definition: typedefs.h:58
#define TECHNOLOGY
Definition: wingdi.h:705
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179
#define DM_SCALE
Definition: wingdi.h:1253
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI GetDeviceCaps(_In_ HDC hdc, _In_ int nIndex)
Definition: dc.c:563
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
BOOL WINAPI DeleteDC(HDC hdc)
Definition: dc.c:282
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
Definition: uimain.c:88
BOOL WINAPI EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode)
Definition: display.c:312
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
DWORD dmFields
Definition: wingdi.h:1569
HDC hdc
Definition: main.c:9
#define ok(value,...)
Definition: atltest.h:57
HDC WINAPI CreateDCA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, CONST DEVMODEA *lpdvmInit)
Definition: dc.c:122
#define NULL
Definition: types.h:112
HGDIOBJ WINAPI SelectObject(_In_ HDC hdc, _In_ HGDIOBJ hobj)
Definition: dc.c:1499
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
static HBITMAP bitmap
Definition: clipboard.c:1344
#define DT_METAFILE
Definition: wingdi.h:711
static HBITMAP
Definition: button.c:44
HDC WINAPI CreateCompatibleDC(_In_ HDC hdc)
Definition: dc.c:97
static void test_device_caps(HDC hdc, HDC ref_dc, const char *descr, int scale)
Definition: dc.c:310
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_DC_bitmap()

static void test_DC_bitmap ( void  )
static

Definition at line 609 of file dc.c.

610 {
612  HDC hdc, hdcmem;
613  DWORD bits[64];
614  HBITMAP hbmp, oldhbmp;
615  COLORREF col;
616  int i, bitspixel;
617  int ret, ret2;
618 
619  /* fill bitmap data with b&w pattern */
620  for( i = 0; i < 64; i++) bits[i] = i & 1 ? 0 : 0xffffff;
621 
622  hdc = GetDC(0);
623  ok( hdc != NULL, "CreateDC rets %p\n", hdc);
624  bitspixel = GetDeviceCaps( hdc, BITSPIXEL);
625  /* create a memory dc */
626  hdcmem = CreateCompatibleDC( hdc);
627  ok( hdcmem != NULL, "CreateCompatibleDC rets %p\n", hdcmem);
628 
629  /* test DescribePixelFormat with descr == NULL */
630  ret2 = DescribePixelFormat(hdcmem, 0, sizeof(descr), NULL);
631  ok(ret2 > 0, "expected ret2 > 0, got %d\n", ret2);
632  ret = DescribePixelFormat(hdcmem, 1, sizeof(descr), NULL);
633  ok(ret == ret2, "expected ret == %d, got %d\n", ret2, ret);
634  ret = DescribePixelFormat(hdcmem, 0x10000, sizeof(descr), NULL);
635  ok(ret == ret2, "expected ret == %d, got %d\n", ret2, ret);
636 
637  /* test DescribePixelFormat with descr != NULL */
638  memset(&descr, 0, sizeof(descr));
639  ret = DescribePixelFormat(hdcmem, 0, sizeof(descr), &descr);
640  ok(ret == 0, "expected ret == 0, got %d\n", ret);
641  ok(descr.nSize == 0, "expected descr.nSize == 0, got %d\n", descr.nSize);
642 
643  memset(&descr, 0, sizeof(descr));
644  ret = DescribePixelFormat(hdcmem, 1, sizeof(descr), &descr);
645  ok(ret == ret2, "expected ret == %d, got %d\n", ret2, ret);
646  ok(descr.nSize == sizeof(descr), "expected desc.nSize == sizeof(descr), got %d\n", descr.nSize);
647 
648  memset(&descr, 0, sizeof(descr));
649  ret = DescribePixelFormat(hdcmem, 0x10000, sizeof(descr), &descr);
650  ok(ret == 0, "expected ret == 0, got %d\n", ret);
651  ok(descr.nSize == 0, "expected descr.nSize == 0, got %d\n", descr.nSize);
652 
653  /* test monochrome bitmap: should always work */
654  hbmp = CreateBitmap(32, 32, 1, 1, bits);
655  ok( hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
656  oldhbmp = SelectObject( hdcmem, hbmp);
657  ok( oldhbmp != NULL, "SelectObject returned NULL\n" ); /* a memdc always has a bitmap selected */
658  col = GetPixel( hdcmem, 0, 0);
659  ok( col == 0xffffff, "GetPixel returned %08x, expected 00ffffff\n", col);
660  col = GetPixel( hdcmem, 1, 1);
661  ok( col == 0x000000, "GetPixel returned %08x, expected 00000000\n", col);
662  col = GetPixel( hdcmem, 100, 1);
663  ok( col == CLR_INVALID, "GetPixel returned %08x, expected ffffffff\n", col);
664  SelectObject( hdcmem, oldhbmp);
665  DeleteObject( hbmp);
666 
667  /* test with 2 bits color depth, not likely to succeed */
668  hbmp = CreateBitmap(16, 16, 1, 2, bits);
669  ok( hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
670  oldhbmp = SelectObject( hdcmem, hbmp);
671  if( bitspixel != 2)
672  ok( !oldhbmp, "SelectObject of a bitmap with 2 bits/pixel should return NULL\n");
673  if( oldhbmp) SelectObject( hdcmem, oldhbmp);
674  DeleteObject( hbmp);
675 
676  /* test with 16 bits color depth, might succeed */
677  hbmp = CreateBitmap(6, 6, 1, 16, bits);
678  ok( hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
679  oldhbmp = SelectObject( hdcmem, hbmp);
680  if( bitspixel == 16) {
681  ok( oldhbmp != NULL, "SelectObject returned NULL\n" );
682  col = GetPixel( hdcmem, 0, 0);
683  ok( col == 0xffffff,
684  "GetPixel of a bitmap with 16 bits/pixel returned %08x, expected 00ffffff\n", col);
685  col = GetPixel( hdcmem, 1, 1);
686  ok( col == 0x000000,
687  "GetPixel of a bitmap with 16 bits/pixel returned returned %08x, expected 00000000\n", col);
688  }
689  if( oldhbmp) SelectObject( hdcmem, oldhbmp);
690  DeleteObject( hbmp);
691 
692  /* test with 32 bits color depth, probably succeed */
693  hbmp = CreateBitmap(4, 4, 1, 32, bits);
694  ok( hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
695  oldhbmp = SelectObject( hdcmem, hbmp);
696  if( bitspixel == 32) {
697  ok( oldhbmp != NULL, "SelectObject returned NULL\n" );
698  col = GetPixel( hdcmem, 0, 0);
699  ok( col == 0xffffff,
700  "GetPixel of a bitmap with 32 bits/pixel returned %08x, expected 00ffffff\n", col);
701  col = GetPixel( hdcmem, 1, 1);
702  ok( col == 0x000000,
703  "GetPixel of a bitmap with 32 bits/pixel returned returned %08x, expected 00000000\n", col);
704  }
705  if( oldhbmp) SelectObject( hdcmem, oldhbmp);
706  DeleteObject( hbmp);
707  ReleaseDC( 0, hdc );
708 }
#define BITSPIXEL
Definition: wingdi.h:719
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
#define CLR_INVALID
Definition: wingdi.h:882
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
int WINAPI ReleaseDC(HWND hWnd, HDC hDC)
Definition: dc.c:39
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
int WINAPI DescribePixelFormat(_In_ HDC hdc, _In_ int iPixelFormat, _In_ UINT nBytes, _Out_writes_bytes_opt_(nBytes) LPPIXELFORMATDESCRIPTOR ppfd)
int WINAPI GetDeviceCaps(_In_ HDC hdc, _In_ int nIndex)
Definition: dc.c:563
HBITMAP hbmp
DWORD COLORREF
Definition: windef.h:300
const char * descr
Definition: boot.c:45
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HDC hdc
Definition: main.c:9
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
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
HGDIOBJ WINAPI SelectObject(_In_ HDC hdc, _In_ HGDIOBJ hobj)
Definition: dc.c:1499
static HBITMAP
Definition: button.c:44
HDC WINAPI CreateCompatibleDC(_In_ HDC hdc)
Definition: dc.c:97
#define memset(x, y, z)
Definition: compat.h:39
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_dc_values()

static void test_dc_values ( void  )
static

Definition at line 62 of file dc.c.

63 {
64  HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
66  int extra;
67 
68  ok( hdc != NULL, "CreateDC failed\n" );
69  color = SetBkColor( hdc, 0x12345678 );
70  ok( color == 0xffffff, "initial color %08x\n", color );
71  color = GetBkColor( hdc );
72  ok( color == 0x12345678, "wrong color %08x\n", color );
73  color = SetBkColor( hdc, 0xffffffff );
74  ok( color == 0x12345678, "wrong color %08x\n", color );
75  color = GetBkColor( hdc );
76  ok( color == 0xffffffff, "wrong color %08x\n", color );
77  color = SetBkColor( hdc, 0 );
78  ok( color == 0xffffffff, "wrong color %08x\n", color );
79  color = GetBkColor( hdc );
80  ok( color == 0, "wrong color %08x\n", color );
81 
82  color = SetTextColor( hdc, 0xffeeddcc );
83  ok( color == 0, "initial color %08x\n", color );
84  color = GetTextColor( hdc );
85  ok( color == 0xffeeddcc, "wrong color %08x\n", color );
86  color = SetTextColor( hdc, 0xffffffff );
87  ok( color == 0xffeeddcc, "wrong color %08x\n", color );
88  color = GetTextColor( hdc );
89  ok( color == 0xffffffff, "wrong color %08x\n", color );
90  color = SetTextColor( hdc, 0 );
91  ok( color == 0xffffffff, "wrong color %08x\n", color );
92  color = GetTextColor( hdc );
93  ok( color == 0, "wrong color %08x\n", color );
94 
96  ok( extra == 0, "initial extra %d\n", extra );
97  SetTextCharacterExtra( hdc, 123 );
99  ok( extra == 123, "initial extra %d\n", extra );
102  ok( extra == 123, "initial extra %d\n", extra );
103  SetMapMode( hdc, MM_TEXT );
105  ok( extra == 123, "initial extra %d\n", extra );
106 
107  DeleteDC( hdc );
108 }
static HDC
Definition: imagelist.c:92
int WINAPI GetTextCharacterExtra(_In_ HDC)
Definition: text.c:165
int WINAPI SetTextCharacterExtra(_In_ HDC, _In_ int)
GLuint color
Definition: glext.h:6243
int WINAPI SetMapMode(_In_ HDC, _In_ int)
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:831
BOOL WINAPI DeleteDC(HDC hdc)
Definition: dc.c:282
Definition: id3.c:95
DWORD COLORREF
Definition: windef.h:300
#define MM_LOMETRIC
Definition: wingdi.h:871
COLORREF WINAPI GetBkColor(_In_ HDC hdc)
Definition: dc.c:956
HDC hdc
Definition: main.c:9
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define ok(value,...)
Definition: atltest.h:57
HDC WINAPI CreateDCA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, CONST DEVMODEA *lpdvmInit)
Definition: dc.c:122
#define NULL
Definition: types.h:112
#define MM_TEXT
Definition: wingdi.h:872
COLORREF WINAPI SetBkColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:977

Referenced by START_TEST().

◆ test_DeleteDC()

static void test_DeleteDC ( void  )
static

Definition at line 710 of file dc.c.

711 {
712  HWND hwnd;
713  HDC hdc, hdc_test;
714  WNDCLASSEXA cls;
715  int ret;
716 
717  /* window DC */
718  hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
719  0, 0, 0, NULL);
720  ok(hwnd != 0, "CreateWindowExA failed\n");
721 
722  hdc = GetDC(hwnd);
723  ok(hdc != 0, "GetDC failed\n");
724  ret = GetObjectType(hdc);
725  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
726  ret = DeleteDC(hdc);
727  ok(ret, "DeleteDC failed\n");
728  ret = GetObjectType(hdc);
729  ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
730 
731  hdc = GetWindowDC(hwnd);
732  ok(hdc != 0, "GetDC failed\n");
733  ret = GetObjectType(hdc);
734  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
735  ret = DeleteDC(hdc);
736  ok(ret, "DeleteDC failed\n");
737  ret = GetObjectType(hdc);
738  ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
739 
741 
742  /* desktop window DC */
744  ok(hwnd != 0, "GetDesktopWindow failed\n");
745 
746  hdc = GetDC(hwnd);
747  ok(hdc != 0, "GetDC failed\n");
748  ret = GetObjectType(hdc);
749  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
750  ret = DeleteDC(hdc);
751  ok(ret, "DeleteDC failed\n");
752  ret = GetObjectType(hdc);
753  ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
754 
755  hdc = GetWindowDC(hwnd);
756  ok(hdc != 0, "GetDC failed\n");
757  ret = GetObjectType(hdc);
758  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
759  ret = DeleteDC(hdc);
760  ok(ret, "DeleteDC failed\n");
761  ret = GetObjectType(hdc);
762  ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
763 
764  /* CS_CLASSDC */
765  memset(&cls, 0, sizeof(cls));
766  cls.cbSize = sizeof(cls);
767  cls.style = CS_CLASSDC;
769  cls.lpszClassName = "Wine class DC";
771  ret = RegisterClassExA(&cls);
772  ok(ret, "RegisterClassExA failed\n");
773 
774  hwnd = CreateWindowExA(0, "Wine class DC", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
775  0, 0, 0, NULL);
776  ok(hwnd != 0, "CreateWindowExA failed\n");
777 
778  hdc = GetDC(hwnd);
779  ok(hdc != 0, "GetDC failed\n");
780  ret = GetObjectType(hdc);
781  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
782  ret = DeleteDC(hdc);
783  ok(ret, "DeleteDC failed\n");
784  ret = GetObjectType(hdc);
785  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
786  ret = ReleaseDC(hwnd, hdc);
787  ok(ret, "ReleaseDC failed\n");
788  ret = GetObjectType(hdc);
789  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
790 
791  hdc_test = hdc;
792 
793  hdc = GetWindowDC(hwnd);
794  ok(hdc != 0, "GetDC failed\n");
795  ret = GetObjectType(hdc);
796  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
797  ret = DeleteDC(hdc);
798  ok(ret, "DeleteDC failed\n");
799  ret = GetObjectType(hdc);
800  ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
801 
803 
804  ret = GetObjectType(hdc_test);
805  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
806 
807  ret = UnregisterClassA("Wine class DC", GetModuleHandleA(NULL));
808  ok(ret, "UnregisterClassA failed\n");
809 
810  ret = GetObjectType(hdc_test);
811  ok(!ret, "GetObjectType should fail for a deleted DC\n");
812 
813  /* CS_OWNDC */
814  memset(&cls, 0, sizeof(cls));
815  cls.cbSize = sizeof(cls);
816  cls.style = CS_OWNDC;
818  cls.lpszClassName = "Wine own DC";
820  ret = RegisterClassExA(&cls);
821  ok(ret, "RegisterClassExA failed\n");
822 
823  hwnd = CreateWindowExA(0, "Wine own DC", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
824  0, 0, 0, NULL);
825  ok(hwnd != 0, "CreateWindowExA failed\n");
826 
827  hdc = GetDC(hwnd);
828  ok(hdc != 0, "GetDC failed\n");
829  ret = GetObjectType(hdc);
830  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
831  ret = DeleteDC(hdc);
832  ok(ret, "DeleteDC failed\n");
833  ret = GetObjectType(hdc);
834  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
835  ret = ReleaseDC(hwnd, hdc);
836  ok(ret, "ReleaseDC failed\n");
837  ret = GetObjectType(hdc);
838  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
839 
840  hdc = GetWindowDC(hwnd);
841  ok(hdc != 0, "GetDC failed\n");
842  ret = GetObjectType(hdc);
843  ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
844  ret = DeleteDC(hdc);
845  ok(ret, "DeleteDC failed\n");
846  ret = GetObjectType(hdc);
847  ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
848 
850 
851  ret = UnregisterClassA("Wine own DC", GetModuleHandleA(NULL));
852  ok(ret, "UnregisterClassA failed\n");
853 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT style
Definition: winuser.h:3177
WNDPROC lpfnWndProc
Definition: winuser.h:3178
HDC WINAPI GetDC(_In_opt_ HWND)
LPCSTR lpszClassName
Definition: winuser.h:3186
static HDC
Definition: imagelist.c:92
#define CS_OWNDC
Definition: winuser.h:650
int WINAPI ReleaseDC(HWND hWnd, HDC hDC)
Definition: dc.c:39
BOOL WINAPI DestroyWindow(_In_ HWND)
HINSTANCE hInstance
Definition: winuser.h:3181
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
UINT cbSize
Definition: winuser.h:3176
BOOL WINAPI DeleteDC(HDC hdc)
Definition: dc.c:282
#define OBJ_DC
Definition: objidl.idl:1411
int ret
HDC hdc
Definition: main.c:9
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
#define broken(x)
Definition: _sntprintf.h:21
#define CS_CLASSDC
Definition: winuser.h:645
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
HDC WINAPI GetWindowDC(_In_opt_ HWND)
#define NULL
Definition: types.h:112
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
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 UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define WS_VISIBLE
Definition: pedump.c:620
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_desktop_colorres()

static void test_desktop_colorres ( void  )
static

Definition at line 1127 of file dc.c.

1128 {
1129  HDC hdc = GetDC(NULL);
1130  int bitspixel, colorres;
1131 
1132  bitspixel = GetDeviceCaps(hdc, BITSPIXEL);
1133  ok(bitspixel != 0, "Expected to get valid BITSPIXEL capability value\n");
1134 
1135  colorres = GetDeviceCaps(hdc, COLORRES);
1136  ok(colorres != 0 ||
1137  broken(colorres == 0), /* Win9x */
1138  "Expected to get valid COLORRES capability value\n");
1139 
1140  if (colorres)
1141  {
1142  switch (bitspixel)
1143  {
1144  case 8:
1145  ok(colorres == 18,
1146  "Expected COLORRES to be 18, got %d\n", colorres);
1147  break;
1148  case 16:
1149  ok(colorres == 16,
1150  "Expected COLORRES to be 16, got %d\n", colorres);
1151  break;
1152  case 24:
1153  case 32:
1154  ok(colorres == 24,
1155  "Expected COLORRES to be 24, got %d\n", bitspixel);
1156  break;
1157  default:
1158  ok(0, "Got unknown BITSPIXEL %d with COLORRES %d\n", bitspixel, colorres);
1159  break;
1160  }
1161  }
1162 
1163  ReleaseDC(NULL, hdc);
1164 }
#define BITSPIXEL
Definition: wingdi.h:719
HDC WINAPI GetDC(_In_opt_ HWND)
#define COLORRES
Definition: wingdi.h:733
static HDC
Definition: imagelist.c:92
int WINAPI ReleaseDC(HWND hWnd, HDC hDC)
Definition: dc.c:39
int WINAPI GetDeviceCaps(_In_ HDC hdc, _In_ int nIndex)
Definition: dc.c:563
HDC hdc
Definition: main.c:9
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112

Referenced by START_TEST().

◆ test_device_caps()

static void test_device_caps ( HDC  hdc,
HDC  ref_dc,
const char descr,
int  scale 
)
static

Definition at line 310 of file dc.c.

311 {
312  static const int caps[] =
313  {
315  TECHNOLOGY,
316  HORZSIZE,
317  VERTSIZE,
318  HORZRES,
319  VERTRES,
320  BITSPIXEL,
321  PLANES,
322  NUMBRUSHES,
323  NUMPENS,
324  NUMMARKERS,
325  NUMFONTS,
326  NUMCOLORS,
327  PDEVICESIZE,
328  CURVECAPS,
329  LINECAPS,
331  /* TEXTCAPS broken on printer DC on winxp */
332  CLIPCAPS,
333  RASTERCAPS,
334  ASPECTX,
335  ASPECTY,
336  ASPECTXY,
337  LOGPIXELSX,
338  LOGPIXELSY,
339  SIZEPALETTE,
340  NUMRESERVED,
341  COLORRES,
348  VREFRESH,
351  BLTALIGNMENT,
352  SHADEBLENDCAPS
353  };
354  unsigned int i;
355  WORD ramp[3][256];
356  BOOL ret;
357  RECT rect;
358  UINT type;
359 
360  if (GetObjectType( hdc ) == OBJ_METADC)
361  {
362  for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
363  ok( GetDeviceCaps( hdc, caps[i] ) == (caps[i] == TECHNOLOGY ? DT_METAFILE : 0),
364  "wrong caps on %s for %u: %u\n", descr, caps[i],
365  GetDeviceCaps( hdc, caps[i] ) );
366 
367  SetLastError( 0xdeadbeef );
369  ok( !ret, "GetDeviceGammaRamp succeeded on %s\n", descr );
370  ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */
371  "wrong error %u on %s\n", GetLastError(), descr );
372  type = GetClipBox( hdc, &rect );
373  ok( type == ERROR, "GetClipBox returned %d on %s\n", type, descr );
374 
376  SetMapMode( hdc, MM_TEXT );
377  Rectangle( hdc, 2, 2, 5, 5 );
379  ok( !type, "GetBoundsRect succeeded on %s\n", descr );
381  ok( !type, "SetBoundsRect succeeded on %s\n", descr );
382  }
383  else
384  {
385  for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
386  {
387  INT precision = 0;
388  INT hdc_caps = GetDeviceCaps( hdc, caps[i] );
389 
390  switch (caps[i])
391  {
392  case HORZSIZE:
393  case VERTSIZE:
394  hdc_caps /= scale;
395  precision = 1;
396  break;
397  case LOGPIXELSX:
398  case LOGPIXELSY:
399  hdc_caps *= scale;
400  break;
401  case VREFRESH:
403  ok( hdc_caps > 0, "expected a positive value on %s, got %d\n", descr, hdc_caps );
404  else
405  ok( hdc_caps == 0, "expected 0 on %s, got %d\n", descr, hdc_caps );
406  break;
407  }
408 
409  ok( abs(hdc_caps - GetDeviceCaps( ref_dc, caps[i] )) <= precision,
410  "mismatched caps on %s for %u: %u/%u (scale %d)\n", descr, caps[i],
411  hdc_caps, GetDeviceCaps( ref_dc, caps[i] ), scale );
412  }
413 
414  SetLastError( 0xdeadbeef );
417  {
418  ok( !ret, "GetDeviceGammaRamp succeeded on %s (type %d)\n", descr, GetObjectType( hdc ) );
419  ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */
420  "wrong error %u on %s\n", GetLastError(), descr );
421  }
422  else
423  ok( ret || broken(!ret) /* NT4 */, "GetDeviceGammaRamp failed on %s (type %d), error %u\n", descr, GetObjectType( hdc ), GetLastError() );
424  type = GetClipBox( hdc, &rect );
426  ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr );
427 
428  type = GetBoundsRect( hdc, &rect, 0 );
429  ok( type == DCB_RESET || broken(type == DCB_SET) /* XP */,
430  "GetBoundsRect returned type %x for %s\n", type, descr );
431  if (type == DCB_RESET)
432  ok( rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0,
433  "GetBoundsRect returned %s type %x for %s\n", wine_dbgstr_rect( &rect ),
434  type, descr );
436  ok( type == (DCB_RESET | DCB_DISABLE) || broken(type == (DCB_SET | DCB_ENABLE)) /* XP */,
437  "SetBoundsRect returned %x for %s (hdc type %d)\n", type, descr, GetObjectType( hdc ) );
438 
439  SetMapMode( hdc, MM_TEXT );
440  Rectangle( hdc, 2, 2, 4, 4 );
443  ok( rect.left == 2 && rect.top == 2 && rect.right == 4 && rect.bottom == 4 && type == DCB_SET,
444  "GetBoundsRect returned %s type %x for %s\n", wine_dbgstr_rect( &rect ),
445  type, descr );
446  }
447 
448  type = GetClipBox( ref_dc, &rect );
449  if (type != COMPLEXREGION && type != ERROR) /* region can be complex on multi-monitor setups */
450  {
451  RECT ref_rect;
452 
453  ok( type == SIMPLEREGION, "GetClipBox returned %d on %s\n", type, descr );
454  if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY)
455  {
458  "Got DESKTOPHORZRES %d on %s, expected %d\n",
460 
463  "Got DESKTOPVERTRES %d on %s, expected %d\n",
465 
469  }
470  else
471  {
472  SetRect( &ref_rect, 0, 0, GetDeviceCaps( ref_dc, DESKTOPHORZRES ),
473  GetDeviceCaps( ref_dc, DESKTOPVERTRES ) );
474  }
475 
478  ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %s on %s\n",
479  wine_dbgstr_rect( &rect ), descr );
480  }
481 
483  SetMapMode( ref_dc, MM_TEXT );
484  Rectangle( ref_dc, 3, 3, 5, 5 );
485  type = GetBoundsRect( ref_dc, &rect, DCB_RESET );
486  /* it may or may not work on non-memory DCs */
487  ok( (rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0 && type == DCB_RESET) ||
488  (rect.left == 3 && rect.top == 3 && rect.right == 5 && rect.bottom == 5 && type == DCB_SET),
489  "GetBoundsRect returned %s type %x on %s\n", wine_dbgstr_rect( &rect ), type, descr );
490 
491  if (GetObjectType( hdc ) == OBJ_MEMDC)
492  {
493  char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
495  HBITMAP dib, old;
496 
497  memset( buffer, 0, sizeof(buffer) );
498  info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
499  info->bmiHeader.biWidth = 16;
500  info->bmiHeader.biHeight = 16;
501  info->bmiHeader.biPlanes = 1;
502  info->bmiHeader.biBitCount = 8;
503  info->bmiHeader.biCompression = BI_RGB;
504  dib = CreateDIBSection( ref_dc, info, DIB_RGB_COLORS, NULL, NULL, 0 );
505  old = SelectObject( hdc, dib );
506 
507  for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
508  ok( GetDeviceCaps( hdc, caps[i] ) == GetDeviceCaps( ref_dc, caps[i] ),
509  "mismatched caps on %s and DIB for %u: %u/%u\n", descr, caps[i],
510  GetDeviceCaps( hdc, caps[i] ), GetDeviceCaps( ref_dc, caps[i] ) );
511 
512  SetLastError( 0xdeadbeef );
514  ok( !ret, "GetDeviceGammaRamp succeeded on %s\n", descr );
515  ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */
516  "wrong error %u on %s\n", GetLastError(), descr );
517 
518  type = GetClipBox( hdc, &rect );
519  ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr );
520  ok( rect.left == 0 && rect.top == 0 && rect.right == 16 && rect.bottom == 16,
521  "GetClipBox returned %s on memdc for %s\n", wine_dbgstr_rect( &rect ), descr );
522 
524  SetMapMode( hdc, MM_TEXT );
525  Rectangle( hdc, 5, 5, 12, 14 );
527  ok( rect.left == 5 && rect.top == 5 && rect.right == 12 && rect.bottom == 14 && type == DCB_SET,
528  "GetBoundsRect returned %s type %x on memdc for %s\n", wine_dbgstr_rect( &rect ),
529  type, descr );
530 
531  SelectObject( hdc, old );
532  DeleteObject( dib );
533  }
534 
535  /* restore hdc state */
537  SetBoundsRect( ref_dc, NULL, DCB_RESET | DCB_DISABLE );
538 }
#define DESKTOPHORZRES
Definition: wingdi.h:741
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define DESKTOPVERTRES
Definition: wingdi.h:742
#define NUMBRUSHES
Definition: wingdi.h:721
#define abs(i)
Definition: fconv.c:206
#define BITSPIXEL
Definition: wingdi.h:719
#define HORZRES
Definition: wingdi.h:715
#define LOGPIXELSX
Definition: wingdi.h:717
#define NUMRESERVED
Definition: wingdi.h:732
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1026
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1028
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define ASPECTX
Definition: wingdi.h:726
#define DCB_DISABLE
Definition: wingdi.h:684
#define ERROR(name)
Definition: error_private.h:53
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
#define OBJ_MEMDC
Definition: objidl.idl:1418
#define COLORRES
Definition: wingdi.h:733
#define DRIVERVERSION
Definition: wingdi.h:704
#define PDEVICESIZE
Definition: wingdi.h:729
#define COMPLEXREGION
Definition: wingdi.h:362
#define BLTALIGNMENT
Definition: wingdi.h:743
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define SCALINGFACTORX
Definition: wingdi.h:738
GLuint buffer
Definition: glext.h:5915
int WINAPI GetClipBox(HDC hdc, LPRECT lprc)
Definition: dc.c:829
#define POLYGONALCAPS
Definition: wingdi.h:778
#define NUMMARKERS
Definition: wingdi.h:725
static const BYTE ramp[17]
Definition: dib.c:2709
#define DCB_ENABLE
Definition: wingdi.h:685
#define RASTERCAPS
Definition: wingdi.h:744
#define DT_RASDISPLAY
Definition: wingdi.h:707
int32_t INT
Definition: typedefs.h:58
#define TECHNOLOGY
Definition: wingdi.h:705
& rect
Definition: startmenu.cpp:1413
#define PHYSICALHEIGHT
Definition: wingdi.h:735
#define SM_CXSCREEN
Definition: winuser.h:949
UINT WINAPI SetBoundsRect(HDC hdc, CONST RECT *prc, UINT flags)
Definition: dc.c:814
#define NUMCOLORS
Definition: wingdi.h:724
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define VREFRESH
Definition: wingdi.h:740
int WINAPI GetDeviceCaps(_In_ HDC hdc, _In_ int nIndex)
Definition: dc.c:563
GLenum GLint GLint * precision
Definition: glext.h:7539
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1029
#define SCALINGFACTORY
Definition: wingdi.h:739
#define todo_wine_if(is_todo)
Definition: test.h:163
#define SM_CYSCREEN
Definition: winuser.h:950
#define DT_RASPRINTER
Definition: wingdi.h:708
#define ASPECTXY
Definition: wingdi.h:728
ULONG RGBQUAD
Definition: precomp.h:50
#define PHYSICALOFFSETY
Definition: wingdi.h:737
#define OBJ_ENHMETADC
Definition: objidl.idl:1420
#define ASPECTY
Definition: wingdi.h:727
const char * descr
Definition: boot.c:45
const char * wine_dbgstr_rect(const RECT *rect)
unsigned short WORD
Definition: ntddk_ex.h:93
#define OBJ_DC
Definition: objidl.idl:1411
int WINAPI GetSystemMetrics(_In_ int)
#define CLIPCAPS
Definition: wingdi.h:730
#define SetLastError(x)
Definition: compat.h:611
#define SIZEPALETTE
Definition: wingdi.h:731
int ret
HDC hdc
Definition: main.c:9
#define broken(x)
Definition: _sntprintf.h:21
#define HORZSIZE
Definition: wingdi.h:713
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1027
#define SIMPLEREGION
Definition: wingdi.h:361
#define DCB_SET
Definition: wingdi.h:687
#define PHYSICALOFFSETX
Definition: wingdi.h:736
BOOL WINAPI GetDeviceGammaRamp(_In_ HDC hdc, _Out_writes_bytes_(3 *256 *2) LPVOID lpRamp)
#define PHYSICALWIDTH
Definition: wingdi.h:734
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define VERTSIZE
Definition: wingdi.h:714
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
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
#define NUMPENS
Definition: wingdi.h:722
#define LINECAPS
Definition: wingdi.h:769
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define ok(value,...)
Definition: atltest.h:57
#define DCB_RESET
Definition: wingdi.h:686
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define OBJ_METADC
Definition: objidl.idl:1412
#define VERTRES
Definition: wingdi.h:716
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
HGDIOBJ WINAPI SelectObject(_In_ HDC hdc, _In_ HGDIOBJ hobj)
Definition: dc.c:1499
static const BYTE dib[]
Definition: ole2.c:201
#define MM_TEXT
Definition: wingdi.h:872
#define LOGPIXELSY
Definition: wingdi.h:718
#define DT_METAFILE
Definition: wingdi.h:711
static HBITMAP
Definition: button.c:44
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
UINT WINAPI GetBoundsRect(HDC hdc, LPRECT lprcBounds, UINT flags)
Definition: dc.c:799
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define DCB_ACCUMULATE
Definition: wingdi.h:688
#define memset(x, y, z)
Definition: compat.h:39
#define CURVECAPS
Definition: wingdi.h:758
#define NUMFONTS
Definition: wingdi.h:723
#define BI_RGB
Definition: precomp.h:47
#define PLANES
Definition: wingdi.h:720

Referenced by test_CreateCompatibleDC(), and test_printer_dc().

◆ test_gamma()

static void test_gamma ( void  )
static

Definition at line 1166 of file dc.c.

1167 {
1168  BOOL ret;
1169  HDC hdc = GetDC(NULL);
1170  WORD oldramp[3][256], ramp[3][256];
1171  INT i;
1172 
1173  ret = GetDeviceGammaRamp(hdc, &oldramp);
1174  if (!ret)
1175  {
1176  win_skip("GetDeviceGammaRamp failed, skipping tests\n");
1177  goto done;
1178  }
1179 
1180  /* try to set back old ramp */
1181  ret = SetDeviceGammaRamp(hdc, &oldramp);
1182  if (!ret)
1183  {
1184  win_skip("SetDeviceGammaRamp failed, skipping tests\n");
1185  goto done;
1186  }
1187 
1188  memcpy(ramp, oldramp, sizeof(ramp));
1189 
1190  /* set one color ramp to zeros */
1191  memset(ramp[0], 0, sizeof(ramp[0]));
1193  ok(!ret, "SetDeviceGammaRamp succeeded\n");
1194 
1195  /* set one color ramp to a flat straight rising line */
1196  for (i = 0; i < 256; i++) ramp[0][i] = i;
1198  todo_wine ok(!ret, "SetDeviceGammaRamp succeeded\n");
1199 
1200  /* set one color ramp to a steep straight rising line */
1201  for (i = 0; i < 256; i++) ramp[0][i] = i * 256;
1203  ok(ret, "SetDeviceGammaRamp failed\n");
1204 
1205  /* try a bright gamma ramp */
1206  ramp[0][0] = 0;
1207  ramp[0][1] = 0x7FFF;
1208  for (i = 2; i < 256; i++) ramp[0][i] = 0xFFFF;
1210  ok(!ret, "SetDeviceGammaRamp succeeded\n");
1211 
1212  /* try ramps which are not uniform */
1213  ramp[0][0] = 0;
1214  for (i = 1; i < 256; i++) ramp[0][i] = ramp[0][i - 1] + 512;
1216  ok(ret, "SetDeviceGammaRamp failed\n");
1217  ramp[0][0] = 0;
1218  for (i = 2; i < 256; i+=2)
1219  {
1220  ramp[0][i - 1] = ramp[0][i - 2];
1221  ramp[0][i] = ramp[0][i - 2] + 512;
1222  }
1224  ok(ret, "SetDeviceGammaRamp failed\n");
1225 
1226  /* cleanup: set old ramp again */
1227  ret = SetDeviceGammaRamp(hdc, &oldramp);
1228  ok(ret, "SetDeviceGammaRamp failed\n");
1229 
1230 done:
1231  ReleaseDC(NULL, hdc);
1232 }
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
static const BYTE ramp[17]
Definition: dib.c:2709
int WINAPI ReleaseDC(HWND hWnd, HDC hDC)
Definition: dc.c:39
int32_t INT
Definition: typedefs.h:58
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
int ret
#define todo_wine
Definition: test.h:162
HDC hdc
Definition: main.c:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL WINAPI GetDeviceGammaRamp(_In_ HDC hdc, _Out_writes_bytes_(3 *256 *2) LPVOID lpRamp)
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
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
BOOL WINAPI SetDeviceGammaRamp(_In_ HDC hdc, _In_reads_bytes_(3 *256 *2) LPVOID lpRamp)
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:149

Referenced by START_TEST().

◆ test_GdiConvertToDevmodeW()

static void test_GdiConvertToDevmodeW ( void  )
static

Definition at line 251 of file dc.c.

252 {
253  DEVMODEW * (WINAPI *pGdiConvertToDevmodeW)(const DEVMODEA *);
254  DEVMODEA dmA;
255  DEVMODEW *dmW;
256  BOOL ret;
257 
258  pGdiConvertToDevmodeW = (void *)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GdiConvertToDevmodeW");
259  if (!pGdiConvertToDevmodeW)
260  {
261  win_skip("GdiConvertToDevmodeW is not available on this platform\n");
262  return;
263  }
264 
266  ok(ret, "EnumDisplaySettingsExA error %u\n", GetLastError());
267  ok(dmA.dmSize >= FIELD_OFFSET(DEVMODEA, dmICMMethod), "dmSize is too small: %04x\n", dmA.dmSize);
268  ok(dmA.dmSize <= sizeof(DEVMODEA), "dmSize is too large: %04x\n", dmA.dmSize);
269 
270  dmW = pGdiConvertToDevmodeW(&dmA);
271  ok(dmW->dmSize >= FIELD_OFFSET(DEVMODEW, dmICMMethod), "dmSize is too small: %04x\n", dmW->dmSize);
272  ok(dmW->dmSize <= sizeof(DEVMODEW), "dmSize is too large: %04x\n", dmW->dmSize);
273  HeapFree(GetProcessHeap(), 0, dmW);
274 
275  dmA.dmSize = FIELD_OFFSET(DEVMODEA, dmFields) + sizeof(dmA.dmFields);
276  dmW = pGdiConvertToDevmodeW(&dmA);
277  ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmFields) + sizeof(dmW->dmFields),
278  "wrong size %u\n", dmW->dmSize);
279  HeapFree(GetProcessHeap(), 0, dmW);
280 
281  dmA.dmICMMethod = DMICMMETHOD_NONE;
282  dmA.dmSize = FIELD_OFFSET(DEVMODEA, dmICMMethod) + sizeof(dmA.dmICMMethod);
283  dmW = pGdiConvertToDevmodeW(&dmA);
284  ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmICMMethod) + sizeof(dmW->dmICMMethod),
285  "wrong size %u\n", dmW->dmSize);
286  ok(dmW->dmICMMethod == DMICMMETHOD_NONE,
287  "expected DMICMMETHOD_NONE, got %u\n", dmW->dmICMMethod);
288  HeapFree(GetProcessHeap(), 0, dmW);
289 
290  dmA.dmSize = 1024;
291  dmW = pGdiConvertToDevmodeW(&dmA);
292  ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmPanningHeight) + sizeof(dmW->dmPanningHeight),
293  "wrong size %u\n", dmW->dmSize);
294  HeapFree(GetProcessHeap(), 0, dmW);
295 
296  SetLastError(0xdeadbeef);
297  dmA.dmSize = 0;
298  dmW = pGdiConvertToDevmodeW(&dmA);
299  ok(!dmW, "GdiConvertToDevmodeW should fail\n");
300  ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %u\n", GetLastError());
301 
302  /* this is the minimal dmSize that XP accepts */
303  dmA.dmSize = FIELD_OFFSET(DEVMODEA, dmFields);
304  dmW = pGdiConvertToDevmodeW(&dmA);
305  ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmFields),
306  "expected %04x, got %04x\n", FIELD_OFFSET(DEVMODEW, dmFields), dmW->dmSize);
307  HeapFree(GetProcessHeap(), 0, dmW);
308 }
DWORD dmFields
Definition: wingdi.h:1621
WORD dmSize
Definition: wingdi.h:1567
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:595
BOOL WINAPI EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode)
Definition: display.c:312
WORD dmSize
Definition: wingdi.h:1619
#define WINAPI
Definition: msvc.h:6
#define SetLastError(x)
Definition: compat.h:611
DWORD dmFields
Definition: wingdi.h:1569
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define DMICMMETHOD_NONE
Definition: wingdi.h:1284
#define ok(value,...)
Definition: atltest.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NULL
Definition: types.h:112
#define GetProcAddress(x, y)
Definition: compat.h:612
#define win_skip
Definition: test.h:149
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by START_TEST().

◆ test_printer_dc()

static void test_printer_dc ( void  )
static

Definition at line 1298 of file dc.c.

1299 {
1300  HDC memdc, display_memdc, enhmf_dc;
1301  HBITMAP orig, bmp;
1302  DWORD ret;
1303  HDC hdc, hdc_200;
1304 
1305  hdc = create_printer_dc(100, FALSE);
1306  hdc_200 = create_printer_dc(200, FALSE);
1307 
1308  if (!hdc || !hdc_200) return;
1309 
1310  test_device_caps( hdc, hdc_200, "printer dc", is_postscript_printer(hdc) ? 2 : 1 );
1311  DeleteDC( hdc_200 );
1312 
1313  hdc_200 = create_printer_dc(200, TRUE);
1314  test_device_caps( hdc, hdc_200, "printer dc", is_postscript_printer(hdc) ? 2 : 1 );
1315  DeleteDC( hdc_200 );
1316 
1317  memdc = CreateCompatibleDC( hdc );
1318  display_memdc = CreateCompatibleDC( 0 );
1319 
1320  ok( memdc != NULL, "CreateCompatibleDC failed for printer\n" );
1321  ok( display_memdc != NULL, "CreateCompatibleDC failed for screen\n" );
1322 
1324  ok( ret == DT_RASPRINTER, "wrong type %u\n", ret );
1325 
1326  ret = GetDeviceCaps( memdc, TECHNOLOGY );
1327  ok( ret == DT_RASPRINTER, "wrong type %u\n", ret );
1328 
1329  ret = GetDeviceCaps( display_memdc, TECHNOLOGY );
1330  ok( ret == DT_RASDISPLAY, "wrong type %u\n", ret );
1331 
1332  bmp = CreateBitmap( 100, 100, 1, GetDeviceCaps( hdc, BITSPIXEL ), NULL );
1333  orig = SelectObject( memdc, bmp );
1334  ok( orig != NULL, "SelectObject failed\n" );
1335  ok( BitBlt( hdc, 10, 10, 20, 20, memdc, 0, 0, SRCCOPY ), "BitBlt failed\n" );
1336 
1337  test_device_caps( memdc, hdc, "printer dc", 1 );
1338 
1339  ok( !SelectObject( display_memdc, bmp ), "SelectObject succeeded\n" );
1340  SelectObject( memdc, orig );
1341  DeleteObject( bmp );
1342 
1343  bmp = CreateBitmap( 100, 100, 1, 1, NULL );
1344  orig = SelectObject( display_memdc, bmp );
1345  ok( orig != NULL, "SelectObject failed\n" );
1346  ok( !SelectObject( memdc, bmp ), "SelectObject succeeded\n" );
1347  ok( BitBlt( hdc, 10, 10, 20, 20, display_memdc, 0, 0, SRCCOPY ), "BitBlt failed\n" );
1348  ok( BitBlt( memdc, 10, 10, 20, 20, display_memdc, 0, 0, SRCCOPY ), "BitBlt failed\n" );
1349  ok( BitBlt( display_memdc, 10, 10, 20, 20, memdc, 0, 0, SRCCOPY ), "BitBlt failed\n" );
1350 
1351  ret = GetPixel( hdc, 0, 0 );
1352  ok( ret == CLR_INVALID, "wrong pixel value %x\n", ret );
1353 
1354  enhmf_dc = CreateEnhMetaFileA( hdc, NULL, NULL, NULL );
1355  ok(enhmf_dc != 0, "CreateEnhMetaFileA failed\n");
1356  test_device_caps( enhmf_dc, hdc, "enhmetafile printer dc", 1 );
1357  DeleteEnhMetaFile( CloseEnhMetaFile( enhmf_dc ));
1358 
1359  enhmf_dc = CreateEnhMetaFileA( hdc, NULL, NULL, NULL );
1360  ok(enhmf_dc != 0, "CreateEnhMetaFileA failed\n");
1361  test_device_caps( enhmf_dc, hdc, "enhmetafile printer dc", 1 );
1362  DeleteEnhMetaFile( CloseEnhMetaFile( enhmf_dc ));
1363 
1364  DeleteDC( memdc );
1365  DeleteDC( display_memdc );
1366  DeleteDC( hdc );
1367  DeleteObject( bmp );
1368 }
#define BITSPIXEL
Definition: wingdi.h:719
static BOOL is_postscript_printer(HDC hdc)
Definition: dc.c:1234
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
#define CLR_INVALID
Definition: wingdi.h:882
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
#define DT_RASDISPLAY
Definition: wingdi.h:707
#define TECHNOLOGY
Definition: wingdi.h:705
#define FALSE
Definition: types.h:117
int WINAPI GetDeviceCaps(_In_ HDC hdc, _In_ int nIndex)
Definition: dc.c:563
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
BOOL WINAPI DeleteDC(HDC hdc)
Definition: dc.c:282
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
static HDC create_printer_dc(int scale, BOOL reset)
Definition: dc.c:1244
#define DT_RASPRINTER
Definition: wingdi.h:708
unsigned long DWORD
Definition: ntddk_ex.h:95
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
BITMAP bmp
Definition: alphablend.c:62
int ret
HDC hdc
Definition: main.c:9
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
HGDIOBJ WINAPI SelectObject(_In_ HDC hdc, _In_ HGDIOBJ hobj)
Definition: dc.c:1499
static HBITMAP
Definition: button.c:44
HDC WINAPI CreateCompatibleDC(_In_ HDC hdc)
Definition: dc.c:97
static void test_device_caps(HDC hdc, HDC ref_dc, const char *descr, int scale)
Definition: dc.c:310
#define SRCCOPY
Definition: wingdi.h:332
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_pscript_printer_dc()

static void test_pscript_printer_dc ( void  )
static

Definition at line 1433 of file dc.c.

1434 {
1435  HDC hdc;
1436  char buf[256];
1437  DWORD query, ret;
1438 
1439  hdc = create_printer_dc(100, FALSE);
1440 
1441  if (!hdc) return;
1442 
1443  if (!is_postscript_printer(hdc))
1444  {
1445  skip("Default printer is not a PostScript device\n");
1446  DeleteDC( hdc );
1447  return;
1448  }
1449 
1450  query = GETFACENAME;
1451  ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL);
1452  ok(!ret, "GETFACENAME is supported\n");
1453 
1454  query = DOWNLOADFACE;
1455  ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL);
1456  ok(ret == 1, "DOWNLOADFACE is not supported\n");
1457 
1458  query = OPENCHANNEL;
1459  ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL);
1460  ok(ret == 1, "OPENCHANNEL is not supported\n");
1461 
1463  ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL);
1464  ok(ret == 1, "DOWNLOADHEADER is not supported\n");
1465 
1466  query = CLOSECHANNEL;
1467  ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL);
1468  ok(ret == 1, "CLOSECHANNEL is not supported\n");
1469 
1471  ret = Escape(hdc, QUERYESCSUPPORT, sizeof(query), (LPCSTR)&query, NULL);
1472  ok(ret == 1, "POSTSCRIPT_PASSTHROUGH is not supported\n");
1473 
1474  ret = ExtEscape(hdc, GETFACENAME, 0, NULL, sizeof(buf), buf);
1475  ok(ret == 1, "GETFACENAME failed\n");
1476  trace("face name: %s\n", buf);
1477 
1479 
1480  DeleteDC(hdc);
1481 }
STRING Escape(const STRING &str)
Definition: fontsub.cpp:1030
#define DOWNLOADHEADER
Definition: wingdi.h:1066
#define GETFACENAME
Definition: wingdi.h:1039
static BOOL is_postscript_printer(HDC hdc)
Definition: dc.c:1234
static HDC
Definition: imagelist.c:92
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CLOSECHANNEL
Definition: wingdi.h:1067
#define FALSE
Definition: types.h:117
BOOL WINAPI DeleteDC(HDC hdc)
Definition: dc.c:282
const char * LPCSTR
Definition: xmlstorage.h:183
#define POSTSCRIPT_PASSTHROUGH
Definition: wingdi.h:1068
static HDC create_printer_dc(int scale, BOOL reset)
Definition: dc.c:1244
#define trace
Definition: atltest.h:70
static void print_something(HDC hdc)
Definition: dc.c:1370
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DOWNLOADFACE
Definition: wingdi.h:1040
#define OPENCHANNEL
Definition: wingdi.h:1065
int ret
HDC hdc
Definition: main.c:9
#define QUERYESCSUPPORT
Definition: wingdi.h:1000
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
GLenum query
Definition: glext.h:7781
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)

Referenced by START_TEST().

◆ test_savedc()

static void test_savedc ( void  )
static

Definition at line 178 of file dc.c.

179 {
180  HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
181  int ret;
182 
183  ok(hdc != NULL, "CreateDC rets %p\n", hdc);
184 
185  ret = SaveDC(hdc);
186  ok(ret == 1, "ret = %d\n", ret);
187  ret = SaveDC(hdc);
188  ok(ret == 2, "ret = %d\n", ret);
189  ret = SaveDC(hdc);
190  ok(ret == 3, "ret = %d\n", ret);
191  ret = RestoreDC(hdc, -1);
192  ok(ret, "ret = %d\n", ret);
193  ret = SaveDC(hdc);
194  ok(ret == 3, "ret = %d\n", ret);
195  ret = RestoreDC(hdc, 1);
196  ok(ret, "ret = %d\n", ret);
197  ret = SaveDC(hdc);
198  ok(ret == 1, "ret = %d\n", ret);
199  ret = SaveDC(hdc);
200  ok(ret == 2, "ret = %d\n", ret);
201  ret = SaveDC(hdc);
202  ok(ret == 3, "ret = %d\n", ret);
203  ret = RestoreDC(hdc, -2);
204  ok(ret, "ret = %d\n", ret);
205  ret = SaveDC(hdc);
206  ok(ret == 2, "ret = %d\n", ret);
207  ret = RestoreDC(hdc, -2);
208  ok(ret, "ret = %d\n", ret);
209  ret = SaveDC(hdc);
210  ok(ret == 1, "ret = %d\n", ret);
211  ret = SaveDC(hdc);
212  ok(ret == 2, "ret = %d\n", ret);
213  ret = RestoreDC(hdc, -4);
214  ok(!ret, "ret = %d\n", ret);
215  ret = RestoreDC(hdc, 3);
216  ok(!ret, "ret = %d\n", ret);
217 
218  /* Under Win9x the following RestoreDC call succeeds and clears the save stack. */
219  ret = RestoreDC(hdc, -3);
220  ok(!ret ||
221  broken(ret), /* Win9x */
222  "ret = %d\n", ret);
223 
224  /* Trying to clear an empty save stack fails. */
225  ret = RestoreDC(hdc, -3);
226  ok(!ret, "ret = %d\n", ret);
227 
228  ret = SaveDC(hdc);
229  ok(ret == 3 ||
230  broken(ret == 1), /* Win9x */
231  "ret = %d\n", ret);
232 
233  /* Under Win9x the following RestoreDC call succeeds and clears the save stack. */
234  ret = RestoreDC(hdc, 0);
235  ok(!ret ||
236  broken(ret), /* Win9x */
237  "ret = %d\n", ret);
238 
239  /* Trying to clear an empty save stack fails. */
240  ret = RestoreDC(hdc, 0);
241  ok(!ret, "ret = %d\n", ret);
242 
243  ret = RestoreDC(hdc, 1);
244  ok(ret ||
245  broken(!ret), /* Win9x */
246  "ret = %d\n", ret);
247 
248  DeleteDC(hdc);
249 }
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteDC(HDC hdc)
Definition: dc.c:282
INT WINAPI SaveDC(IN HDC hdc)
Definition: dc.c:316
int ret
HDC hdc
Definition: main.c:9
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
HDC WINAPI CreateDCA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, CONST DEVMODEA *lpdvmInit)
Definition: dc.c:122
#define NULL
Definition: types.h:112
BOOL WINAPI RestoreDC(IN HDC hdc, IN INT iLevel)
Definition: dc.c:328

Referenced by START_TEST().

◆ test_savedc_2()

static void test_savedc_2 ( void  )
static

Definition at line 110 of file dc.c.

111 {
112  HWND hwnd;
113  HDC hdc;
114  HRGN hrgn;
115  RECT rc, rc_clip;
116  int ret;
117 
118  hwnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,
119  0, 0, 0, NULL);
120  assert(hwnd != 0);
123 
124  hrgn = CreateRectRgn(0, 0, 0, 0);
125  assert(hrgn != 0);
126 
127  hdc = GetDC(hwnd);
128  ok(hdc != NULL, "GetDC failed\n");
129 
130  ret = GetClipBox(hdc, &rc_clip);
131  ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "GetClipBox returned %d instead of SIMPLEREGION\n", ret);
132  ret = GetClipRgn(hdc, hrgn);
133  ok(ret == 0, "GetClipRgn returned %d instead of 0\n", ret);
134  ret = GetRgnBox(hrgn, &rc);
135  ok(ret == NULLREGION, "GetRgnBox returned %d %s instead of NULLREGION\n",
136  ret, wine_dbgstr_rect(&rc));
137  /*dump_region(hrgn);*/
138  SetRect(&rc, 0, 0, 100, 100);
139  ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
140  wine_dbgstr_rect(&rc_clip));
141 
142  ret = SaveDC(hdc);
143  ok(ret == 1, "ret = %d\n", ret);
144 
145  ret = IntersectClipRect(hdc, 0, 0, 50, 50);
146  if (ret == COMPLEXREGION)
147  {
148  /* XP returns COMPLEXREGION although dump_region reports only 1 rect */
149  trace("Windows BUG: IntersectClipRect returned %d instead of SIMPLEREGION\n", ret);
150  /* let's make sure that it's a simple region */
151  ret = GetClipRgn(hdc, hrgn);
152  ok(ret == 1, "GetClipRgn returned %d instead of 1\n", ret);
153  dump_region(hrgn);
154  }
155  else
156  ok(ret == SIMPLEREGION, "IntersectClipRect returned %d instead of SIMPLEREGION\n", ret);
157 
158  ret = GetClipBox(hdc, &rc_clip);
159  ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "GetClipBox returned %d instead of SIMPLEREGION\n", ret);
160  SetRect(&rc, 0, 0, 50, 50);
161  ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
162  wine_dbgstr_rect(&rc_clip));
163 
164  ret = RestoreDC(hdc, 1);
165  ok(ret, "ret = %d\n", ret);
166 
167  ret = GetClipBox(hdc, &rc_clip);
168  ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "GetClipBox returned %d instead of SIMPLEREGION\n", ret);
169  SetRect(&rc, 0, 0, 100, 100);
170  ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
171  wine_dbgstr_rect(&rc_clip));
172 
174  ReleaseDC(hwnd, hdc);
176 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
BOOL WINAPI UpdateWindow(_In_ HWND)
#define COMPLEXREGION
Definition: wingdi.h:362
#define NULLREGION
Definition: wingdi.h:360
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define assert(x)
Definition: debug.h:53
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
int WINAPI GetClipBox(HDC hdc, LPRECT lprc)
Definition: dc.c:829
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI ReleaseDC(HWND hWnd, HDC hDC)
Definition: dc.c:39
BOOL WINAPI DestroyWindow(_In_ HWND)
static void dump_region(HRGN hrgn)
Definition: dc.c:41
INT WINAPI SaveDC(IN HDC hdc)
Definition: dc.c:316
#define SW_SHOW
Definition: winuser.h:769
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define trace
Definition: atltest.h:70
const char * wine_dbgstr_rect(const RECT *rect)
int ret
HDC hdc
Definition: main.c:9
static HRGN hrgn
Definition: win.c:55
#define broken(x)
Definition: _sntprintf.h:21
int WINAPI GetRgnBox(_In_ HRGN, _Out_ LPRECT)
#define SIMPLEREGION
Definition: wingdi.h:361
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
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)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
BOOL WINAPI RestoreDC(IN HDC hdc, IN INT iLevel)
Definition: dc.c:328

Referenced by START_TEST().

Variable Documentation

◆ layout

DWORD layout

Definition at line 39 of file dc.c.

Referenced by EMFDRV_SetLayout().