ReactOS  0.4.14-dev-606-g14ebc0b
graphics.c File Reference
#include <math.h>
#include "objbase.h"
#include "gdiplus.h"
#include "wine/test.h"
Include dependency graph for graphics.c:

Go to the source code of this file.

Classes

struct  node
 

Macros

#define expect(expected, got)   ok((got) == (expected), "Expected %d, got %d\n", (INT)(expected), (INT)(got))
 
#define expectf_(expected, got, precision)   ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got))
 
#define expectf(expected, got)   expectf_((expected), (got), 0.001)
 
#define BLUE_COLOR   (0xff0000ff)
 
#define is_blue_color(color)   ( ((color) & 0x00ffffff) == 0xff )
 
#define get_bitmap_pixel(x, y)   pixel[(y)*(width) + (x)]
 

Typedefs

typedef struct node node
 

Functions

static GpStatus (WINAPI *pGdipGraphicsSetAbort)(GpGraphics *
 
static void set_rect_empty (RectF *rc)
 
static REAL units_to_pixels (REAL units, GpUnit unit, REAL dpi)
 
static REAL pixels_to_units (REAL pixels, GpUnit unit, REAL dpi)
 
static REAL units_scale (GpUnit from, GpUnit to, REAL dpi)
 
static GpGraphicscreate_graphics (REAL res_x, REAL res_y, GpUnit unit, REAL scale, GpImage **image)
 
static void test_constructor_destructor (void)
 
static void log_state (GraphicsState data, node **log)
 
static void check_no_duplicates (node *log)
 
static void test_save_restore (void)
 
static void test_GdipFillClosedCurve2 (void)
 
static void test_GdipFillClosedCurve2I (void)
 
static void test_GdipDrawArc (void)
 
static void test_GdipDrawArcI (void)
 
static void test_BeginContainer2 (void)
 
static void test_GdipDrawBezierI (void)
 
static void test_GdipDrawCurve3 (void)
 
static void test_GdipDrawCurve3I (void)
 
static void test_GdipDrawCurve2 (void)
 
static void test_GdipDrawCurve2I (void)
 
static void test_GdipDrawCurve (void)
 
static void test_GdipDrawCurveI (void)
 
static void test_GdipDrawLineI (void)
 
static void test_GdipDrawImagePointsRect (void)
 
static void test_GdipDrawLinesI (void)
 
static void test_GdipFillClosedCurve (void)
 
static void test_GdipFillClosedCurveI (void)
 
static void test_GdipFillPath (void)
 
static void test_Get_Release_DC (void)
 
static void test_transformpoints (void)
 
static void test_get_set_clip (void)
 
static void test_clip_xform (void)
 
static void test_isempty (void)
 
static void test_clear (void)
 
static void test_textcontrast (void)
 
static void test_GdipDrawString (void)
 
static void test_GdipGetVisibleClipBounds_screen (void)
 
static void test_GdipGetVisibleClipBounds_window (void)
 
static void test_GdipGetVisibleClipBounds (void)
 
static void test_fromMemoryBitmap (void)
 
static void test_GdipIsVisiblePoint (void)
 
static void test_GdipIsVisibleRect (void)
 
static void test_GdipGetNearestColor (void)
 
static void test_string_functions (void)
 
static void test_get_set_interpolation (void)
 
static void test_get_set_textrenderinghint (void)
 
static void test_getdc_scaled (void)
 
static void test_GdipMeasureString (void)
 
static void test_transform (void)
 
static void test_pen_thickness (void)
 
static void test_font_height_scaling (void)
 
static void test_measure_string (void)
 
static void test_measured_extra_space (void)
 
static void test_alpha_hdc (void)
 
static void test_bitmapfromgraphics (void)
 
static void test_clipping (void)
 
static void test_clipping_2 (void)
 
static void test_GdipFillRectangles (void)
 
static void test_GdipGetVisibleClipBounds_memoryDC (void)
 
static void test_container_rects (void)
 
static void test_GdipGraphicsSetAbort (void)
 
static DWORDGetBitmapPixelBuffer (HDC hdc, HBITMAP hbmp, int width, int height)
 
static void test_GdipFillRectanglesOnMemoryDCSolidBrush (void)
 
static void test_GdipFillRectanglesOnMemoryDCTextureBrush (void)
 
static void test_GdipFillRectanglesOnBitmapTextureBrush (void)
 
static void test_GdipDrawImagePointsRectOnMemoryDC (void)
 
static void test_cliphrgn_transform (void)
 
static void test_hdc_caching (void)
 
 START_TEST (graphics)
 

Variables

static GdiplusAbort *static const REAL mm_per_inch = 25.4
 
static const REAL point_per_inch = 72.0
 
static HWND hwnd
 

Macro Definition Documentation

◆ BLUE_COLOR

#define BLUE_COLOR   (0xff0000ff)

Definition at line 6349 of file graphics.c.

◆ expect

#define expect (   expected,
  got 
)    ok((got) == (expected), "Expected %d, got %d\n", (INT)(expected), (INT)(got))

Definition at line 28 of file graphics.c.

◆ expectf

#define expectf (   expected,
  got 
)    expectf_((expected), (got), 0.001)

Definition at line 30 of file graphics.c.

◆ expectf_

#define expectf_ (   expected,
  got,
  precision 
)    ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got))

Definition at line 29 of file graphics.c.

◆ get_bitmap_pixel

#define get_bitmap_pixel (   x,
  y 
)    pixel[(y)*(width) + (x)]

Definition at line 6351 of file graphics.c.

◆ is_blue_color

#define is_blue_color (   color)    ( ((color) & 0x00ffffff) == 0xff )

Definition at line 6350 of file graphics.c.

Typedef Documentation

◆ node

typedef struct node node

Function Documentation

◆ check_no_duplicates()

static void check_no_duplicates ( node log)
static

Definition at line 186 of file graphics.c.

187 {
188  INT dups = 0;
189  node * temp = NULL;
190  node * temp2 = NULL;
191  node * orig = log;
192 
193  if(!log)
194  goto end;
195 
196  do{
197  temp = log;
198  while((temp = temp->next)){
199  if(log->data == temp->data){
200  dups++;
201  break;
202  }
203  if(dups > 0)
204  break;
205  }
206  }while((log = log->next));
207 
208  temp = orig;
209  do{
210  temp2 = temp->next;
212  temp = temp2;
213  }while(temp);
214 
215 end:
216  expect(0, dups);
217 }
GLuint GLuint end
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
#define expect(expected, got)
Definition: graphics.c:28
static calc_node_t temp
Definition: rpn_ieee.c:38
struct define * next
Definition: compiler.c:65
#define HeapFree(x, y, z)
Definition: compat.h:402
#define log(outFile, fmt,...)
Definition: util.h:15
Definition: dlist.c:348

Referenced by test_save_restore().

◆ create_graphics()

static GpGraphics* create_graphics ( REAL  res_x,
REAL  res_y,
GpUnit  unit,
REAL  scale,
GpImage **  image 
)
static

Definition at line 96 of file graphics.c.

97 {
99  union
100  {
101  GpBitmap *bitmap;
102  GpImage *image;
103  } u;
104  GpGraphics *graphics = NULL;
105  REAL res;
106 
108  expect(Ok, status);
109 
110  status = GdipBitmapSetResolution(u.bitmap, res_x, res_y);
111  expect(Ok, status);
113  expect(Ok, status);
114  expectf(res_x, res);
116  expect(Ok, status);
117  expectf(res_y, res);
118 
119  status = GdipGetImageGraphicsContext(u.image, &graphics);
120  expect(Ok, status);
121 
122  *image = u.image;
123 
124  status = GdipGetDpiX(graphics, &res);
125  expect(Ok, status);
126  expectf(res_x, res);
127  status = GdipGetDpiY(graphics, &res);
128  expect(Ok, status);
129  expectf(res_y, res);
130 
131  status = GdipSetPageUnit(graphics, unit);
132  expect(Ok, status);
133  status = GdipSetPageScale(graphics, scale);
134  expect(Ok, status);
135 
136  return graphics;
137 }
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 * u
Definition: glfuncs.h:240
GpStatus WINGDIPAPI GdipGetDpiY(GpGraphics *graphics, REAL *dpi)
Definition: graphics.c:6635
GLeglImageOES image
Definition: gl.h:2204
#define expectf(expected, got)
Definition: graphics.c:30
GpStatus WINGDIPAPI GdipGetDpiX(GpGraphics *graphics, REAL *dpi)
Definition: graphics.c:6621
GpStatus WINGDIPAPI GdipGetImageVerticalResolution(GpImage *image, REAL *res)
Definition: image.c:2330
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
GpStatus WINGDIPAPI GdipGetImageHorizontalResolution(GpImage *image, REAL *res)
Definition: image.c:2261
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2201
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
Definition: graphics.c:6202
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
#define expect(expected, got)
Definition: graphics.c:28
Status
Definition: gdiplustypes.h:24
#define PixelFormat24bppRGB
GpStatus WINGDIPAPI GdipBitmapSetResolution(GpBitmap *bitmap, REAL xdpi, REAL ydpi)
Definition: image.c:1163
GLuint res
Definition: glext.h:9613
static HBITMAP bitmap
Definition: clipboard.c:1344
GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale)
Definition: graphics.c:6178
float REAL
Definition: types.h:41
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by test_GdipMeasureString(), and test_transform().

◆ GetBitmapPixelBuffer()

static DWORD* GetBitmapPixelBuffer ( HDC  hdc,
HBITMAP  hbmp,
int  width,
int  height 
)
static

Definition at line 6352 of file graphics.c.

6353 {
6354  BITMAPINFOHEADER bi;
6355  UINT lines = 0;
6357 
6358  bi.biSize = sizeof(BITMAPINFOHEADER);
6359  bi.biWidth = width;
6360  bi.biHeight = -height; /*very Important, set negative, indicating a top-down DIB*/
6361  bi.biPlanes = 1;
6362  bi.biBitCount = 32;
6363  bi.biCompression = BI_RGB;
6364  bi.biSizeImage = 0;
6365  bi.biXPelsPerMeter = 0;
6366  bi.biYPelsPerMeter = 0;
6367  bi.biClrUsed = 0;
6368  bi.biClrImportant = 0;
6369 
6371  ok(lines == height, "Expected GetDIBits:%p,%d->%d,%d\n", buffer, height, lines, GetLastError());
6372 
6373  return buffer;
6374 }
GLint GLint GLsizei width
Definition: gl.h:1546
DWORD biClrImportant
Definition: amvideo.idl:40
LONG biXPelsPerMeter
Definition: amvideo.idl:37
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
LONG biYPelsPerMeter
Definition: amvideo.idl:38
DWORD biCompression
Definition: amvideo.idl:35
HBITMAP hbmp
eMaj lines
Definition: tritemp.h:206
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
HDC hdc
Definition: main.c:9
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
void *WINGDIPAPI GdipAlloc(SIZE_T size)
Definition: gdiplus.c:142
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define BI_RGB
Definition: precomp.h:34

Referenced by test_GdipDrawImagePointsRectOnMemoryDC(), test_GdipFillRectanglesOnMemoryDCSolidBrush(), and test_GdipFillRectanglesOnMemoryDCTextureBrush().

◆ GpStatus()

static GpStatus ( WINAPI pGdipGraphicsSetAbort)
static

◆ log_state()

static void log_state ( GraphicsState  data,
node **  log 
)
static

Definition at line 176 of file graphics.c.

177 {
178  node * new_entry = HeapAlloc(GetProcessHeap(), 0, sizeof(node));
179 
180  new_entry->data = data;
181  new_entry->next = *log;
182  *log = new_entry;
183 }
void * next
Definition: dlist.c:360
GLvoid * data
Definition: dlist.c:359
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define log(outFile, fmt,...)
Definition: util.h:15
Definition: dlist.c:348

Referenced by test_save_restore().

◆ pixels_to_units()

static REAL pixels_to_units ( REAL  pixels,
GpUnit  unit,
REAL  dpi 
)
static

Definition at line 69 of file graphics.c.

70 {
71  switch (unit)
72  {
73  case UnitPixel:
74  case UnitDisplay:
75  return pixels;
76  case UnitPoint:
77  return pixels * point_per_inch / dpi;
78  case UnitInch:
79  return pixels / dpi;
80  case UnitDocument:
81  return pixels * 300.0 / dpi;
82  case UnitMillimeter:
83  return pixels * mm_per_inch / dpi;
84  default:
85  ok(0, "Unsupported unit: %d\n", unit);
86  return 0;
87  }
88 }
static const REAL point_per_inch
Definition: graphics.c:35
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define dpi
Definition: sysparams.c:22
static GdiplusAbort *static const REAL mm_per_inch
Definition: graphics.c:34
#define ok(value,...)
Definition: atltest.h:57
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546

Referenced by test_font_height_scaling(), test_GdipMeasureString(), and units_scale().

◆ set_rect_empty()

static void set_rect_empty ( RectF rc)
static

Definition at line 38 of file graphics.c.

39 {
40  rc->X = 0.0;
41  rc->Y = 0.0;
42  rc->Width = 0.0;
43  rc->Height = 0.0;
44 }
REAL Height
Definition: gdiplustypes.h:264
REAL X
Definition: gdiplustypes.h:261
REAL Width
Definition: gdiplustypes.h:263
REAL Y
Definition: gdiplustypes.h:262

Referenced by test_font_height_scaling(), test_GdipMeasureString(), test_measure_string(), test_measured_extra_space(), and test_string_functions().

◆ START_TEST()

START_TEST ( graphics  )

Definition at line 6795 of file graphics.c.

