ReactOS 0.4.15-dev-7846-g8ba6c66
NtGdiSetDIBitsToDeviceInternal.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for NtGdiSetDIBitsToDeviceInternal
5 * PROGRAMMERS:
6 */
7
8#include "../win32nt.h"
9
10void
12{
13 int x,y;
14
15 for (y = 0; y < 8; y++)
16 {
17 DWORD Row = 0;
18 for (x = 0; x < 8; x++)
19 Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
20 OutBits[y] = Row;
21 }
22}
23
24
26{
27 static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 };
28 DWORD OutBits[8];
29 XFORM xform;
30
32 100, 100, 200, 200,
33 NULL, NULL, NULL, NULL);
34 /* This DC has an nonzero origin */
35 HDC hDC = GetDC(hWnd);
36 struct
37 {
38 BITMAPINFOHEADER bmiHeader;
39 RGBQUAD bmiColors[2];
40 } bmi;
41 int x, y;
42
43 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
44 bmi.bmiHeader.biWidth = 8;
45 bmi.bmiHeader.biHeight = -8;
46 bmi.bmiHeader.biPlanes = 1;
47 bmi.bmiHeader.biBitCount = 1;
48 bmi.bmiHeader.biCompression = 0;
49 bmi.bmiHeader.biSizeImage = 0;
50 bmi.bmiHeader.biXPelsPerMeter = 0;
51 bmi.bmiHeader.biYPelsPerMeter = 0;
52 bmi.bmiHeader.biClrUsed = 0;
53 bmi.bmiHeader.biClrImportant = 0;
54 *(DWORD *)&bmi.bmiColors[0] = 0x000000;
55 *(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF;
56
57 /* The destination coordinates are relative to the DC origin */
58 TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
59 (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
60 sizeof(InBits), sizeof(bmi), TRUE, NULL));
61
62 /* Now get the data from the screen, and see if it matches */
63 ReadBits(hDC, OutBits);
64
65 TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
66
67 /* Change transformation */
68 GetWorldTransform(hDC, &xform);
69 xform.eM11 = 2;
70 xform.eM22 = 2;
71 xform.eDx = 10;
72 SetWorldTransform(hDC, &xform);
73
74 TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
75 (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
76 sizeof(InBits), sizeof(bmi), TRUE, NULL));
77
78 xform.eM11 = 1;
79 xform.eM22 = 1;
80 xform.eDx = 0;
81 SetWorldTransform(hDC, &xform);
82
83 /* Now get the data from the screen, and see if it matches */
84 for (y = 0; y < 8; y++)
85 {
86 DWORD Row = 0;
87 for (x = 0; x < 8; x++)
88 Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
89 OutBits[y] = Row;
90 }
91
92 TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
93
94
97
98}
static HDC hDC
Definition: 3dtext.c:33
void ReadBits(HDC hDC, PDWORD OutBits)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define START_TEST(x)
Definition: atltest.h:75
HWND hWnd
Definition: settings.c:17
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
ULONG RGBQUAD
Definition: precomp.h:59
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define TEST(x)
Definition: precomp.h:20
static HDC
Definition: imagelist.c:92
__kernel_entry W32KAPI INT APIENTRY NtGdiSetDIBitsToDeviceInternal(_In_ HDC hdcDest, _In_ INT xDst, _In_ INT yDst, _In_ DWORD cx, _In_ DWORD cy, _In_ INT xSrc, _In_ INT ySrc, _In_ DWORD iStartScan, _In_ DWORD cNumScan, _In_reads_bytes_(cjMaxBits) LPBYTE pInitBits, _In_reads_bytes_(cjMaxInfo) LPBITMAPINFO pbmi, _In_ DWORD iUsage, _In_ UINT cjMaxBits, _In_ UINT cjMaxInfo, _In_ BOOL bTransformCoordinates, _In_opt_ HANDLE hcmXform)
#define L(x)
Definition: ntvdm.h:50
DWORD * PDWORD
Definition: pedump.c:68
#define WS_VISIBLE
Definition: pedump.c:620
FLOAT eM11
Definition: wingdi.h:1721
FLOAT eM22
Definition: wingdi.h:1724
FLOAT eDx
Definition: wingdi.h:1725
#define DIB_RGB_COLORS
Definition: wingdi.h:367
BOOL WINAPI GetWorldTransform(_In_ HDC, _Out_ LPXFORM)
Definition: coord.c:278
BOOL WINAPI SetWorldTransform(_In_ HDC, _In_ const XFORM *)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4316
BOOL WINAPI DestroyWindow(_In_ HWND)