ReactOS  0.4.14-dev-323-g6fe6a88
FrameRgn.c File Reference
#include "precomp.h"
#include "init.h"
Include dependency graph for FrameRgn.c:

Go to the source code of this file.

Macros

#define CheckBitmapBits(hdc, cx, cy, pj, pcr)   CheckBitmapBitsWithLine(__LINE__, hdc,cx,cy,pj,pcr)
 

Functions

static void CheckBitmapBitsWithLine (ULONG Line, HDC hdc, UINT cx, UINT cy, PUCHAR pjBits, COLORREF *pcrColors)
 
void Test_FrameRgn ()
 
 START_TEST (FrameRgn)
 

Macro Definition Documentation

◆ CheckBitmapBits

#define CheckBitmapBits (   hdc,
  cx,
  cy,
  pj,
  pcr 
)    CheckBitmapBitsWithLine(__LINE__, hdc,cx,cy,pj,pcr)

Definition at line 98 of file FrameRgn.c.

Function Documentation

◆ CheckBitmapBitsWithLine()

static void CheckBitmapBitsWithLine ( ULONG  Line,
HDC  hdc,
UINT  cx,
UINT  cy,
PUCHAR  pjBits,
COLORREF pcrColors 
)
static

Definition at line 76 of file FrameRgn.c.

83 {
84  UINT x, y, i;
85 
86  for (y = 0; y < cy; y++)
87  {
88  for (x = 0; x < cy; x++)
89  {
90  i = y * cx + x;
91  ok(GetPixel(hdc, x, y) == pcrColors[pjBits[i]],
92  "Wrong pixel at (%u,%u): expected 0x%08lx, got 0x%08lx\n",
93  x, y, pcrColors[pjBits[i]], GetPixel(hdc, x, y));
94  }
95  }
96 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
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
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
HDC hdc
Definition: main.c:9
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int * cx
Definition: commctrl.h:581

◆ START_TEST()

START_TEST ( FrameRgn  )

Definition at line 140 of file FrameRgn.c.

141 {
142  InitStuff();
143  Test_FrameRgn();
144 }
void Test_FrameRgn()
Definition: FrameRgn.c:101
BOOL InitStuff(void)
Definition: init.c:95

◆ Test_FrameRgn()

void Test_FrameRgn ( )

Definition at line 101 of file FrameRgn.c.

102 {
103  RECT rc = {0, 0, 8, 8 };
104  HRGN hrgn1, hrgn2;
105  BOOL bRet;
106  UCHAR ajBits[64] = {
107  0, 0, 0, 0, 0, 0, 0, 0, // 0000000
108  0, 1, 1, 1, 1, 0, 0, 0, // 0****00
109  0, 1, 2, 2, 1, 0, 0, 0, // 0*xx**0
110  0, 1, 2, 2, 1, 1, 1, 0, // 0*xxx*0
111  0, 1, 1, 1, 2, 2, 1, 0, // 0**xx*0
112  0, 0, 0, 1, 2, 2, 1, 0, // 00****0
113  0, 0, 0, 1, 1, 1, 1, 0, // 0000000
114  0, 0, 0, 0, 0, 0, 0, 0 // 0000000
115  };
116  COLORREF acrColors[16] = {RGB(0,0,0), RGB(255,255,255), RGB(128,128,128), 0};
117 
119 
120  hrgn1 = CreateRectRgn(1, 1, 5, 5);
121  ok(hrgn1 != NULL, "failed to create region\n");
122 
123  hrgn2 = CreateRectRgn(3, 3, 7, 7);
124  ok(hrgn1 != NULL, "failed to create region\n");
125 
126  CombineRgn(hrgn1, hrgn1, hrgn2, RGN_OR);
127 
128  bRet = FillRgn(ghdcDIB32, hrgn1, GetStockObject(GRAY_BRUSH));
129  ok(bRet != 0, "FrameRgn failed\n");
130 
131  bRet = FrameRgn(ghdcDIB32, hrgn1, GetStockObject(WHITE_BRUSH), 1, 1);
132  ok(bRet != 0, "FrameRgn failed\n");
133 
134  CheckBitmapBits(ghdcDIB32, 8, 8, ajBits, acrColors);
135 
136 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
int WINAPI FillRgn(_In_ HDC, _In_ HRGN, _In_ HBRUSH)
Definition: painting.c:183
static HRGN hrgn2
#define WHITE_BRUSH
Definition: wingdi.h:901
#define CheckBitmapBits(hdc, cx, cy, pj, pcr)
Definition: FrameRgn.c:98
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define RGN_OR
Definition: wingdi.h:358
#define GRAY_BRUSH
Definition: wingdi.h:897
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define BLACK_BRUSH
Definition: wingdi.h:895
DWORD COLORREF
Definition: windef.h:285
#define RGB(r, g, b)
Definition: wingdi.h:2935
unsigned char UCHAR
Definition: xmlstorage.h:181
#define ok(value,...)
Definition: atltest.h:57
HDC ghdcDIB32
Definition: init.c:8
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI FrameRgn(_In_ HDC, _In_ HRGN, _In_ HBRUSH, _In_ int, _In_ int)

Referenced by START_TEST().