6796 {
6797  struct GdiplusStartupInput gdiplusStartupInput;
6799  WNDCLASSA class;
6800  HMODULE gdiplus_mod = GetModuleHandleA("gdiplus.dll");
6801  HMODULE hmsvcrt;
6802  int (CDECL * _controlfp_s)(unsigned int *cur, unsigned int newval, unsigned int mask);
6803 
6804  /* Enable all FP exceptions except _EM_INEXACT, which gdi32 can trigger */
6805  hmsvcrt = LoadLibraryA("msvcrt");
6806  _controlfp_s = (void*)GetProcAddress(hmsvcrt, "_controlfp_s");
6807  if (_controlfp_s) _controlfp_s(0, 0, 0x0008001e);
6808 
6809  pGdipGraphicsSetAbort = (void*)GetProcAddress(gdiplus_mod, "GdipGraphicsSetAbort");
6810 
6811  memset( &class, 0, sizeof(class) );
6812  class.lpszClassName = "gdiplus_test";
6813  class.style = CS_HREDRAW | CS_VREDRAW;
6814  class.lpfnWndProc = DefWindowProcA;
6815  class.hInstance = GetModuleHandleA(0);
6816  class.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
6817  class.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
6818  class.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
6819  RegisterClassA( &class );
6820  hwnd = CreateWindowA( "gdiplus_test", "graphics test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
6821  CW_USEDEFAULT, CW_USEDEFAULT, 200, 200, 0, 0, GetModuleHandleA(0), 0 );
6822  ok(hwnd != NULL, "Expected window to be created\n");
6823 
6824  gdiplusStartupInput.GdiplusVersion = 1;
6825  gdiplusStartupInput.DebugEventCallback = NULL;
6826  gdiplusStartupInput.SuppressBackgroundThread = 0;
6827  gdiplusStartupInput.SuppressExternalCodecs = 0;
6828 
6829  GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
6830 
6831  test_clipping();
6832  test_clipping_2();
6836  test_transform();
6844  test_GdipDrawArc();
6867  test_clip_xform();
6868  test_isempty();
6869  test_clear();
6876  test_alpha_hdc();
6887  test_hdc_caching();
6888 
6890  DestroyWindow( hwnd );
6891 }
static void test_GdipGetVisibleClipBounds(void)
Definition: graphics.c:2560
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void test_GdipDrawLineI(void)
Definition: graphics.c:1271
static void test_GdipGetVisibleClipBounds_memoryDC(void)
Definition: graphics.c:6094
static void test_get_set_textrenderinghint(void)
Definition: graphics.c:3626
static void test_string_functions(void)
Definition: graphics.c:3188
static void test_textcontrast(void)
Definition: graphics.c:2249
static void test_GdipGraphicsSetAbort(void)
Definition: graphics.c:6321
static void test_get_set_interpolation(void)
Definition: graphics.c:3557
static void test_clipping_2(void)
Definition: graphics.c:5645
static void test_GdipFillRectangles(void)
Definition: graphics.c:6049
#define CS_HREDRAW
Definition: winuser.h:648
static void test_Get_Release_DC(void)
Definition: graphics.c:1594
#define IDI_APPLICATION
Definition: winuser.h:699
BOOL WINAPI DestroyWindow(_In_ HWND)
static void test_GdipDrawBezierI(void)
Definition: graphics.c:817
static void test_transform(void)
Definition: graphics.c:3996
#define COLOR_WINDOW
Definition: winuser.h:908
static void test_alpha_hdc(void)
Definition: graphics.c:4941
HICON WINAPI LoadIconA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2029
static void test_GdipFillRectanglesOnMemoryDCSolidBrush(void)
Definition: graphics.c:6376
uint32_t ULONG_PTR
Definition: typedefs.h:63
static void test_getdc_scaled(void)
Definition: graphics.c:3674
GLenum GLint GLuint mask
Definition: glext.h:6028
static void test_GdipFillClosedCurve(void)
Definition: graphics.c:1415
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static void test_GdipFillPath(void)
Definition: graphics.c:1548
static void test_clip_xform(void)
Definition: graphics.c:2115
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
static void test_pen_thickness(void)
Definition: graphics.c:4054
#define CW_USEDEFAULT
Definition: winuser.h:225
static void test_GdipFillRectanglesOnBitmapTextureBrush(void)
Definition: graphics.c:6518
static void test_GdipDrawLinesI(void)
Definition: graphics.c:1363
smooth NULL
Definition: ftsmooth.c:416
static void test_BeginContainer2(void)
Definition: graphics.c:619
static void test_GdipDrawImagePointsRectOnMemoryDC(void)
Definition: graphics.c:6603
static void test_GdipDrawArc(void)
Definition: graphics.c:531
static void test_save_restore(void)
Definition: graphics.c:219
static void test_GdipFillRectanglesOnMemoryDCTextureBrush(void)
Definition: graphics.c:6433
const char * LPCSTR
Definition: xmlstorage.h:183
static void test_container_rects(void)
Definition: graphics.c:6149
static void test_clear(void)
Definition: graphics.c:2241
static void test_GdipDrawArcI(void)
Definition: graphics.c:575
static void test_constructor_destructor(void)
Definition: graphics.c:139
int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask)
Definition: cntrlfp.c:120
#define CS_VREDRAW
Definition: winuser.h:653
static void test_GdipDrawImagePointsRect(void)
Definition: graphics.c:1309
static void test_measured_extra_space(void)
Definition: graphics.c:4871
static void test_hdc_caching(void)
Definition: graphics.c:6726
static void test_fromMemoryBitmap(void)
Definition: graphics.c:2592
void WINAPI GdiplusShutdown(ULONG_PTR)
Status WINAPI GdiplusStartup(ULONG_PTR *token, const struct GdiplusStartupInput *input, struct GdiplusStartupOutput *output)
Definition: gdiplus.c:81
static void test_GdipIsVisiblePoint(void)
Definition: graphics.c:2683
static ULONG_PTR gdiplusToken
Definition: CImage.cpp:79
static void test_GdipGetNearestColor(void)
Definition: graphics.c:3024
static void test_cliphrgn_transform(void)
Definition: graphics.c:6681
static void test_GdipMeasureString(void)
Definition: graphics.c:3722
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void test_isempty(void)
Definition: graphics.c:2207
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
static void test_font_height_scaling(void)
Definition: graphics.c:4260
static void test_get_set_clip(void)
Definition: graphics.c:2035
#define CDECL
Definition: compat.h:21
#define ok(value,...)
Definition: atltest.h:57
static void test_GdipDrawCurve3(void)
Definition: graphics.c:855
static void test_GdipFillClosedCurve2I(void)
Definition: graphics.c:469
static void test_GdipDrawCurveI(void)
Definition: graphics.c:1210
static void test_GdipIsVisibleRect(void)
Definition: graphics.c:2862
#define IDC_ARROW
Definition: winuser.h:682
static void test_GdipDrawCurve2(void)
Definition: graphics.c:1015
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
static void test_GdipDrawString(void)
Definition: graphics.c:2272
static void test_measure_string(void)
Definition: graphics.c:4448
#define GetProcAddress(x, y)
Definition: compat.h:418
static void test_GdipFillClosedCurveI(void)
Definition: graphics.c:1486
static void test_transformpoints(void)
Definition: graphics.c:1906
static void test_GdipDrawCurve3I(void)
Definition: graphics.c:935
static void test_GdipDrawCurve2I(void)
Definition: graphics.c:1082
static void test_GdipFillClosedCurve2(void)
Definition: graphics.c:398
static void test_bitmapfromgraphics(void)
Definition: graphics.c:5014
static void test_GdipDrawCurve(void)
Definition: graphics.c:1149
#define WS_VISIBLE
Definition: pedump.c:620
#define memset(x, y, z)
Definition: compat.h:39
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
static void test_clipping(void)
Definition: graphics.c:5066
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ test_alpha_hdc()

static void test_alpha_hdc ( void  )
static

Definition at line 4941 of file graphics.c.

4942 {
4943  GpStatus status;
4944  HDC hdc, gp_hdc;
4945  HBITMAP hbm, old_hbm;
4946  GpGraphics *graphics;
4947  ULONG *bits;
4948  BITMAPINFO bmi;
4949  GpRectF bounds;
4950  COLORREF colorref;
4951 
4952  hdc = CreateCompatibleDC(0);
4953  ok(hdc != NULL, "CreateCompatibleDC failed\n");
4954  bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
4955  bmi.bmiHeader.biHeight = 5;
4956  bmi.bmiHeader.biWidth = 5;
4957  bmi.bmiHeader.biBitCount = 32;
4958  bmi.bmiHeader.biPlanes = 1;
4960  bmi.bmiHeader.biClrUsed = 0;
4961 
4962  hbm = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
4963  ok(hbm != NULL, "CreateDIBSection failed\n");
4964 
4965  old_hbm = SelectObject(hdc, hbm);
4966 
4967  status = GdipCreateFromHDC(hdc, &graphics);
4968  expect(Ok, status);
4969 
4970  status = GdipGetVisibleClipBounds(graphics, &bounds);
4971  expect(Ok, status);
4972  expectf(0.0, bounds.X);
4973  expectf(0.0, bounds.Y);
4974  expectf(5.0, bounds.Width);
4975  expectf(5.0, bounds.Height);
4976 
4977  bits[0] = 0xdeadbeef;
4978 
4979  status = GdipGraphicsClear(graphics, 0xffaaaaaa);
4980  expect(Ok, status);
4981 
4982  expect(0xffaaaaaa, bits[0]);
4983 
4984  bits[0] = 0xdeadbeef;
4985 
4986  status = GdipGetDC(graphics, &gp_hdc);
4987  expect(Ok, status);
4988 
4989  colorref = GetPixel(gp_hdc, 0, 4);
4990  expect(0xefbead, colorref);
4991 
4992  SetPixel(gp_hdc, 0, 4, 0xffffff);
4993 
4994  expect(0xffffff, bits[0]);
4995 
4996  status = GdipReleaseDC(graphics, gp_hdc);
4997  expect(Ok, status);
4998 
4999  SelectObject(hdc, old_hbm);
5000 
5001  bits[0] = 0xdeadbeef;
5002 
5003  status = GdipGraphicsClear(graphics, 0xffbbbbbb);
5004  expect(Ok, status);
5005 
5006  todo_wine expect(0xffbbbbbb, bits[0]);
5007 
5008  GdipDeleteGraphics(graphics);
5009 
5010  DeleteObject(hbm);
5011  DeleteDC(hdc);
5012 }
#define expectf(expected, got)
Definition: graphics.c:30
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect)
Definition: graphics.c:5004
GpStatus WINGDIPAPI GdipReleaseDC(GpGraphics *graphics, HDC hdc)
Definition: graphics.c:6758
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
REAL Height
Definition: gdiplustypes.h:264
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:93
REAL X
Definition: gdiplustypes.h:261
DWORD COLORREF
Definition: windef.h:300
GpStatus WINGDIPAPI GdipGetDC(GpGraphics *graphics, HDC *hdc)
Definition: graphics.c:6682
#define expect(expected, got)
Definition: graphics.c:28
#define todo_wine
Definition: test.h:163
HDC hdc
Definition: main.c:9
Status
Definition: gdiplustypes.h:24
REAL Width
Definition: gdiplustypes.h:263
BOOL WINAPI DeleteDC(_In_ HDC)
GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics *graphics, ARGB color)
Definition: graphics.c:5076
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define ok(value,...)
Definition: atltest.h:57
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
unsigned int ULONG
Definition: retypes.h:1
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:366
REAL Y
Definition: gdiplustypes.h:262
static SERVICE_STATUS status
Definition: service.c:31
#define BI_RGB
Definition: precomp.h:34
Definition: ps.c:97

Referenced by START_TEST().

◆ test_BeginContainer2()

static void test_BeginContainer2 ( void  )
static

Definition at line 619 of file graphics.c.

620 {
622  GpRectF clip;
623  REAL defClip[] = {5, 10, 15, 20};
624  REAL elems[6], defTrans[] = {1, 2, 3, 4, 5, 6};
625  GraphicsContainer cont1, cont2, cont3, cont4;
626  CompositingQuality compqual, defCompqual = CompositingQualityHighSpeed;
627  CompositingMode compmode, defCompmode = CompositingModeSourceOver;
629  REAL scale, defScale = 17;
630  GpUnit unit, defUnit = UnitPixel;
631  PixelOffsetMode offsetmode, defOffsetmode = PixelOffsetModeHighSpeed;
632  SmoothingMode smoothmode, defSmoothmode = SmoothingModeAntiAlias;
633  UINT contrast, defContrast = 5;
634  TextRenderingHint texthint, defTexthint = TextRenderingHintAntiAlias;
635 
637  GpGraphics *graphics = NULL;
638  HDC hdc = GetDC( hwnd );
639 
640  ok(hdc != NULL, "Expected HDC to be initialized\n");
641 
642  status = GdipCreateFromHDC(hdc, &graphics);
643  expect(Ok, status);
644  ok(graphics != NULL, "Expected graphics to be initialized\n");
645 
646  /* null graphics, null container */
647  status = GdipBeginContainer2(NULL, &cont1);
649 
650  status = GdipBeginContainer2(graphics, NULL);
652 
653  status = GdipEndContainer(NULL, cont1);
655 
656  /* test all quality-related values */
657  GdipSetCompositingMode(graphics, defCompmode);
658  GdipSetCompositingQuality(graphics, defCompqual);
659  GdipSetInterpolationMode(graphics, defInterp);
660  GdipSetPageScale(graphics, defScale);
661  GdipSetPageUnit(graphics, defUnit);
662  GdipSetPixelOffsetMode(graphics, defOffsetmode);
663  GdipSetSmoothingMode(graphics, defSmoothmode);
664  GdipSetTextContrast(graphics, defContrast);
665  GdipSetTextRenderingHint(graphics, defTexthint);
666 
667  status = GdipBeginContainer2(graphics, &cont1);
668  expect(Ok, status);
669 
673  GdipSetPageScale(graphics, 10);
674  GdipSetPageUnit(graphics, UnitDocument);
677  GdipSetTextContrast(graphics, 7);
679 
680  status = GdipEndContainer(graphics, cont1);
681  expect(Ok, status);
682 
683  GdipGetCompositingMode(graphics, &compmode);
684  ok(defCompmode == compmode, "Expected Compositing Mode to be restored to %d, got %d\n", defCompmode, compmode);
685 
686  GdipGetCompositingQuality(graphics, &compqual);
687  ok(defCompqual == compqual, "Expected Compositing Quality to be restored to %d, got %d\n", defCompqual, compqual);
688 
689  GdipGetInterpolationMode(graphics, &interp);
690  ok(defInterp == interp, "Expected Interpolation Mode to be restored to %d, got %d\n", defInterp, interp);
691 
692  GdipGetPageScale(graphics, &scale);
693  ok(fabs(defScale - scale) < 0.0001, "Expected Page Scale to be restored to %f, got %f\n", defScale, scale);
694 
695  GdipGetPageUnit(graphics, &unit);
696  ok(defUnit == unit, "Expected Page Unit to be restored to %d, got %d\n", defUnit, unit);
697 
698  GdipGetPixelOffsetMode(graphics, &offsetmode);
699  ok(defOffsetmode == offsetmode, "Expected Pixel Offset Mode to be restored to %d, got %d\n", defOffsetmode, offsetmode);
700 
701  GdipGetSmoothingMode(graphics, &smoothmode);
702  ok(defSmoothmode == smoothmode, "Expected Smoothing Mode to be restored to %d, got %d\n", defSmoothmode, smoothmode);
703 
704  GdipGetTextContrast(graphics, &contrast);
705  ok(defContrast == contrast, "Expected Text Contrast to be restored to %d, got %d\n", defContrast, contrast);
706 
707  status = GdipGetTextRenderingHint(graphics, &texthint);
708  expect(Ok, status);
709  ok(defTexthint == texthint, "Expected Text Hint to be restored to %d, got %d\n", defTexthint, texthint);
710 
711  /* test world transform */
712  status = GdipBeginContainer2(graphics, &cont1);
713  expect(Ok, status);
714 
715  status = GdipCreateMatrix2(defTrans[0], defTrans[1], defTrans[2], defTrans[3],
716  defTrans[4], defTrans[5], &transform);
717  expect(Ok, status);
718  GdipSetWorldTransform(graphics, transform);
720  transform = NULL;
721 
722  status = GdipBeginContainer2(graphics, &cont2);
723  expect(Ok, status);
724 
725  status = GdipCreateMatrix2(10, 20, 30, 40, 50, 60, &transform);
726  expect(Ok, status);
728  expect(Ok, status);
730  transform = NULL;
731 
732  status = GdipEndContainer(graphics, cont2);
733  expect(Ok, status);
734 
736  expect(Ok, status);
738  expect(Ok, status);
740  expect(Ok, status);
741  ok(fabs(defTrans[0] - elems[0]) < 0.0001 &&
742  fabs(defTrans[1] - elems[1]) < 0.0001 &&
743  fabs(defTrans[2] - elems[2]) < 0.0001 &&
744  fabs(defTrans[3] - elems[3]) < 0.0001 &&
745  fabs(defTrans[4] - elems[4]) < 0.0001 &&
746  fabs(defTrans[5] - elems[5]) < 0.0001,
747  "Expected World Transform Matrix to be restored to [%f, %f, %f, %f, %f, %f], got [%f, %f, %f, %f, %f, %f]\n",
748  defTrans[0], defTrans[1], defTrans[2], defTrans[3], defTrans[4], defTrans[5],
749  elems[0], elems[1], elems[2], elems[3], elems[4], elems[5]);
751  transform = NULL;
752 
753  status = GdipEndContainer(graphics, cont1);
754  expect(Ok, status);
755 
756  /* test clipping */
757  status = GdipBeginContainer2(graphics, &cont1);
758  expect(Ok, status);
759 
760  status = GdipSetClipRect(graphics, defClip[0], defClip[1], defClip[2], defClip[3], CombineModeReplace);
761  expect(Ok, status);
762 
763  status = GdipBeginContainer2(graphics, &cont2);
764  expect(Ok, status);
765 
766  status = GdipSetClipRect(graphics, 2, 4, 6, 8, CombineModeReplace);
767  expect(Ok, status);
768 
769  status = GdipEndContainer(graphics, cont2);
770  expect(Ok, status);
771 
772  status = GdipGetClipBounds(graphics, &clip);
773  expect(Ok, status);
774 
775  ok(fabs(defClip[0] - clip.X) < 0.0001 &&
776  fabs(defClip[1] - clip.Y) < 0.0001 &&
777  fabs(defClip[2] - clip.Width) < 0.0001 &&
778  fabs(defClip[3] - clip.Height) < 0.0001,
779  "Expected Clipping Rectangle to be restored to [%f, %f, %f, %f], got [%f, %f, %f, %f]\n",
780  defClip[0], defClip[1], defClip[2], defClip[3],
781  clip.X, clip.Y, clip.Width, clip.Height);
782 
783  status = GdipEndContainer(graphics, cont1);
784  expect(Ok, status);
785 
786  /* nesting */
787  status = GdipBeginContainer2(graphics, &cont1);
788  expect(Ok, status);
789 
790  status = GdipBeginContainer2(graphics, &cont2);
791  expect(Ok, status);
792 
793  status = GdipBeginContainer2(graphics, &cont3);
794  expect(Ok, status);
795 
796  status = GdipEndContainer(graphics, cont3);
797  expect(Ok, status);
798 
799  status = GdipBeginContainer2(graphics, &cont4);
800  expect(Ok, status);
801 
802  status = GdipEndContainer(graphics, cont4);
803  expect(Ok, status);
804 
805  /* skip cont2 */
806  status = GdipEndContainer(graphics, cont1);
807  expect(Ok, status);
808 
809  /* end an already-ended container */
810  status = GdipEndContainer(graphics, cont1);
811  expect(Ok, status);
812 
813  GdipDeleteGraphics(graphics);
814  ReleaseDC(hwnd, hdc);
815 }
GpStatus WINGDIPAPI GdipSetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode mode)
Definition: graphics.c:6229
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GpStatus WINGDIPAPI GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix)
Definition: graphics.c:6358
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy, GpMatrix **matrix)
Definition: matrix.c:61
Unit
Definition: gdiplusenums.h:25
GpStatus WINGDIPAPI GdipGetInterpolationMode(GpGraphics *graphics, InterpolationMode *mode)
Definition: graphics.c:4882
GpStatus WINGDIPAPI GdipGetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode *mode)
Definition: graphics.c:4943
HDC WINAPI GetDC(_In_opt_ HWND)
InterpolationMode
Definition: gdiplusenums.h:139
GpStatus WINGDIPAPI GdipGetMatrixElements(GDIPCONST GpMatrix *matrix, REAL *out)
Definition: matrix.c:172
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
Definition: matrix.c:140
static HDC
Definition: imagelist.c:92
GpStatus WINGDIPAPI GdipGetSmoothingMode(GpGraphics *graphics, SmoothingMode *mode)
Definition: graphics.c:4960
GpStatus WINGDIPAPI GdipSetClipRect(GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, CombineMode mode)
Definition: graphics.c:6473
UINT GraphicsContainer
Definition: gdiplusenums.h:23
GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix)
Definition: graphics.c:5062
GpStatus WINGDIPAPI GdipGetCompositingQuality(GpGraphics *graphics, CompositingQuality *quality)
Definition: graphics.c:4865
PixelOffsetMode
Definition: gdiplusenums.h:158
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
Definition: graphics.c:6202
GpStatus WINGDIPAPI GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode mode)
Definition: graphics.c:6289
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
GpStatus WINGDIPAPI GdipSetCompositingMode(GpGraphics *graphics, CompositingMode mode)
Definition: graphics.c:6085
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
smooth NULL
Definition: ftsmooth.c:416
CompositingQuality
Definition: gdiplusenums.h:129
REAL Height
Definition: gdiplustypes.h:264
GpStatus WINGDIPAPI GdipEndContainer(GpGraphics *graphics, GraphicsContainer state)
Definition: graphics.c:6039
GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode mode)
Definition: graphics.c:6143
REAL X
Definition: gdiplustypes.h:261
GpStatus WINGDIPAPI GdipBeginContainer2(GpGraphics *graphics, GraphicsContainer *state)
Definition: graphics.c:5917
GpStatus WINGDIPAPI GdipGetTextRenderingHint(GpGraphics *graphics, TextRenderingHint *hint)
Definition: graphics.c:4988
CompositingMode
Definition: gdiplusenums.h:245
GpStatus WINGDIPAPI GdipSetTextRenderingHint(GpGraphics *graphics, TextRenderingHint hint)
Definition: graphics.c:6330
GpStatus WINGDIPAPI GdipGetPageScale(GpGraphics *graphics, REAL *scale)
Definition: graphics.c:4912
GpStatus WINGDIPAPI GdipSetCompositingQuality(GpGraphics *graphics, CompositingQuality quality)
Definition: graphics.c:6114
#define expect(expected, got)
Definition: graphics.c:28
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
Definition: matrix.c:160
HDC hdc
Definition: main.c:9
SmoothingMode
Definition: gdiplusenums.h:119
TextRenderingHint
Definition: gdiplusenums.h:251
GpStatus WINGDIPAPI GdipGetCompositingMode(GpGraphics *graphics, CompositingMode *mode)
Definition: graphics.c:4848
GpStatus WINGDIPAPI GdipGetPageUnit(GpGraphics *graphics, GpUnit *unit)
Definition: graphics.c:4927
Status
Definition: gdiplustypes.h:24
REAL Width
Definition: gdiplustypes.h:263
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define ok(value,...)
Definition: atltest.h:57
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
unsigned int UINT
Definition: ndis.h:50
GLuint interp
Definition: glext.h:9512
GpStatus WINGDIPAPI GdipGetTextContrast(GpGraphics *graphics, UINT *contrast)
Definition: graphics.c:4975
GLuint GLenum GLenum transform
Definition: glext.h:9407
GpStatus WINGDIPAPI GdipGetClipBounds(GpGraphics *graphics, GpRectF *rect)
Definition: graphics.c:4807
GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale)
Definition: graphics.c:6178
float REAL
Definition: types.h:41
GpStatus WINGDIPAPI GdipSetTextContrast(GpGraphics *graphics, UINT contrast)
Definition: graphics.c:6318
REAL Y
Definition: gdiplustypes.h:262
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by START_TEST().

◆ test_bitmapfromgraphics()

static void test_bitmapfromgraphics ( void  )
static

Definition at line 5014 of file graphics.c.

5015 {
5016  GpStatus stat;
5017  GpGraphics *graphics = NULL;
5018  HDC hdc = GetDC( hwnd );
5019  GpBitmap *bitmap = NULL;
5021  REAL imageres, graphicsres;
5022  UINT width, height;
5023 
5024  stat = GdipCreateFromHDC(hdc, &graphics);
5025  expect(Ok, stat);
5026 
5029 
5030  stat = GdipCreateBitmapFromGraphics(12, 13, graphics, NULL);
5032 
5033  stat = GdipCreateBitmapFromGraphics(12, 13, graphics, &bitmap);
5034  expect(Ok, stat);
5035 
5037  expect(Ok, stat);
5039 
5040  stat = GdipGetDpiX(graphics, &graphicsres);
5041  expect(Ok, stat);
5042 
5044  expect(Ok, stat);
5045  expectf(graphicsres, imageres);
5046 
5047  stat = GdipGetDpiY(graphics, &graphicsres);
5048  expect(Ok, stat);
5049 
5051  expect(Ok, stat);
5052  expectf(graphicsres, imageres);
5053 
5055  expect(Ok, stat);
5056  expect(12, width);
5057 
5059  expect(Ok, stat);
5060  expect(13, height);
5061 
5062  GdipDeleteGraphics(graphics);
5064 }
GpStatus WINGDIPAPI GdipGetDpiY(GpGraphics *graphics, REAL *dpi)
Definition: graphics.c:6635
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLint GLint GLsizei width
Definition: gl.h:1546
#define expectf(expected, got)
Definition: graphics.c:30
GpStatus WINGDIPAPI GdipGetDpiX(GpGraphics *graphics, REAL *dpi)
Definition: graphics.c:6621
HDC WINAPI GetDC(_In_opt_ HWND)
GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
Definition: image.c:2342
GpStatus WINGDIPAPI GdipGetImageVerticalResolution(GpImage *image, REAL *res)
Definition: image.c:2330
static HDC
Definition: imagelist.c:92
GpStatus WINGDIPAPI GdipGetImageHorizontalResolution(GpImage *image, REAL *res)
Definition: image.c:2261
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
Definition: image.c:2239
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
smooth NULL
Definition: ftsmooth.c:416
Definition: uimain.c:88
GpStatus WINGDIPAPI GdipGetImagePixelFormat(GpImage *image, PixelFormat *format)
Definition: image.c:2291
#define expect(expected, got)
Definition: graphics.c:28
INT PixelFormat
HDC hdc
Definition: main.c:9
GpStatus WINGDIPAPI GdipCreateBitmapFromGraphics(INT width, INT height, GpGraphics *target, GpBitmap **bitmap)
Definition: image.c:1542
Definition: stat.h:55
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
unsigned int UINT
Definition: ndis.h:50
#define PixelFormat32bppPARGB
float REAL
Definition: types.h:41

Referenced by START_TEST().

◆ test_clear()

static void test_clear ( void  )
static

Definition at line 2241 of file graphics.c.

2242 {
2243  GpStatus status;
2244 
2245  status = GdipGraphicsClear(NULL, 0xdeadbeef);
2247 }
smooth NULL
Definition: ftsmooth.c:416
#define expect(expected, got)
Definition: graphics.c:28
Status
Definition: gdiplustypes.h:24
GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics *graphics, ARGB color)
Definition: graphics.c:5076
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by START_TEST().

◆ test_clip_xform()

static void test_clip_xform ( void  )
static

Definition at line 2115 of file graphics.c.

2116 {
2117  GpStatus status;
2118  GpGraphics *graphics = NULL;
2119  HDC hdc = GetDC( hwnd );
2120  GpRegion *clip;
2121  COLORREF color;
2122  UINT region_data_size;
2123  struct {
2124  DWORD size;
2125  DWORD checksum;
2126  DWORD magic;
2127  DWORD num_children;
2128  DWORD element_type;
2129  REAL x;
2130  REAL y;
2131  REAL width;
2132  REAL height;
2133  } region_data;
2134 
2135  status = GdipCreateFromHDC(hdc, &graphics);
2136  expect(Ok, status);
2137  status = GdipCreateRegion(&clip);
2138  expect(Ok, status);
2139 
2140  status = GdipGraphicsClear(graphics, 0xff000000);
2141  expect(Ok, status);
2142 
2143  status = GdipSetClipRect(graphics, 10, 10, -10, -10, CombineModeReplace);
2144  expect(Ok, status);
2145  status = GdipGetClip(graphics, clip);
2146  expect(Ok, status);
2147  status = GdipGetRegionData(clip, (BYTE*)&region_data, sizeof(region_data), &region_data_size);
2148  expect(Ok, status);
2149  expect(36, region_data_size);
2150  expect(28, region_data.size);
2151  expect(0, region_data.num_children);
2152  expect(0x10000000 /* RegionDataRect */, region_data.element_type);
2153  expectf(0.0, region_data.x);
2154  expectf(0.0, region_data.y);
2155  expectf(10.0, region_data.width);
2156  expectf(10.0, region_data.height);
2157 
2158  /* No effect with negative width/height */
2159  status = GdipGraphicsClear(graphics, 0xffff0000);
2160  expect(Ok, status);
2161  color = GetPixel(hdc, 5, 5);
2162  expect(0, color);
2163 
2164  status = GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderAppend);
2165  expect(Ok, status);
2166 
2167  status = GdipGraphicsClear(graphics, 0xffff0000);
2168  expect(Ok, status);
2169  color = GetPixel(hdc, 5, 5);
2170  expect(0, color);
2171 
2172  status = GdipResetClip(graphics);
2173  expect(Ok, status);
2174  status = GdipResetWorldTransform(graphics);
2175  expect(Ok, status);
2176  status = GdipGraphicsClear(graphics, 0xff000000);
2177  expect(Ok, status);
2178 
2179  status = GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderAppend);
2180  expect(Ok, status);
2181 
2182  status = GdipSetClipRect(graphics, 5, 5, -5, -5, CombineModeReplace);
2183  expect(Ok, status);
2184  status = GdipGetClip(graphics, clip);
2185  expect(Ok, status);
2186  status = GdipGetRegionData(clip, (BYTE*)&region_data, sizeof(region_data), &region_data_size);
2187  expect(Ok, status);
2188  expect(36, region_data_size);
2189  expect(28, region_data.size);
2190  expect(0, region_data.num_children);
2191  expect(0x10000000 /* RegionDataRect */, region_data.element_type);
2192  expectf(0.0, region_data.x);
2193  expectf(0.0, region_data.y);
2194  expectf(5.0, region_data.width);
2195  expectf(5.0, region_data.height);
2196 
2197  status = GdipGraphicsClear(graphics, 0xffff0000);
2198  expect(Ok, status);
2199  color = GetPixel(hdc, 5, 5);
2200  expect(0xff, color);
2201 
2202  GdipDeleteGraphics(graphics);
2203  GdipDeleteRegion(clip);
2204  ReleaseDC(hwnd, hdc);
2205 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLint GLint GLsizei width
Definition: gl.h:1546
#define expectf(expected, got)
Definition: graphics.c:30
GpStatus WINGDIPAPI GdipResetWorldTransform(GpGraphics *graphics)
Definition: graphics.c:5840
GpStatus WINGDIPAPI GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, GpMatrixOrder order)
Definition: graphics.c:6051
GpStatus WINGDIPAPI GdipGetRegionData(GpRegion *region, BYTE *buffer, UINT size, UINT *needed)
Definition: region.c:747
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
u32_t magic(void)
GpStatus WINGDIPAPI GdipSetClipRect(GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, CombineMode mode)
Definition: graphics.c:6473
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region)
Definition: graphics.c:6809
GLuint color
Definition: glext.h:6243
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
Definition: region.c:390
GLsizeiptr size
Definition: glext.h:5919
DWORD COLORREF
Definition: windef.h:300
unsigned long DWORD
Definition: ntddk_ex.h:95
#define expect(expected, got)
Definition: graphics.c:28
GpStatus WINGDIPAPI GdipResetClip(GpGraphics *graphics)
Definition: graphics.c:5827
HDC hdc
Definition: main.c:9
unsigned char BYTE
Definition: mem.h:68
static cab_ULONG checksum(const cab_UBYTE *data, cab_UWORD bytes, cab_ULONG csum)
Definition: fdi.c:353
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
Status
Definition: gdiplustypes.h:24
GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics *graphics, ARGB color)
Definition: graphics.c:5076
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
float REAL
Definition: types.h:41
static SERVICE_STATUS status
Definition: service.c:31
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
Definition: region.c:571
Definition: ps.c:97

Referenced by START_TEST().

◆ test_cliphrgn_transform()

static void test_cliphrgn_transform ( void  )
static

Definition at line 6681 of file graphics.c.

6682 {
6683  HDC hdc;
6684  GpStatus status;
6685  GpGraphics *graphics;
6686  HRGN rgn;
6687  RectF rectf;
6688  BOOL res;
6689 
6690  hdc = GetDC(hwnd);
6691 
6692  SetViewportOrgEx(hdc, 10, 10, NULL);
6693 
6694  status = GdipCreateFromHDC(hdc, &graphics);
6695  expect(Ok, status);
6696 
6697  rgn = CreateRectRgn(0, 0, 100, 100);
6698 
6699  status = GdipSetClipHrgn(graphics, rgn, CombineModeReplace);
6700  expect(Ok, status);
6701 
6702  status = GdipGetVisibleClipBounds(graphics, &rectf);
6703  expect(Ok, status);
6704  expectf(-10.0, rectf.X);
6705  expectf(-10.0, rectf.Y);
6706  expectf(100.0, rectf.Width);
6707  expectf(100.0, rectf.Height);
6708 
6709  status = GdipIsVisiblePoint(graphics, 95, 95, &res);
6710  expect(Ok, status);
6711  expect(FALSE, res);
6712 
6713  status = GdipIsVisiblePoint(graphics, -5, -5, &res);
6714  expect(Ok, status);
6715  expect(TRUE, res);
6716 
6717  DeleteObject(rgn);
6718 
6719  GdipDeleteGraphics(graphics);
6720 
6721  SetViewportOrgEx(hdc, 0, 0, NULL);
6722 
6723  ReleaseDC(hwnd, hdc);
6724 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
#define TRUE
Definition: types.h:120
#define expectf(expected, got)
Definition: graphics.c:30
GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect)
Definition: graphics.c:5004
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
unsigned int BOOL
Definition: ntddk_ex.h:94
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
REAL Height
Definition: gdiplustypes.h:264
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
GpStatus WINGDIPAPI GdipIsVisiblePoint(GpGraphics *graphics, REAL x, REAL y, BOOL *result)
Definition: graphics.c:5119
REAL X
Definition: gdiplustypes.h:261
GpStatus WINGDIPAPI GdipSetClipHrgn(GpGraphics *graphics, HRGN hrgn, CombineMode mode)
Definition: graphics.c:6412
#define expect(expected, got)
Definition: graphics.c:28
HDC hdc
Definition: main.c:9
Status
Definition: gdiplustypes.h:24
REAL Width
Definition: gdiplustypes.h:263
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
GLuint res
Definition: glext.h:9613
REAL Y
Definition: gdiplustypes.h:262
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by START_TEST().

◆ test_clipping()

static void test_clipping ( void  )
static

Definition at line 5066 of file graphics.c.

5067 {
5068  HDC hdc;
5069  GpStatus status;
5070  GpGraphics *graphics;
5071  GpRegion *region, *region100x100;
5072  GpMatrix *matrix;
5073  GpRectF rect;
5074  GpPointF ptf[4];
5075  GpUnit unit;
5076  HRGN hrgn;
5077  int ret;
5078  RECT rc;
5079 
5080  hdc = CreateCompatibleDC(0);
5081  status = GdipCreateFromHDC(hdc, &graphics);
5082  expect(Ok, status);
5083 
5084  status = GdipGetPageUnit(graphics, &unit);
5085  expect(Ok, status);
5087 
5088  status = GdipCreateRegion(&region);
5089  expect(Ok, status);
5090  status = GdipSetEmpty(region);
5091  expect(Ok, status);
5092 
5093  status = GdipCreateRegion(&region100x100);
5094  expect(Ok, status);
5095  status = GdipSetEmpty(region100x100);
5096  expect(Ok, status);
5097 
5098  rect.X = rect.Y = 100.0;
5099  rect.Width = rect.Height = 100.0;
5100  status = GdipCombineRegionRect(region100x100, &rect, CombineModeUnion);
5101  expect(Ok, status);
5102  status = GdipSetClipRegion(graphics, region100x100, CombineModeReplace);
5103  expect(Ok, status);
5104 
5105  status = GdipGetClipBounds(graphics, &rect);
5106  expect(Ok, status);
5107  ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
5108  "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5109 
5110  /* Clip region does not account for changes to gdi32 transform */
5111  SetViewportOrgEx(hdc, 10, 10, NULL);
5112 
5113  status = GdipGetClipBounds(graphics, &rect);
5114  expect(Ok, status);
5115  ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
5116  "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5117 
5118  SetViewportOrgEx(hdc, 0, 0, NULL);
5119 
5120  status = GdipSetEmpty(region);
5121  expect(Ok, status);
5122  status = GdipGetClip(graphics, region);
5123  expect(Ok, status);
5124  status = GdipGetRegionBounds(region, graphics, &rect);
5125  expect(Ok, status);
5126  ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
5127  "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5128 
5129  ptf[0].X = 100.0;
5130  ptf[0].Y = 100.0;
5131  ptf[1].X = 200.0;
5132  ptf[1].Y = 200.0;
5134  expect(Ok, status);
5135  ok(ptf[0].X == 100.0 && ptf[0].Y == 100.0 && ptf[1].X == 200.0 && ptf[1].Y == 200.0,
5136  "expected 100.0,100.0-200.0,200.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
5137 
5139  expect(Ok, status);
5141  expect(Ok, status);
5143  expect(Ok, status);
5144  status = GdipSetWorldTransform(graphics, matrix);
5145  expect(Ok, status);
5146 
5147  status = GdipGetClipBounds(graphics, &rect);
5148  expect(Ok, status);
5149  ok(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0,
5150  "expected 45.0,20.0-50.0,25.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5151 
5152  status = GdipSetEmpty(region);
5153  expect(Ok, status);
5154  status = GdipGetClip(graphics, region);
5155  expect(Ok, status);
5156  status = GdipGetRegionBounds(region, graphics, &rect);
5157  expect(Ok, status);
5158  ok(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0,
5159  "expected 45.0,20.0-50.0,25.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5160 
5161  status = GdipGetRegionBounds(region100x100, graphics, &rect);
5162  expect(Ok, status);
5163  ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
5164  "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5165 
5166  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5167  expect(Ok, status);
5168  ret = GetRgnBox(hrgn, &rc);
5169  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5170  ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45,
5171  "expected 45,20-95,45, got %s\n", wine_dbgstr_rect(&rc));
5172  DeleteObject(hrgn);
5173 
5174  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5175  expect(Ok, status);
5176  ret = GetRgnBox(hrgn, &rc);
5177  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5178  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5179  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5180  DeleteObject(hrgn);
5181 
5182  ptf[0].X = 100.0;
5183  ptf[0].Y = 100.0;
5184  ptf[1].X = 200.0;
5185  ptf[1].Y = 200.0;
5187  expect(Ok, status);
5188  ok(ptf[0].X == 45.0 && ptf[0].Y == 20.0 && ptf[1].X == 95.0 && ptf[1].Y == 45.0,
5189  "expected 45.0,20.0-95.0,45.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
5190 
5191  status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
5192  expect(Ok, status);
5193  ret = GetRgnBox(hrgn, &rc);
5194  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5195  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5196  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5197  DeleteObject(hrgn);
5198 
5199  status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
5200  expect(Ok, status);
5201  ret = GetRgnBox(hrgn, &rc);
5202  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5203  ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
5204  "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
5205  DeleteObject(hrgn);
5206 
5207  ptf[0].X = 210.0;
5208  ptf[0].Y = 420.0;
5209  ptf[1].X = 410.0;
5210  ptf[1].Y = 820.0;
5212  expect(Ok, status);
5213  ok(ptf[0].X == 100.0 && ptf[0].Y == 100.0 && ptf[1].X == 200.0 && ptf[1].Y == 200.0,
5214  "expected 100.0,100.0-200.0,200.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
5215 
5216  status = GdipSetPageScale(graphics, 2.0);
5217  expect(Ok, status);
5218 
5219  status = GdipGetClipBounds(graphics, &rect);
5220  expect(Ok, status);
5221  ok(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0,
5222  "expected 45.0,20.0-50.0,25.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5223 
5224  status = GdipSetEmpty(region);
5225  expect(Ok, status);
5226  status = GdipGetClip(graphics, region);
5227  expect(Ok, status);
5228  status = GdipGetRegionBounds(region, graphics, &rect);
5229  expect(Ok, status);
5230  ok(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0,
5231  "expected 45.0,20.0-50.0,25.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5232 
5233  status = GdipGetRegionBounds(region100x100, graphics, &rect);
5234  expect(Ok, status);
5235  ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
5236  "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5237 
5238  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5239  expect(Ok, status);
5240  ret = GetRgnBox(hrgn, &rc);
5241  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5242  ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45,
5243  "expected 45,20-95,45, got %s\n", wine_dbgstr_rect(&rc));
5244  DeleteObject(hrgn);
5245 
5246  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5247  expect(Ok, status);
5248  ret = GetRgnBox(hrgn, &rc);
5249  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5250  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5251  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5252  DeleteObject(hrgn);
5253 
5254  ptf[0].X = 100.0;
5255  ptf[0].Y = 100.0;
5256  ptf[1].X = 200.0;
5257  ptf[1].Y = 200.0;
5259  expect(Ok, status);
5260  ok(ptf[0].X == 45.0 && ptf[0].Y == 20.0 && ptf[1].X == 95.0 && ptf[1].Y == 45.0,
5261  "expected 45.0,20.0-95.0,45.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
5262 
5263  status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
5264  expect(Ok, status);
5265  ret = GetRgnBox(hrgn, &rc);
5266  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5267  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5268  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5269  DeleteObject(hrgn);
5270 
5271  status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
5272  expect(Ok, status);
5273  ret = GetRgnBox(hrgn, &rc);
5274  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5275  ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
5276  "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
5277  DeleteObject(hrgn);
5278 
5279  ptf[0].X = 210.0;
5280  ptf[0].Y = 420.0;
5281  ptf[1].X = 410.0;
5282  ptf[1].Y = 820.0;
5284  expect(Ok, status);
5285  ok(ptf[0].X == 100.0 && ptf[0].Y == 100.0 && ptf[1].X == 200.0 && ptf[1].Y == 200.0,
5286  "expected 100.0,100.0-200.0,200.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
5287 
5288  GdipSetPageUnit(graphics, UnitPoint);
5289  expect(Ok, status);
5290 
5291  status = GdipGetClipBounds(graphics, &rect);
5292  expect(Ok, status);
5293  ok((rect.X == 13.75 && rect.Y == 4.375 && rect.Width == 18.75 && rect.Height == 9.375) ||
5294  /* rounding under Wine is slightly different */
5295  (rect.X == 14.0 && rect.Y == 4.0 && rect.Width == 19.0 && rect.Height == 10.0) /* Wine */ ||
5296  broken(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0) /* before Win7 */,
5297  "expected 13.75,4.375-18.75,9.375, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5298 
5299  status = GdipSetEmpty(region);
5300  expect(Ok, status);
5301  status = GdipGetClip(graphics, region);
5302  expect(Ok, status);
5303  status = GdipGetRegionBounds(region, graphics, &rect);
5304  expect(Ok, status);
5305  ok((rect.X == 13.75 && rect.Y == 4.375 && rect.Width == 18.75 && rect.Height == 9.375) ||
5306  /* rounding under Wine is slightly different */
5307  (rect.X == 14.0 && rect.Y == 4.0 && rect.Width == 19.0 && rect.Height == 10.0) /* Wine */ ||
5308  broken(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0) /* before Win7 */,
5309  "expected 13.75,4.375-18.75,9.375, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5310 
5311  status = GdipGetRegionBounds(region100x100, graphics, &rect);
5312  expect(Ok, status);
5313  ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
5314  "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5315 
5316  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5317  expect(Ok, status);
5318  ret = GetRgnBox(hrgn, &rc);
5319  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5320  ok((rc.left == 14 && rc.top == 5 && rc.right == 33 && rc.bottom == 14) ||
5321  /* rounding under Wine is slightly different */
5322  (rc.left == 14 && rc.top == 4 && rc.right == 33 && rc.bottom == 14) /* Wine */ ||
5323  broken(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45) /* before Win7 */,
5324  "expected 14,5-33,14, got %s\n", wine_dbgstr_rect(&rc));
5325  DeleteObject(hrgn);
5326 
5327  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5328  expect(Ok, status);
5329  ret = GetRgnBox(hrgn, &rc);
5330  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5331  ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
5332  broken(rc.left == 267 && rc.top == 267 && rc.right == 534 && rc.bottom == 534) /* before Win7 */,
5333  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5334  DeleteObject(hrgn);
5335 
5336  ptf[0].X = 100.0;
5337  ptf[0].Y = 100.0;
5338  ptf[1].X = 200.0;
5339  ptf[1].Y = 200.0;
5341  expect(Ok, status);
5342  ok((ptf[0].X == 13.75 && ptf[0].Y == 4.375 && ptf[1].X == 32.5 && ptf[1].Y == 13.75) ||
5343  broken(ptf[0].X == 45.0 && ptf[0].Y == 20.0 && ptf[1].X == 95.0 && ptf[1].Y == 45.0) /* before Win7 */,
5344  "expected 13.75,4.375-32.5,13.75, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
5345 
5346  status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
5347  expect(Ok, status);
5348  ret = GetRgnBox(hrgn, &rc);
5349  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5350  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5351  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5352  DeleteObject(hrgn);
5353 
5354  status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
5355  expect(Ok, status);
5356  ret = GetRgnBox(hrgn, &rc);
5357  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5358  ok((rc.left == 560 && rc.top == 1120 && rc.right == 1094 && rc.bottom == 2187) ||
5359  /* rounding under Wine is slightly different */
5360  (rc.left == 560 && rc.top == 1120 && rc.right == 1093 && rc.bottom == 2187) /* Wine */,
5361  "expected 560,1120-1094,2187, got %s\n", wine_dbgstr_rect(&rc));
5362  DeleteObject(hrgn);
5363 
5364  ptf[0].X = 560.0;
5365  ptf[0].Y = 1120.0;
5366  ptf[1].X = 1094.0;
5367  ptf[1].Y = 2187.0;
5369  expect(Ok, status);
5370  if (fabs(ptf[0].X - 100.0) < 0.001)
5371  {
5372  expectf(100.0, ptf[0].X);
5373  expectf(100.0, ptf[0].Y);
5374  expectf(200.125, ptf[1].X);
5375  expectf(200.03125, ptf[1].Y);
5376  }
5377  else /* before Win7 */
5378  {
5379  ok(broken(fabs(ptf[0].X - 275.0) < 0.001), "expected 275.0, got %f\n", ptf[0].X);
5380  ok(broken(fabs(ptf[0].Y - 275.0) < 0.001), "expected 275.0, got %f\n", ptf[0].Y);
5381  ok(broken(fabs(ptf[1].X - 542.0) < 0.001), "expected 542.0, got %f\n", ptf[1].X);
5382  ok(broken(fabs(ptf[1].Y - 541.75) < 0.001), "expected 541.75, got %f\n", ptf[1].Y);
5383  }
5384 
5385  status = GdipTransformRegion(region100x100, matrix);
5386  expect(Ok, status);
5387 
5388  status = GdipGetRegionBounds(region100x100, graphics, &rect);
5389  expect(Ok, status);
5390  ok(rect.X == 210.0 && rect.Y == 420.0 && rect.Width == 200.0 && rect.Height == 400.0,
5391  "expected 210.0,420.0-200.0,400.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
5392 
5393  status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
5394  expect(Ok, status);
5395  ret = GetRgnBox(hrgn, &rc);
5396  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5397  ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
5398  "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
5399  DeleteObject(hrgn);
5400 
5401  status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
5402  expect(Ok, status);
5403  ret = GetRgnBox(hrgn, &rc);
5404  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5405  ok((rc.left == 1147 && rc.top == 4534 && rc.right == 2214 && rc.bottom == 8800) ||
5406  /* rounding under Wine is slightly different */
5407  (rc.left == 1147 && rc.top == 4533 && rc.right == 2213 && rc.bottom == 8800) /* Wine */,
5408  "expected 1147,4534-2214,8800, got %s\n", wine_dbgstr_rect(&rc));
5409  DeleteObject(hrgn);
5410 
5411  ptf[0].X = 1147.0;
5412  ptf[0].Y = 4534.0;
5413  ptf[1].X = 2214.0;
5414  ptf[1].Y = 8800.0;
5416  expect(Ok, status);
5417  if (fabs(ptf[0].X - 210.0625) < 0.001)
5418  {
5419  expectf(210.0625, ptf[0].X);
5420  expectf(420.0625, ptf[0].Y);
5421  expectf(410.125, ptf[1].X);
5422  expectf(820.0, ptf[1].Y);
5423  }
5424  else /* before Win7 */
5425  {
5426  ok(broken(fabs(ptf[0].X - 568.5) < 0.001), "expected 568.5, got %f\n", ptf[0].X);
5427  ok(broken(fabs(ptf[0].Y - 1128.5) < 0.001), "expected 1128.5, got %f\n", ptf[0].Y);
5428  ok(broken(fabs(ptf[1].X - 1102.0) < 0.001), "expected 1102.0, got %f\n", ptf[1].X);
5429  ok(broken(fabs(ptf[1].Y - 2195.0) < 0.001), "expected 2195.0, got %f\n", ptf[1].Y);
5430  }
5431 
5433  expect(Ok, status);
5434  status = GdipSetWorldTransform(graphics, matrix);
5435  expect(Ok, status);
5436 
5437  status = GdipGetClipBounds(graphics, &rect);
5438  expect(Ok, status);
5439  expectf_(20.612978, rect.X, 1.0);
5440  expectf_(-6.256012, rect.Y, 1.5);
5441  expectf_(25.612978, rect.Width, 1.0);
5442  expectf_(12.806489, rect.Height, 1.0);
5443 
5444  status = GdipSetEmpty(region);
5445  expect(Ok, status);
5446  status = GdipGetClip(graphics, region);
5447  expect(Ok, status);
5448  status = GdipGetRegionBounds(region, graphics, &rect);
5449  expect(Ok, status);
5450  /* rounding under Wine is slightly different */
5451  expectf_(20.612978, rect.X, 1.0);
5452  expectf_(-6.256012, rect.Y, 1.5);
5453  expectf_(25.612978, rect.Width, 1.0);
5454  expectf_(12.806489, rect.Height, 1.0);
5455 
5456  status = GdipGetRegionBounds(region100x100, graphics, &rect);
5457  expect(Ok, status);
5458  ok(rect.X == 210.0 && rect.Y == 420.0 && rect.Width == 200.0 && rect.Height == 400.0,
5459  "expected 210.0,420.0-200.0,400.0, got %f,%f-%f,%f\n", rect.X, rect.Y, rect.Width, rect.Height);
5460 
5461  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5462  expect(Ok, status);
5463  ret = GetRgnBox(hrgn, &rc);
5464  ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
5465  ok((rc.left == 22 && rc.top == -6 && rc.right == 46 && rc.bottom == 7) ||
5466  /* rounding under Wine is slightly different */
5467  (rc.left == 21 && rc.top == -5 && rc.right == 46 && rc.bottom == 7) /* Wine */,
5468  "expected (22,-6)-(46,7), got %s\n", wine_dbgstr_rect(&rc));
5469  DeleteObject(hrgn);
5470 
5471  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5472  expect(Ok, status);
5473  ret = GetRgnBox(hrgn, &rc);
5474  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5475  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5476  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5477  DeleteObject(hrgn);
5478 
5479  ptf[0].X = 100.0;
5480  ptf[0].Y = 100.0;
5481  ptf[1].X = 200.0;
5482  ptf[1].Y = 200.0;
5483  ptf[2].X = 200.0;
5484  ptf[2].Y = 100.0;
5485  ptf[3].X = 100.0;
5486  ptf[3].Y = 200.0;
5488  expect(Ok, status);
5489  expectf(20.612978, ptf[0].X);
5490  expectf(-1.568512, ptf[0].Y);
5491  expectf(46.225956, ptf[1].X);
5492  expectf(1.862977, ptf[1].Y);
5493  expectf(36.850956, ptf[2].X);
5494  expectf(-6.256012, ptf[2].Y);
5495  expectf(29.987980, ptf[3].X);
5496  expectf(6.550478, ptf[3].Y);
5497 
5498  status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
5499  expect(Ok, status);
5500  ret = GetRgnBox(hrgn, &rc);
5501  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5502  ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
5503  "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
5504  DeleteObject(hrgn);
5505 
5506  status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
5507  expect(Ok, status);
5508  ret = GetRgnBox(hrgn, &rc);
5509  ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
5510  ok((rc.left == -3406 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) ||
5511  /* rounding under Wine is slightly different */
5512  (rc.left == -3407 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) /* Wine */,
5513  "expected (-3406,4500)-(-350,8728), got %s\n", wine_dbgstr_rect(&rc));
5514  DeleteObject(hrgn);
5515 
5516  ptf[0].X = -3406.0;
5517  ptf[0].Y = 4500.0;
5518  ptf[1].X = -350.0;
5519  ptf[1].Y = 8728.0;
5520  ptf[2].X = -350.0;
5521  ptf[2].Y = 4500.0;
5522  ptf[3].X = -3406.0;
5523  ptf[3].Y = 8728.0;
5525  expect(Ok, status);
5526  expectf(-136.190491, ptf[0].X);
5527  expectf(520.010742, ptf[0].Y);
5528  expectf(756.417175, ptf[1].X);
5529  expectf(720.031616, ptf[1].Y);
5530  expectf(360.042114, ptf[2].X);
5531  expectf(376.760742, ptf[2].Y);
5532  expectf(260.184570, ptf[3].X);
5533  expectf(863.281616, ptf[3].Y);
5534 
5536  expect(Ok, status);
5537  status = GdipSetWorldTransform(graphics, matrix);
5538  expect(Ok, status);
5539 
5540  status = GdipGetClipBounds(graphics, &rect);
5541  expect(Ok, status);
5542  expectf_(-28.100956, rect.X, 1.0);
5543  expectf_(7.806488, rect.Y, 1.5);
5544  expectf_(25.612978, rect.Width, 1.0);
5545  expectf_(12.806489, rect.Height, 1.0);
5546 
5547  status = GdipSetEmpty(region);
5548  expect(Ok, status);
5549  status = GdipGetClip(graphics, region);
5550  expect(Ok, status);
5551  status = GdipGetRegionBounds(region, graphics, &rect);
5552  expect(Ok, status);
5553  /* rounding under Wine is slightly different */
5554  expectf_(-28.100956, rect.X, 1.0);
5555  expectf_(7.806488, rect.Y, 1.5);
5556  expectf_(25.612978, rect.Width, 1.0);
5557  expectf_(12.806489, rect.Height, 1.0);
5558 
5559  status = GdipGetRegionBounds(region100x100, graphics, &rect);
5560  expect(Ok, status);
5561  ok(rect.X == 210.0 && rect.Y == 420.0 && rect.Width == 200.0 && rect.Height == 400.0,
5562  "expected 210.0,420.0-200.0,400.0, got %f,%f-%f,%f\n", rect.X, rect.Y, rect.Width, rect.Height);
5563 
5564  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5565  expect(Ok, status);
5566  ret = GetRgnBox(hrgn, &rc);
5567  ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
5568  ok((rc.left == -27 && rc.top == 8 && rc.right == -2 && rc.bottom == 21) ||
5569  /* rounding under Wine is slightly different */
5570  (rc.left == -28 && rc.top == 9 && rc.right == -2 && rc.bottom == 21) /* Wine */,
5571  "expected (-27,8)-(-2,21), got %s\n", wine_dbgstr_rect(&rc));
5572  DeleteObject(hrgn);
5573 
5574  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5575  expect(Ok, status);
5576  ret = GetRgnBox(hrgn, &rc);
5577  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5578  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5579  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5580  DeleteObject(hrgn);
5581 
5582  ptf[0].X = 100.0;
5583  ptf[0].Y = 100.0;
5584  ptf[1].X = 200.0;
5585  ptf[1].Y = 200.0;
5586  ptf[2].X = 200.0;
5587  ptf[2].Y = 100.0;
5588  ptf[3].X = 100.0;
5589  ptf[3].Y = 200.0;
5591  expect(Ok, status);
5592  expectf(-11.862979, ptf[0].X);
5593  expectf(7.806488, ptf[0].Y);
5594  expectf(-18.725958, ptf[1].X);
5595  expectf(20.612976, ptf[1].Y);
5596  expectf(-2.487981, ptf[2].X);
5597  expectf(15.925477, ptf[2].Y);
5598  expectf(-28.100956, ptf[3].X);
5599  expectf(12.493987, ptf[3].Y);
5600 
5601  status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
5602  expect(Ok, status);
5603  ret = GetRgnBox(hrgn, &rc);
5604  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5605  ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
5606  "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc));
5607  DeleteObject(hrgn);
5608 
5609  status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
5610  expect(Ok, status);
5611  ret = GetRgnBox(hrgn, &rc);
5612  ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
5613  ok((rc.left == 4500 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) ||
5614  /* rounding under Wine is slightly different */
5615  (rc.left == 4499 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) /* Wine */,
5616  "expected (4500,351)-(8728,3407), got %s\n", wine_dbgstr_rect(&rc));
5617  DeleteObject(hrgn);
5618 
5619  ptf[0].X = -3406.0;
5620  ptf[0].Y = 4500.0;
5621  ptf[1].X = -350.0;
5622  ptf[1].Y = 8728.0;
5623  ptf[2].X = -350.0;
5624  ptf[2].Y = 4500.0;
5625  ptf[3].X = -3406.0;
5626  ptf[3].Y = 8728.0;
5628  expect(Ok, status);
5629  expectf(-1055.021484, ptf[0].X);
5630  expectf(-70.595329, ptf[0].Y);
5631  expectf(-1455.063232, ptf[1].X);
5632  expectf(375.708435, ptf[1].Y);
5633  expectf(-768.521484, ptf[2].X);
5634  expectf(177.520981, ptf[2].Y);
5635  expectf(-1741.563110, ptf[3].X);
5636  expectf(127.592125, ptf[3].Y);
5637 
5639  GdipDeleteRegion(region);
5640  GdipDeleteRegion(region100x100);
5641  GdipDeleteGraphics(graphics);
5642  DeleteDC(hdc);
5643 }
GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region, GDIPCONST GpRectF *rect, CombineMode mode)
Definition: region.c:278
GpStatus WINGDIPAPI GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix)
Definition: graphics.c:6358
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
#define expectf(expected, got)
Definition: graphics.c:30
#define Y(I)
Unit
Definition: gdiplusenums.h:25
GLuint GLenum matrix
Definition: glext.h:9407
GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hrgn)
Definition: region.c:1194
GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
Definition: matrix.c:140
static HDC
Definition: imagelist.c:92
#define COMPLEXREGION
Definition: wingdi.h:362
LONG top
Definition: windef.h:307
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
GpStatus WINGDIPAPI GdipSetEmpty(GpRegion *region)
Definition: region.c:1359
& rect
Definition: startmenu.cpp:1413
GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region)
Definition: graphics.c:6809
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
Definition: graphics.c:6202
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
Definition: region.c:390
const char * wine_dbgstr_rect(const RECT *rect)
REAL Y
Definition: gdiplustypes.h:249
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:258
#define expect(expected, got)
Definition: graphics.c:28
int ret
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
Definition: matrix.c:160
GpStatus WINGDIPAPI GdipTransformRegion(GpRegion *region, GpMatrix *matrix)
Definition: region.c:1480
HDC hdc
Definition: main.c:9
static HRGN hrgn
Definition: win.c:55
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:289
REAL X
Definition: gdiplustypes.h:248
GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect)
Definition: region.c:587
#define broken(x)
Definition: _sntprintf.h:21
GpStatus WINGDIPAPI GdipGetPageUnit(GpGraphics *graphics, GpUnit *unit)
Definition: graphics.c:4927
Status
Definition: gdiplustypes.h:24
int WINAPI GetRgnBox(_In_ HRGN, _Out_ LPRECT)
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define SIMPLEREGION
Definition: wingdi.h:361
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:418
BOOL WINAPI DeleteDC(_In_ HDC)
GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, CombineMode mode)
Definition: graphics.c:6533
#define expectf_(expected, got, precision)
Definition: graphics.c:29
#define ok(value,...)
Definition: atltest.h:57
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
LONG bottom
Definition: windef.h:309
GpStatus WINGDIPAPI GdipGetClipBounds(GpGraphics *graphics, GpRectF *rect)
Definition: graphics.c:4807
GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale)
Definition: graphics.c:6178
static SERVICE_STATUS status
Definition: service.c:31
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
Definition: region.c:571
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6960
Definition: ps.c:97

Referenced by START_TEST().

◆ test_clipping_2()

static void test_clipping_2 ( void  )
static

Definition at line 5645 of file graphics.c.

5646 {
5647 
5648  HDC hdc;
5649  GpStatus status;
5650  GpGraphics *graphics;
5651  GpRegion *region;
5652  GpMatrix *matrix;
5653  GpRectF rect;
5654  GpPointF ptf[4];
5655  GpUnit unit;
5656  HRGN hrgn;
5657  int ret;
5658  RECT rc;
5659 
5660  hdc = CreateCompatibleDC(0);
5661  status = GdipCreateFromHDC(hdc, &graphics);
5662  expect(Ok, status);
5663 
5664  status = GdipGetPageUnit(graphics, &unit);
5665  expect(Ok, status);
5667 
5668  GdipSetPageUnit(graphics, UnitInch);
5669 
5670  status = GdipCreateRegion(&region);
5671  expect(Ok, status);
5672  status = GdipSetEmpty(region);
5673  expect(Ok, status);
5674  rect.X = rect.Y = 100.0;
5675  rect.Width = rect.Height = 100.0;
5677  expect(Ok, status);
5678  status = GdipSetClipRegion(graphics, region, CombineModeReplace);
5679  expect(Ok, status);
5680 
5681  status = GdipGetClip(graphics, region);
5682  expect(Ok, status);
5683  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5684  expect(Ok, status);
5685  ret = GetRgnBox(hrgn, &rc);
5686  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5687  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5688  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5689  DeleteObject(hrgn);
5690  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5691  expect(Ok, status);
5692  ret = GetRgnBox(hrgn, &rc);
5693  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5694  ok(rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200,
5695  "expected 9600,9600-19200,19200, got %s\n", wine_dbgstr_rect(&rc));
5696  DeleteObject(hrgn);
5697 
5698  ptf[0].X = 9600.0;
5699  ptf[0].Y = 9600.0;
5700  ptf[1].X = 19200.0;
5701  ptf[1].Y = 19200.0;
5703  expect(Ok, status);
5704  expectf(100.0, ptf[0].X);
5705  expectf(100.0, ptf[0].Y);
5706  expectf(200.0, ptf[1].X);
5707  expectf(200.0, ptf[1].X);
5708 
5709  GdipSetPageUnit(graphics, UnitPoint);
5710 
5711  status = GdipGetClip(graphics, region);
5712  expect(Ok, status);
5713  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5714  expect(Ok, status);
5715  ret = GetRgnBox(hrgn, &rc);
5716  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5717  ok((rc.left == 7200 && rc.top == 7200 && rc.right == 14400 && rc.bottom == 14400) ||
5718  broken(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) /* before Win7 */,
5719  "expected 7200,7200-14400,14400, got %s\n", wine_dbgstr_rect(&rc));
5720  DeleteObject(hrgn);
5721  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5722  expect(Ok, status);
5723  ret = GetRgnBox(hrgn, &rc);
5724  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5725  ok((rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200) ||
5726  broken(rc.left == 134 && rc.top == 134 && rc.right == 267 && rc.bottom == 267) /* before Win7 */,
5727  "expected 9600,9600-19200,19200, got %s\n", wine_dbgstr_rect(&rc));
5728  DeleteObject(hrgn);
5729 
5730  ptf[0].X = 9600.0;
5731  ptf[0].Y = 9600.0;
5732  ptf[1].X = 19200.0;
5733  ptf[1].Y = 19200.0;
5735  expect(Ok, status);
5736  if (fabs(ptf[0].X - 7200.0) < 0.001)
5737  ok(ptf[0].X == 7200.0 && ptf[0].Y == 7200.0 && ptf[1].X == 14400.0 && ptf[1].Y == 14400.0,
5738  "expected 7200.0,7200.0-14400.0,14400.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
5739  else /* before Win7 */
5740  {
5741  ok(broken(fabs(ptf[0].X - 100.0) < 0.001), "expected 100.0, got %f\n", ptf[0].X);
5742  ok(broken(fabs(ptf[0].Y - 100.0) < 0.001), "expected 100.0, got %f\n", ptf[0].Y);
5743  ok(broken(fabs(ptf[1].X - 200.0) < 0.001), "expected 200.0, got %f\n", ptf[1].X);
5744  ok(broken(fabs(ptf[1].Y - 200.0) < 0.001), "expected 200.0, got %f\n", ptf[1].Y);
5745  }
5746 
5747  GdipDeleteRegion(region);
5748 
5749  GdipSetPageUnit(graphics, UnitPixel);
5750 
5751  status = GdipCreateRegion(&region);
5752  expect(Ok, status);
5753  status = GdipSetEmpty(region);
5754  expect(Ok, status);
5755  rect.X = rect.Y = 100.0;
5756  rect.Width = rect.Height = 100.0;
5758  expect(Ok, status);
5759  status = GdipSetClipRegion(graphics, region, CombineModeReplace);
5760  expect(Ok, status);
5761 
5762  status = GdipGetClip(graphics, region);
5763  expect(Ok, status);
5764  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5765  expect(Ok, status);
5766  ret = GetRgnBox(hrgn, &rc);
5767  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5768  ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
5769  broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
5770  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5771  DeleteObject(hrgn);
5772  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5773  expect(Ok, status);
5774  ret = GetRgnBox(hrgn, &rc);
5775  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5776  ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
5777  broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
5778  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5779  DeleteObject(hrgn);
5780 
5781  ptf[0].X = 100.0;
5782  ptf[0].Y = 100.0;
5783  ptf[1].X = 200.0;
5784  ptf[1].Y = 200.0;
5786  expect(Ok, status);
5787  if (fabs(ptf[0].X - 100.0) < 0.001)
5788  ok(ptf[0].X == 100.0 && ptf[0].Y == 100.0 && ptf[1].X == 200.0 && ptf[1].Y == 200.0,
5789  "expected 100.0,100.0-200.0,200.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
5790  else /* before Win7 */
5791  {
5792  ok(broken(fabs(ptf[0].X - 1.041667) < 0.001), "expected 1.041667, got %f\n", ptf[0].X);
5793  ok(broken(fabs(ptf[0].Y - 1.041667) < 0.001), "expected 1.041667, got %f\n", ptf[0].Y);
5794  ok(broken(fabs(ptf[1].X - 2.083333) < 0.001), "expected 2.083333, got %f\n", ptf[1].X);
5795  ok(broken(fabs(ptf[1].Y - 2.083333) < 0.001), "expected 2.083333, got %f\n", ptf[1].Y);
5796  }
5797 
5798  GdipSetPageUnit(graphics, UnitPoint);
5799 
5800  status = GdipGetClip(graphics, region);
5801  expect(Ok, status);
5802  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5803  expect(Ok, status);
5804  ret = GetRgnBox(hrgn, &rc);
5805  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5806  ok((rc.left == 75 && rc.top == 75 && rc.right == 150 && rc.bottom == 150) ||
5807  broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
5808  "expected 75,75-150,150, got %s\n", wine_dbgstr_rect(&rc));
5809  DeleteObject(hrgn);
5810  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5811  expect(Ok, status);
5812  ret = GetRgnBox(hrgn, &rc);
5813  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5814  ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
5815  broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
5816  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5817  DeleteObject(hrgn);
5818 
5819  ptf[0].X = 100.0;
5820  ptf[0].Y = 100.0;
5821  ptf[1].X = 200.0;
5822  ptf[1].Y = 200.0;
5824  expect(Ok, status);
5825  if (fabs(ptf[0].X - 75.0) < 0.001)
5826  ok(ptf[0].X == 75.0 && ptf[0].Y == 75.0 && ptf[1].X == 150.0 && ptf[1].Y == 150.0,
5827  "expected 75.0,75.0-150.0,150.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
5828  else /* before Win7 */
5829  {
5830  ok(broken(fabs(ptf[0].X - 1.041667) < 0.001), "expected 1.041667, got %f\n", ptf[0].X);
5831  ok(broken(fabs(ptf[0].Y - 1.041667) < 0.001), "expected 1.041667, got %f\n", ptf[0].Y);
5832  ok(broken(fabs(ptf[1].X - 2.083333) < 0.001), "expected 2.083333, got %f\n", ptf[1].X);
5833  ok(broken(fabs(ptf[1].Y - 2.083333) < 0.001), "expected 2.083333, got %f\n", ptf[1].Y);
5834  }
5835 
5837  expect(Ok, status);
5839  expect(Ok, status);
5840  status = GdipSetWorldTransform(graphics, matrix);
5841  expect(Ok, status);
5843 
5844  status = GdipGetClip(graphics, region);
5845  expect(Ok, status);
5846  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5847  expect(Ok, status);
5848  ret = GetRgnBox(hrgn, &rc);
5849  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5850  ok(rc.left == 65 && rc.top == 65 && rc.right == 140 && rc.bottom == 140,
5851  "expected 65,65-140,140, got %s\n", wine_dbgstr_rect(&rc));
5852  DeleteObject(hrgn);
5853  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5854  expect(Ok, status);
5855  ret = GetRgnBox(hrgn, &rc);
5856  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5857  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5858  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5859  DeleteObject(hrgn);
5860 
5861  ptf[0].X = 100.0;
5862  ptf[0].Y = 100.0;
5863  ptf[1].X = 200.0;
5864  ptf[1].Y = 200.0;
5866  expect(Ok, status);
5867  expectf(65.0, ptf[0].X);
5868  expectf(65.0, ptf[0].Y);
5869  expectf(140.0, ptf[1].X);
5870  expectf(140.0, ptf[1].X);
5871 
5873  expect(Ok, status);
5875  expect(Ok, status);
5876  status = GdipSetWorldTransform(graphics, matrix);
5877  expect(Ok, status);
5879 
5880  status = GdipGetClip(graphics, region);
5881  expect(Ok, status);
5882  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5883  expect(Ok, status);
5884  ret = GetRgnBox(hrgn, &rc);
5885  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5886  ok(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300,
5887  "expected 300,150-600,300, got %s\n", wine_dbgstr_rect(&rc));
5888  DeleteObject(hrgn);
5889  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5890  expect(Ok, status);
5891  ret = GetRgnBox(hrgn, &rc);
5892  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5893  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5894  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5895  DeleteObject(hrgn);
5896 
5897  ptf[0].X = 100.0;
5898  ptf[0].Y = 100.0;
5899  ptf[1].X = 200.0;
5900  ptf[1].Y = 200.0;
5902  expect(Ok, status);
5903  expectf(300.0, ptf[0].X);
5904  expectf(150.0, ptf[0].Y);
5905  expectf(600.0, ptf[1].X);
5906  expectf(300.0, ptf[1].Y);
5907 
5908  status = GdipSetPageScale(graphics, 2.0);
5909  expect(Ok, status);
5910 
5911  status = GdipGetClip(graphics, region);
5912  expect(Ok, status);
5913  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5914  expect(Ok, status);
5915  ret = GetRgnBox(hrgn, &rc);
5916  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5917  ok((rc.left == 150 && rc.top == 75 && rc.right == 300 && rc.bottom == 150) ||
5918  broken(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300) /* before Win7 */,
5919  "expected 150,75-300,150, got %s\n", wine_dbgstr_rect(&rc));
5920  DeleteObject(hrgn);
5921  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5922  expect(Ok, status);
5923  ret = GetRgnBox(hrgn, &rc);
5924  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5925  ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
5926  broken(rc.left == 200 && rc.top == 200 && rc.right == 400 && rc.bottom == 400) /* before Win7 */,
5927  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5928  DeleteObject(hrgn);
5929 
5930  ptf[0].X = 100.0;
5931  ptf[0].Y = 100.0;
5932  ptf[1].X = 200.0;
5933  ptf[1].Y = 200.0;
5935  expect(Ok, status);
5936  if (fabs(ptf[0].X - 150.0) < 0.001)
5937  {
5938  expectf(150.0, ptf[0].X);
5939  expectf(75.0, ptf[0].Y);
5940  expectf(300.0, ptf[1].X);
5941  expectf(150.0, ptf[1].Y);
5942  }
5943  else /* before Win7 */
5944  {
5945  ok(broken(fabs(ptf[0].X - 300.0) < 0.001), "expected 300.0, got %f\n", ptf[0].X);
5946  ok(broken(fabs(ptf[0].Y - 150.0) < 0.001), "expected 150.0, got %f\n", ptf[0].Y);
5947  ok(broken(fabs(ptf[1].X - 600.0) < 0.001), "expected 600.0, got %f\n", ptf[1].X);
5948  ok(broken(fabs(ptf[1].Y - 300.0) < 0.001), "expected 300.0, got %f\n", ptf[1].Y);
5949  }
5950 
5952  expect(Ok, status);
5954  expect(Ok, status);
5955  status = GdipSetWorldTransform(graphics, matrix);
5956  expect(Ok, status);
5958 
5959  status = GdipGetClip(graphics, region);
5960  expect(Ok, status);
5961  status = GdipGetRegionHRgn(region, NULL, &hrgn);
5962  expect(Ok, status);
5963  ret = GetRgnBox(hrgn, &rc);
5964  ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
5965  ok((rc.left == 54 && rc.top == -26 && rc.right == 107 && rc.bottom == 27) ||
5966  /* rounding under Wine is slightly different */
5967  (rc.left == 53 && rc.top == -26 && rc.right == 106 && rc.bottom == 27) /* Wine */,
5968  "expected 54,-26-107,27, got %s\n", wine_dbgstr_rect(&rc));
5969  DeleteObject(hrgn);
5970  status = GdipGetRegionHRgn(region, graphics, &hrgn);
5971  expect(Ok, status);
5972  ret = GetRgnBox(hrgn, &rc);
5973  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
5974  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
5975  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
5976  DeleteObject(hrgn);
5977 
5978  ptf[0].X = 100.0;
5979  ptf[0].Y = 100.0;
5980  ptf[1].X = 200.0;
5981  ptf[1].Y = 200.0;
5982  ptf[2].X = 200.0;
5983  ptf[2].Y = 100.0;
5984  ptf[3].X = 100.0;
5985  ptf[3].Y = 200.0;
5987  expect(Ok, status);
5988  expectf(53.033016, ptf[0].X);
5989  expectf(0.0, ptf[0].Y);
5990  expectf(106.066032, ptf[1].X);
5991  expectf(0.0, ptf[1].Y);
5992  expectf(79.549522, ptf[2].X);
5993  expectf(-26.516510, ptf[2].Y);
5994  expectf(79.549522, ptf[3].X);
5995  expectf(26.516508, ptf[3].Y);
5996 
5998  expect(Ok, status);
6000  expect(Ok, status);
6001  status = GdipSetWorldTransform(graphics, matrix);
6002  expect(Ok, status);
6004 
6005  status = GdipGetClip(graphics, region);
6006  expect(Ok, status);
6007  status = GdipGetRegionHRgn(region, NULL, &hrgn);
6008  expect(Ok, status);
6009  ret = GetRgnBox(hrgn, &rc);
6010  ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
6011  ok((rc.left == -26 && rc.top == 54 && rc.right == 27 && rc.bottom == 107) ||
6012  /* rounding under Wine is slightly different */
6013  (rc.left == -27 && rc.top == 54 && rc.right == 27 && rc.bottom == 106) /* Wine */,
6014  "expected -26,54-27,107, got %s\n", wine_dbgstr_rect(&rc));
6015  DeleteObject(hrgn);
6016  status = GdipGetRegionHRgn(region, graphics, &hrgn);
6017  expect(Ok, status);
6018  ret = GetRgnBox(hrgn, &rc);
6019  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
6020  ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
6021  "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc));
6022  DeleteObject(hrgn);
6023 
6024  ptf[0].X = 100.0;
6025  ptf[0].Y = 100.0;
6026  ptf[1].X = 200.0;
6027  ptf[1].Y = 200.0;
6028  ptf[2].X = 200.0;
6029  ptf[2].Y = 100.0;
6030  ptf[3].X = 100.0;
6031  ptf[3].Y = 200.0;
6033  expect(Ok, status);
6034  expectf(0.0, ptf[0].X);
6035  expectf(53.033005, ptf[0].Y);
6036  expectf(0.0, ptf[1].X);
6037  expectf(106.066010, ptf[1].Y);
6038  expectf(26.516491, ptf[2].X);
6039  expectf(79.549507, ptf[2].Y);
6040  expectf(-26.516520, ptf[3].X);
6041  expectf(79.549500, ptf[3].Y);
6042 
6043  GdipDeleteRegion(region);
6044  GdipDeleteGraphics(graphics);
6045  DeleteDC(hdc);
6046 }
GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region, GDIPCONST GpRectF *rect, CombineMode mode)
Definition: region.c:278
GpStatus WINGDIPAPI GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix)
Definition: graphics.c:6358
#define expectf(expected, got)
Definition: graphics.c:30
#define Y(I)
Unit
Definition: gdiplusenums.h:25
GLuint GLenum matrix
Definition: glext.h:9407
GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hrgn)
Definition: region.c:1194
GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
Definition: matrix.c:140
static HDC
Definition: imagelist.c:92
#define COMPLEXREGION
Definition: wingdi.h:362
LONG top
Definition: windef.h:307
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
GpStatus WINGDIPAPI GdipSetEmpty(GpRegion *region)
Definition: region.c:1359
& rect
Definition: startmenu.cpp:1413
GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region)
Definition: graphics.c:6809
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
Definition: graphics.c:6202
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
Definition: region.c:390
const char * wine_dbgstr_rect(const RECT *rect)
REAL Y
Definition: gdiplustypes.h:249
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:258
#define expect(expected, got)
Definition: graphics.c:28
int ret
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
Definition: matrix.c:160
HDC hdc
Definition: main.c:9
static HRGN hrgn
Definition: win.c:55
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:289
REAL X
Definition: gdiplustypes.h:248
#define broken(x)
Definition: _sntprintf.h:21
GpStatus WINGDIPAPI GdipGetPageUnit(GpGraphics *graphics, GpUnit *unit)
Definition: graphics.c:4927
Status
Definition: gdiplustypes.h:24
int WINAPI GetRgnBox(_In_ HRGN, _Out_ LPRECT)
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define SIMPLEREGION
Definition: wingdi.h:361
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:418
BOOL WINAPI DeleteDC(_In_ HDC)
GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, CombineMode mode)
Definition: graphics.c:6533
#define ok(value,...)
Definition: atltest.h:57
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
LONG bottom
Definition: windef.h:309
GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale)
Definition: graphics.c:6178
static SERVICE_STATUS status
Definition: service.c:31
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
Definition: region.c:571
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6960
Definition: ps.c:97

Referenced by START_TEST().

◆ test_constructor_destructor()

static void test_constructor_destructor ( void  )
static

Definition at line 139 of file graphics.c.

140 {
141  GpStatus stat;
142  GpGraphics *graphics = NULL;
143  HDC hdc = GetDC( hwnd );
144 
145  stat = GdipCreateFromHDC(NULL, &graphics);
147  stat = GdipDeleteGraphics(graphics);
149 
150  stat = GdipCreateFromHDC(hdc, &graphics);
151  expect(Ok, stat);
152  stat = GdipDeleteGraphics(graphics);
153  expect(Ok, stat);
154 
155  stat = GdipCreateFromHWND(NULL, &graphics);
156  expect(Ok, stat);
157  stat = GdipDeleteGraphics(graphics);
158  expect(Ok, stat);
159 
160  stat = GdipCreateFromHWNDICM(NULL, &graphics);
161  expect(Ok, stat);
162  stat = GdipDeleteGraphics(graphics);
163  expect(Ok, stat);
164 
167  ReleaseDC(hwnd, hdc);
168 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HDC WINAPI GetDC(_In_opt_ HWND)
GpStatus WINGDIPAPI GdipCreateFromHWNDICM(HWND hwnd, GpGraphics **graphics)
Definition: graphics.c:2551
static HDC
Definition: imagelist.c:92
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics)
Definition: graphics.c:2529
#define expect(expected, got)
Definition: graphics.c:28
HDC hdc
Definition: main.c:9
Definition: stat.h:55
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395

Referenced by START_TEST().

◆ test_container_rects()

static void test_container_rects ( void  )
static

Definition at line 6149 of file graphics.c.

6150 {
6151  GpStatus status;
6152  GpGraphics *graphics;
6153  HDC hdc = GetDC( hwnd );
6154  GpRectF dstrect, srcrect;
6156  static const GpPointF test_points[3] = {{0.0,0.0}, {1.0,0.0}, {0.0,1.0}};
6157  GpPointF points[3];
6158  REAL dpix, dpiy;
6159 
6160  status = GdipCreateFromHDC(hdc, &graphics);
6161  expect(Ok, status);
6162 
6163  dstrect.X = 0.0;
6164  dstrect.Y = 0.0;
6165  dstrect.Width = 1.0;
6166  dstrect.Height = 1.0;
6167  srcrect = dstrect;
6168 
6169  status = GdipGetDpiX(graphics, &dpix);
6170  expect(Ok, status);
6171 
6172  status = GdipGetDpiY(graphics, &dpiy);
6173  expect(Ok, status);
6174 
6175  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitWorld, &state);
6177 
6178  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitDisplay, &state);
6180 
6181  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitMillimeter+1, &state);
6183 
6184  status = GdipBeginContainer(NULL, &dstrect, &srcrect, UnitPixel, &state);
6186 
6187  status = GdipBeginContainer(graphics, NULL, &srcrect, UnitPixel, &state);
6189 
6190  status = GdipBeginContainer(graphics, &dstrect, NULL, UnitPixel, &state);
6192 
6193  status = GdipBeginContainer(graphics, &dstrect, &srcrect, -1, &state);
6195 
6196  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitPixel, NULL);
6198 
6199  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitPixel, &state);
6200  expect(Ok, status);
6201 
6202  memcpy(points, test_points, sizeof(points));
6204  expect(Ok, status);
6205  expectf(0.0, points[0].X);
6206  expectf(0.0, points[0].Y);
6207  expectf(1.0, points[1].X);
6208  expectf(0.0, points[1].Y);
6209  expectf(0.0, points[2].X);
6210  expectf(1.0, points[2].Y);
6211 
6212  status = GdipEndContainer(graphics, state);
6213  expect(Ok, status);
6214 
6215  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitInch, &state);
6216  expect(Ok, status);
6217 
6218  memcpy(points, test_points, sizeof(points));
6220  expect(Ok, status);
6221  expectf(0.0, points[0].X);
6222  expectf(0.0, points[0].Y);
6223  expectf(1.0/dpix, points[1].X);
6224  expectf(0.0, points[1].Y);
6225  expectf(0.0, points[2].X);
6226  expectf(1.0/dpiy, points[2].Y);
6227 
6228  status = GdipEndContainer(graphics, state);
6229  expect(Ok, status);
6230 
6231  status = GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
6232  expect(Ok, status);
6233 
6234  dstrect.X = 1.0;
6235  dstrect.Height = 3.0;
6236  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitPixel, &state);
6237  expect(Ok, status);
6238 
6239  memcpy(points, test_points, sizeof(points));
6241  expect(Ok, status);
6242  expectf(2.0, points[0].X);
6243  expectf(0.0, points[0].Y);
6244  expectf(4.0, points[1].X);
6245  expectf(0.0, points[1].Y);
6246  expectf(2.0, points[2].X);
6247  expectf(6.0, points[2].Y);
6248 
6249  status = GdipEndContainer(graphics, state);
6250  expect(Ok, status);
6251 
6252  memcpy(points, test_points, sizeof(points));
6254  expect(Ok, status);
6255  expectf(0.0, points[0].X);
6256  expectf(0.0, points[0].Y);
6257  expectf(2.0, points[1].X);
6258  expectf(0.0, points[1].Y);
6259  expectf(0.0, points[2].X);
6260  expectf(2.0, points[2].Y);
6261 
6262  status = GdipResetWorldTransform(graphics);
6263  expect(Ok, status);
6264 
6265  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitInch, &state);
6266  expect(Ok, status);
6267 
6268  memcpy(points, test_points, sizeof(points));
6270  expect(Ok, status);
6271  expectf(1.0, points[0].X);
6272  expectf(0.0, points[0].Y);
6273  expectf((dpix+1.0)/dpix, points[1].X);
6274  expectf(0.0, points[1].Y);
6275  expectf(1.0, points[2].X);
6276  expectf(3.0/dpiy, points[2].Y);
6277 
6278  status = GdipEndContainer(graphics, state);
6279  expect(Ok, status);
6280 
6281  status = GdipSetPageUnit(graphics, UnitInch);
6282  expect(Ok, status);
6283 
6284  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitPixel, &state);
6285  expect(Ok, status);
6286 
6287  memcpy(points, test_points, sizeof(points));
6289  expect(Ok, status);
6290  expectf(dpix, points[0].X);
6291  expectf(0.0, points[0].Y);
6292  expectf(dpix*2, points[1].X);
6293  expectf(0.0, points[1].Y);
6294  expectf(dpix, points[2].X);
6295  expectf(dpiy*3, points[2].Y);
6296 
6297  status = GdipEndContainer(graphics, state);
6298  expect(Ok, status);
6299 
6300  status = GdipBeginContainer(graphics, &dstrect, &srcrect, UnitInch, &state);
6301  expect(Ok, status);
6302 
6303  memcpy(points, test_points, sizeof(points));
6305  expect(Ok, status);
6306  expectf(dpix, points[0].X);
6307  expectf(0.0, points[0].Y);
6308  expectf(dpix+1.0, points[1].X);
6309  expectf(0.0, points[1].Y);
6310  expectf(dpix, points[2].X);
6311  expectf(3.0, points[2].Y);
6312 
6313  status = GdipEndContainer(graphics, state);
6314  expect(Ok, status);
6315 
6316  GdipDeleteGraphics(graphics);
6317 
6318  ReleaseDC(hwnd, hdc);
6319 }
GpStatus WINGDIPAPI GdipGetDpiY(GpGraphics *graphics, REAL *dpi)
Definition: graphics.c:6635
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define expectf(expected, got)
Definition: graphics.c:30
GpStatus WINGDIPAPI GdipResetWorldTransform(GpGraphics *graphics)
Definition: graphics.c:5840
GpStatus WINGDIPAPI GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, GpMatrixOrder order)
Definition: graphics.c:6051
#define Y(I)
GpStatus WINGDIPAPI GdipGetDpiX(GpGraphics *graphics, REAL *dpi)
Definition: graphics.c:6621
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
UINT GraphicsContainer
Definition: gdiplusenums.h:23
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
Definition: graphics.c:6202
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
REAL Height
Definition: gdiplustypes.h:264
GpStatus WINGDIPAPI GdipEndContainer(GpGraphics *graphics, GraphicsContainer state)
Definition: graphics.c:6039
REAL X
Definition: gdiplustypes.h:261
#define expect(expected, got)
Definition: graphics.c:28
GLsizei const GLfloat * points
Definition: glext.h:8112
HDC hdc
Definition: main.c:9
static int state
Definition: maze.c:121
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Status
Definition: gdiplustypes.h:24
REAL Width
Definition: gdiplustypes.h:263
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
float REAL
Definition: types.h:41
REAL Y
Definition: gdiplustypes.h:262
static SERVICE_STATUS status
Definition: service.c:31
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6960
GpStatus WINGDIPAPI GdipBeginContainer(GpGraphics *graphics, GDIPCONST GpRectF *dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state)
Definition: graphics.c:5924
Definition: ps.c:97

Referenced by START_TEST().

◆ test_font_height_scaling()

static void test_font_height_scaling ( void  )
static

Definition at line 4260 of file graphics.c.

4261 {
4262  static const WCHAR tahomaW[] = { 'T','a','h','o','m','a',0 };
4263  static const WCHAR string[] = { '1','2','3','4','5','6','7',0 };
4264  HDC hdc;
4266  CharacterRange range = { 0, 7 };
4267  GpRegion *region;
4268  GpGraphics *graphics;
4269  GpFontFamily *family;
4270  GpFont *font;
4271  GpStatus status;
4272  RectF bounds, rect;
4273  REAL height, dpi, scale;
4274  PointF ptf;
4275  GpUnit gfx_unit, font_unit;
4276 
4278  expect(Ok, status);
4280  expect(Ok, status);
4281  status = GdipCreateRegion(&region);
4282  expect(Ok, status);
4283 
4284  status = GdipCreateFontFamilyFromName(tahomaW, NULL, &family);
4285  expect(Ok, status);
4286 
4287  hdc = CreateCompatibleDC(0);
4288  status = GdipCreateFromHDC(hdc, &graphics);
4289  expect(Ok, status);
4290 
4291  status = GdipGetDpiY(graphics, &dpi);
4292  expect(Ok, status);
4293 
4294  /* First check if tested functionality works:
4295  * under XP if font and graphics units differ then GdipTransformPoints
4296  * followed by GdipSetPageUnit to change the graphics units breaks region
4297  * scaling in GdipMeasureCharacterRanges called later.
4298  */
4299  status = GdipSetPageUnit(graphics, UnitDocument);
4300  expect(Ok, status);
4301 
4302  ptf.X = 0.0;
4303  ptf.Y = 0.0;
4305  expect(Ok, status);
4306 
4307  status = GdipSetPageUnit(graphics, UnitInch);
4308  expect(Ok, status);
4309 
4310  status = GdipCreateFont(family, 720.0, FontStyleRegular, UnitPoint, &font);
4311  expect(Ok, status);
4312 
4313  set_rect_empty(&rect);
4314  set_rect_empty(&bounds);
4315  status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
4316  expect(Ok, status);
4317  trace("test bounds: %f,%f,%f,%f\n", bounds.X, bounds.Y, bounds.Width, bounds.Height);
4318 
4319  set_rect_empty(&rect);
4320  rect.Width = 32000.0;
4321  rect.Height = 32000.0;
4322  status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
4323  expect(Ok, status);
4324 
4325  set_rect_empty(&rect);
4326  status = GdipGetRegionBounds(region, graphics, &rect);
4327  expect(Ok, status);
4328  trace("test region: %f,%f,%f,%f\n", rect.X, rect.Y, rect.Width, rect.Height);
4329 
4331 
4332  scale = rect.Height / bounds.Height;
4333  if (fabs(scale - 1.0) > 0.1)
4334  {
4335  win_skip("GdipGetRegionBounds is broken, scale %f (should be near 1.0)\n", scale);
4336  goto cleanup;
4337  }
4338 
4339  status = GdipScaleWorldTransform(graphics, 0.01, 0.01, MatrixOrderAppend);
4340  expect(Ok, status);
4341 
4342  /* UnitPixel = 2, UnitPoint = 3, UnitInch = 4, UnitDocument = 5, UnitMillimeter = 6 */
4343  /* UnitPixel as a font base unit is not tested because it drastically
4344  differs in behaviour */
4345  for (font_unit = 3; font_unit <= 6; font_unit++)
4346  {
4347  /* create a font for the final text height of 100 pixels */
4348  /* height + 2 * (height/6) = 100 => height = 100 * 3 / 4 => 75 */
4349  status = GdipSetPageUnit(graphics, font_unit);
4350  expect(Ok, status);
4351  ptf.X = 0;
4352  ptf.Y = 75.0;
4354  expect(Ok, status);
4355  height = ptf.Y;
4356  /*trace("height %f units\n", height);*/
4357  status = GdipCreateFont(family, height, FontStyleRegular, font_unit, &font);
4358  expect(Ok, status);
4359 
4360  /* UnitPixel = 2, UnitPoint = 3, UnitInch = 4, UnitDocument = 5, UnitMillimeter = 6 */
4361  for (gfx_unit = 2; gfx_unit <= 6; gfx_unit++)
4362  {
4363  static const WCHAR doubleW[2] = { 'W','W' };
4364  RectF bounds_1, bounds_2;
4365  REAL margin, margin_y, font_height;
4366  int match;
4367 
4368  status = GdipSetPageUnit(graphics, gfx_unit);
4369  expect(Ok, status);
4370 
4371  margin_y = units_to_pixels(height / 8.0, font_unit, dpi);
4372  margin_y = pixels_to_units(margin_y, gfx_unit, dpi);
4373 
4374  status = GdipGetFontHeight(font, graphics, &font_height);
4375  expect(Ok, status);
4376 
4377  set_rect_empty(&rect);
4378  set_rect_empty(&bounds);
4379  status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
4380  expect(Ok, status);
4381  /*trace("bounds: %f,%f,%f,%f\n", bounds.X, bounds.Y, bounds.Width, bounds.Height);*/
4382 todo_wine
4383  expectf_(font_height + margin_y, bounds.Height, 0.005);
4384 
4385  ptf.X = 0;
4386  ptf.Y = bounds.Height;
4388  expect(Ok, status);
4389  match = fabs(100.0 - ptf.Y) <= 1.0;
4390 todo_wine
4391  ok(match, "Expected 100.0, got %f\n", ptf.Y);
4392 
4393  /* verify the result */
4394  ptf.Y = units_to_pixels(bounds.Height, gfx_unit, dpi);
4395  ptf.Y /= 100.0;
4396  match = fabs(100.0 - ptf.Y) <= 1.0;
4397 todo_wine
4398  ok(match, "Expected 100.0, got %f\n", ptf.Y);
4399 
4400  /* bounds.width of 1 glyph: [margin]+[width]+[margin] */
4401  set_rect_empty(&rect);
4402  set_rect_empty(&bounds_1);
4403  status = GdipMeasureString(graphics, doubleW, 1, font, &rect, format, &bounds_1, NULL, NULL);
4404  expect(Ok, status);
4405  /* bounds.width of 2 identical glyphs: [margin]+[width]+[width]+[margin] */
4406  set_rect_empty(&rect);
4407  set_rect_empty(&bounds_2);
4408  status = GdipMeasureString(graphics, doubleW, 2, font, &rect, format, &bounds_2, NULL, NULL);
4409  expect(Ok, status);
4410 
4411  /* margin = [bounds.width of 1] - [bounds.width of 2] / 2*/
4412  margin = bounds_1.Width - bounds_2.Width / 2.0;
4413  /*trace("margin %f\n", margin);*/
4414  ok(margin > 0.0, "wrong margin %f\n", margin);
4415 
4416  set_rect_empty(&rect);
4417  rect.Width = 320000.0;
4418  rect.Height = 320000.0;
4419  status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
4420  expect(Ok, status);
4421  set_rect_empty(&rect);
4422  status = GdipGetRegionBounds(region, graphics, &rect);
4423  expect(Ok, status);
4424  /*trace("region: %f,%f,%f,%f\n", rect.X, rect.Y, rect.Width, rect.Height);*/
4425  ok(rect.X > 0.0, "wrong rect.X %f\n", rect.X);
4426  expectf(0.0, rect.Y);
4427  match = fabs(1.0 - margin / rect.X) <= 0.05;
4428  ok(match, "Expected %f, got %f\n", margin, rect.X);
4429  match = fabs(1.0 - font_height / rect.Height) <= 0.1;
4430  ok(match, "Expected %f, got %f\n", font_height, rect.Height);
4431  match = fabs(1.0 - bounds.Width / (rect.Width + margin * 2.0)) <= 0.05;
4432  ok(match, "Expected %f, got %f\n", bounds.Width, rect.Width + margin * 2.0);
4433  }
4434 
4436  }
4437 
4438 cleanup:
4439  status = GdipDeleteGraphics(graphics);
4440  expect(Ok, status);
4441  DeleteDC(hdc);
4442 
4443  GdipDeleteFontFamily(family);
4444  GdipDeleteRegion(region);
4446 }
GpStatus WINGDIPAPI GdipGetDpiY(GpGraphics *graphics, REAL *dpi)
Definition: graphics.c:6635
GpStatus WINGDIPAPI GdipDeleteFont(GpFont *font)
Definition: font.c:270
GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges(GpStringFormat *format, INT rangeCount, GDIPCONST CharacterRange *ranges)
Definition: stringformat.c:290
#define expectf(expected, got)
Definition: graphics.c:30
GpStatus WINGDIPAPI GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, GpMatrixOrder order)
Definition: graphics.c:6051
Unit
Definition: gdiplusenums.h:25
static void set_rect_empty(RectF *rc)
Definition: graphics.c:38
Definition: mk_font.cpp:20
GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, INT regionCount, GpRegion **regions)
Definition: graphics.c:5423
Definition: match.c:28
#define LANG_NEUTRAL
Definition: nls.h:22
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
static HDC
Definition: imagelist.c:92
static REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi)
Definition: graphics.c:69
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
& rect
Definition: startmenu.cpp:1413
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
Definition: graphics.c:47
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
Definition: graphics.c:6202
GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily, REAL emSize, INT style, Unit unit, GpFont **font)
Definition: font.c:144
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, RectF *bounds, INT *codepointsfitted, INT *linesfilled)
Definition: graphics.c:5546
smooth NULL
Definition: ftsmooth.c:416
struct match match
Definition: match.c:33
REAL Height
Definition: gdiplustypes.h:264
GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, GpFontCollection *fontCollection, GpFontFamily **FontFamily)
Definition: font.c:746
GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
Definition: stringformat.c:105
#define dpi
Definition: sysparams.c:22
GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
Definition: region.c:390
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
REAL X
Definition: gdiplustypes.h:261
REAL Y
Definition: gdiplustypes.h:249
GpStatus WINGDIPAPI GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height)
Definition: font.c:552
#define expect(expected, got)
Definition: graphics.c:28
GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
Definition: font.c:869
#define todo_wine
Definition: test.h:163
HDC hdc
Definition: main.c:9
REAL X
Definition: gdiplustypes.h:248
static int font_height(HFONT hFont)
Definition: combo.c:612
GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect)
Definition: region.c:587
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLenum GLint * range
Definition: glext.h:7539
Status
Definition: gdiplustypes.h:24
REAL Width
Definition: gdiplustypes.h:263
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
BOOL WINAPI DeleteDC(_In_ HDC)
#define expectf_(expected, got, precision)
Definition: graphics.c:29
#define ok(value,...)
Definition: atltest.h:57
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
char * cleanup(char *str)
Definition: wpickclick.c:99
float REAL
Definition: types.h:41
REAL Y
Definition: gdiplustypes.h:262
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:150
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
Definition: region.c:571
GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count)
Definition: graphics.c:6960
GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang, GpStringFormat **format)
Definition: stringformat.c:76
Definition: ps.c:97

Referenced by START_TEST().

◆ test_fromMemoryBitmap()

static void test_fromMemoryBitmap ( void  )
static

Definition at line 2592 of file graphics.c.

2593 {
2594  GpStatus status;
2595  GpGraphics *graphics = NULL;
2596  GpBitmap *bitmap = NULL;
2597  BYTE bits[48] = {0};
2598  HDC hdc=NULL;
2599  COLORREF color;
2600 
2602  expect(Ok, status);
2603 
2605  expect(Ok, status);
2606 
2607  status = GdipGraphicsClear(graphics, 0xff686868);
2608  expect(Ok, status);
2609 
2610  GdipDeleteGraphics(graphics);
2611 
2612  /* drawing writes to the memory provided */
2613  expect(0x68, bits[10]);
2614