ReactOS 0.4.17-dev-116-ga4b6fe9
metafile.c File Reference
#include <assert.h>
#include <stdio.h>
#include <math.h>
#include "wine/test.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
Include dependency graph for metafile.c:

Go to the source code of this file.

Classes

struct  eto_scale_test_record
 
struct  check_mf_arg
 
struct  emf_WorldTransform_test_data
 

Macros

#define LINE_X   55.0f
 
#define LINE_Y   15.0f
 
#define GDI_GET_PROC(func)
 
#define MF_BUFSIZE   2048
 

Functions

static INT (WINAPI *pGetRelAbs)(HDC
 
static COLORREF (WINAPI *pSetDCBrushColor)(HDC
 
static void init_function_pointers (void)
 
static int CALLBACK eto_emf_enum_proc (HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param)
 
static void test_ExtTextOut (void)
 
static int CALLBACK eto_scale_enum_proc (HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param)
 
static void test_ExtTextOutScale (void)
 
static void check_dc_state (HDC hdc, int restore_no, int wnd_org_x, int wnd_org_y, int wnd_ext_x, int wnd_ext_y, int vp_org_x, int vp_org_y, int vp_ext_x, int vp_ext_y)
 
static int CALLBACK savedc_emf_enum_proc (HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param)
 
static void test_SaveDC (void)
 
static void test_mf_SaveDC (void)
 
static INT CALLBACK mf_enum_proc (HDC hdc, HANDLETABLE *ht, METARECORD *mr, INT nobj, LPARAM param)
 
static void dump_mf_bits (const HMETAFILE mf, const char *desc)
 
static int compare_mf_bits (const HMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc)
 
static int compare_mf_disk_bits (LPCSTR name, const BYTE *bits, UINT bsize, const char *desc)
 
static void dump_emf_bits (const HENHMETAFILE mf, const char *desc)
 
static void dump_emf_records (const HENHMETAFILE mf, const char *desc)
 
static void dump_emf_record (const ENHMETARECORD *emr, const char *desc)
 
static void dump_EMREXTTEXTOUT (const EMREXTTEXTOUTW *eto)
 
static BOOL match_emf_record (const ENHMETARECORD *emr1, const ENHMETARECORD *emr2, const char *desc, BOOL ignore_scaling)
 
static int compare_emf_bits (const HENHMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc, BOOL ignore_scaling)
 
static void test_emf_BitBlt (void)
 
static void test_emf_DCBrush (void)
 
static void test_mf_Blank (void)
 
static void test_metafile_file (void)
 
static void test_mf_SetPixel (void)
 
static void test_mf_attrs (void)
 
static void test_enhmetafile_file (void)
 
static void test_emf_SetPixel (void)
 
static void test_emf_attrs (void)
 
static void test_CopyMetaFile (void)
 
static void test_SetMetaFileBits (void)
 
static void test_mf_Graphics (void)
 
static void test_mf_FloodFill (void)
 
static void test_mf_PatternBrush (void)
 
static int CALLBACK pattern_brush_emf_enum_proc (HDC hdc, HANDLETABLE *htable, const ENHMETARECORD *rec, int n, LPARAM arg)
 
static void test_emf_pattern_brush (void)
 
static void test_mf_palette_brush (void)
 
static void test_mf_DCBrush (void)
 
static void test_mf_select (void)
 
static void test_emf_select (void)
 
static void test_mf_palette (void)
 
static void test_emf_palette (void)
 
static void test_mf_blit (void)
 
static void test_emf_blit (void)
 
static int WINAPI check_mf_records (HDC hdc, HANDLETABLE *htable, METARECORD *rec, int n, LPARAM ctx)
 
static void test_PlayMetaFile (void)
 
static void test_emf_mask_blit (void)
 
static void test_emf_StretchDIBits (void)
 
static void test_emf_SetDIBitsToDevice (void)
 
static void test_mf_ExtTextOut_on_path (void)
 
static void test_emf_ExtTextOut_on_path (void)
 
static void translate (POINT *pt, UINT count, const XFORM *xform)
 
static BOOL is_equal_rect (const RECT *rc1, const RECT *rc2)
 
static int CALLBACK clip_emf_enum_proc (HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param)
 
static void test_emf_clipping (void)
 
static int CALLBACK clip_mf_enum_proc (HDC hdc, HANDLETABLE *handle_table, METARECORD *mr, int n_objs, LPARAM param)
 
static void test_mf_clipping (void)
 
static void test_mf_GetPath (void)
 
static INT CALLBACK EmfEnumProc (HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData)
 
static HENHMETAFILE create_converted_emf (const METAFILEPICT *mfp)
 
static void test_mf_conversions (void)
 
static BOOL getConvertedFrameAndBounds (UINT buffer_size, BYTE *buffer, BOOL mfpIsNull, LONG mm, LONG xExt, LONG yExt, RECTL *rclBounds, RECTL *rclFrame)
 
static void checkConvertedFrameAndBounds (UINT buffer_size, BYTE *buffer, BOOL mfpIsNull, LONG mm, LONG xExt, LONG yExt, RECTL *rclBoundsExpected, RECTL *rclFrameExpected)
 
static void test_SetWinMetaFileBits (void)
 
static BOOL near_match (int x, int y)
 
static void getwinmetafilebits (UINT mode, int scale, RECT *rc)
 
static void test_GetWinMetaFileBits (void)
 
static BOOL (WINAPI *pGdiIsMetaPrintDC)(HDC)
 
static void test_gdiis (void)
 
static void test_SetEnhMetaFileBits (void)
 
static void test_emf_polybezier (void)
 
static void test_emf_paths (void)
 
static void test_emf_PolyPolyline (void)
 
static void test_emf_GradientFill (void)
 
static void set_rotation_xform (XFORM *out, float rad, int dx, int dy)
 
static BOOL xform_eq (const XFORM *a, const XFORM *b)
 
static INT CALLBACK enum_emf_WorldTransform (HDC hdc, HANDLETABLE *ht, const ENHMETARECORD *emr, INT nobj, LPARAM param)
 
static void test_emf_WorldTransform (void)
 
static void test_emf_AlphaBlend (void)
 
static void test_emf_text_extents (void)
 
static void test_mf_SetLayout (void)
 
 START_TEST (metafile)
 

Variables

static LOGFONTA orig_lf
 
static BOOL emr_processed = FALSE
 
static DWORD
 
static INT
 
static COLORREF
 
static const unsigned char SAMPLE_PATTERN_BRUSH []
 
static const unsigned char MF_BLANK_BITS []
 
static const unsigned char MF_GRAPHICS_BITS []
 
static const unsigned char MF_PATTERN_BRUSH_BITS []
 
static const unsigned char MF_DCBRUSH_BITS []
 
static const unsigned char MF_TEXTOUT_ON_PATH_BITS []
 
static const unsigned char EMF_TEXTOUT_ON_PATH_BITS []
 
static const unsigned char EMF_TEXTOUT_OUTLINE_ON_PATH_BITS []
 
static const unsigned char MF_LINETO_BITS []
 
static const unsigned char EMF_LINETO_BITS []
 
static const unsigned char EMF_LINETO_MM_ANISOTROPIC_BITS []
 
static const unsigned char EMF_LINETO_MM_TEXT_BITS []
 
static const unsigned char EMF_DCBRUSH_BITS []
 
static const unsigned char EMF_BEZIER_BITS []
 
static const unsigned char EMF_POLYPOLYLINE_BITS []
 
static const unsigned char EMF_GRADIENTFILL_BITS []
 
static const unsigned char emf_pattern_brush_bits []
 
static const unsigned char mf_palette_brush_bits []
 
static const unsigned char emf_blit_bits []
 
static const unsigned char emf_mask_blit_bits []
 
static const unsigned char EMF_STRETCHBLT_1BIT_3X3 []
 
static const unsigned char EMF_STRETCHBLT_4BIT_3X3 []
 
static const unsigned char EMF_STRETCHBLT_8BIT_3X3 []
 
static const unsigned char EMF_STRETCHBLT_16BIT_555_3X3 []
 
static const unsigned char EMF_STRETCHBLT_24BIT_3X3 []
 
static const unsigned char EMF_STRETCHBLT_32BIT_888_3X3 []
 
static const unsigned char EMF_STRETCHBLT_16BIT_3X3 []
 
static const unsigned char EMF_STRETCHBLT_32BIT_3X3 []
 
static const unsigned char EMF_BITBLT_1BIT_4X4 []
 
static const unsigned char EMF_BITBLT_4BIT_4X4 []
 
static const unsigned char EMF_BITBLT_8BIT_4X4 []
 
static const unsigned char EMF_BITBLT_16BIT_555_4X4 []
 
static const unsigned char EMF_BITBLT_24BIT_4X4 []
 
static const unsigned char EMF_BITBLT_32BIT_888_4X4 []
 
static const unsigned char EMF_BITBLT_16BIT_4X4 []
 
static const unsigned char EMF_BITBLT_32BIT_4X4 []
 
static const PALETTEENTRY logpalettedata [8]
 
static const unsigned char EMF_STRETCHDIBITS_1BIT_3X3_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_1BIT_3X3_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_4BIT_3X3_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_4BIT_3X3_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_8BIT_3X3_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_8BIT_3X3_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_16BIT_555_3X3_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_16BIT_555_3X3_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_24BIT_3X3_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_24BIT_3X3_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_32BIT_888_3X3_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_32BIT_888_3X3_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_16BIT_3X3_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_16BIT_3X3_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_32BIT_3X3_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_32BIT_3X3_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_1BIT_4X4_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_1BIT_4X4_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_4BIT_4X4_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_4BIT_4X4_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_8BIT_4X4_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_8BIT_4X4_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_16BIT_555_4X4_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_16BIT_555_4X4_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_24BIT_4X4_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_24BIT_4X4_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_32BIT_888_4X4_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_32BIT_888_4X4_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_16BIT_4X4_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_16BIT_4X4_SIZED []
 
static const unsigned char EMF_STRETCHDIBITS_32BIT_4X4_NOSIZE []
 
static const unsigned char EMF_STRETCHDIBITS_32BIT_4X4_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_1BIT_3X3_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_1BIT_3X3_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_4BIT_3X3_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_4BIT_3X3_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_8BIT_3X3_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_8BIT_3X3_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_3X3_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_3X3_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_24BIT_3X3_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_24BIT_3X3_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_3X3_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_3X3_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_3X3_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_3X3_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_3X3_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_3X3_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_1BIT_4X4_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_1BIT_4X4_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_4BIT_4X4_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_4BIT_4X4_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_8BIT_4X4_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_8BIT_4X4_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_4X4_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_4X4_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_24BIT_4X4_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_24BIT_4X4_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_4X4_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_4X4_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_4X4_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_4X4_SIZED []
 
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_4X4_NOSIZE []
 
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_4X4_SIZED []
 
static const unsigned char EMF_EMPTY_BITS []
 
static const unsigned char EMF_CLIPPING []
 
static const unsigned char MF_CLIP_BITS []
 
static int clip_mf_enum_proc_seen_selectclipregion
 
static int clip_mf_enum_proc_seen_selectobject
 
static const unsigned char MF_PATH_BITS []
 
static const unsigned char EMF_PATH_BITS []
 
static const unsigned char EMF_EMPTY_PATH_BITS []
 
static const unsigned char EMF_ALPHABLEND_1BIT []
 
static const unsigned char EMF_ALPHABLEND_4BIT []
 
static const unsigned char EMF_ALPHABLEND_8BIT []
 
static const unsigned char EMF_ALPHABLEND_16BIT []
 
static const unsigned char EMF_ALPHABLEND_16BIT_555 []
 
static const unsigned char EMF_ALPHABLEND_24BIT []
 
static const unsigned char EMF_ALPHABLEND_32BIT_888 []
 
static const unsigned char EMF_ALPHABLEND_32BIT []
 
static const unsigned char MF_SETLAYOUT_BITS []
 

Macro Definition Documentation

◆ GDI_GET_PROC

#define GDI_GET_PROC (   func)
Value:
p ## func = (void *)GetProcAddress(hGDI, #func); \
if(!p ## func) \
trace("GetProcAddress(hGDI, \"%s\") failed\n", #func); \
#define GetProcAddress(x, y)
Definition: compat.h:753
GLenum func
Definition: glext.h:6028
GLfloat GLfloat p
Definition: glext.h:8902

Definition at line 43 of file metafile.c.

◆ LINE_X

#define LINE_X   55.0f

Definition at line 35 of file metafile.c.

◆ LINE_Y

#define LINE_Y   15.0f

Definition at line 36 of file metafile.c.

◆ MF_BUFSIZE

#define MF_BUFSIZE   2048

Definition at line 1007 of file metafile.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pGdiIsMetaPrintDC)
static

◆ check_dc_state()

static void check_dc_state ( HDC  hdc,
int  restore_no,
int  wnd_org_x,
int  wnd_org_y,
int  wnd_ext_x,
int  wnd_ext_y,
int  vp_org_x,
int  vp_org_y,
int  vp_ext_x,
int  vp_ext_y 
)
static

Definition at line 440 of file metafile.c.

443{
444 BOOL ret;
445 XFORM xform;
446 FLOAT xscale, yscale, edx, edy;
447
448 SetLastError(0xdeadbeef);
449 ret = GetWorldTransform(hdc, &xform);
450 ok(ret, "GetWorldTransform error %lu\n", GetLastError());
451
452 if (winetest_debug > 1)
453 trace("%d: eM11 %f, eM22 %f, eDx %f, eDy %f\n", restore_no, xform.eM11,
454 xform.eM22, xform.eDx, xform.eDy);
455
456 ok(xform.eM12 == 0.0, "%d: expected eM12 0.0, got %f\n", restore_no, xform.eM12);
457 ok(xform.eM21 == 0.0, "%d: expected eM21 0.0, got %f\n", restore_no, xform.eM21);
458
459 xscale = (FLOAT)vp_ext_x / (FLOAT)wnd_ext_x;
460 if (winetest_debug > 1) trace("x scale %f\n", xscale);
461 ok(fabs(xscale - xform.eM11) < 0.01, "%d: vp_ext_x %d, wnd_ext_cx %d, eM11 %f\n",
462 restore_no, vp_ext_x, wnd_ext_x, xform.eM11);
463
464 yscale = (FLOAT)vp_ext_y / (FLOAT)wnd_ext_y;
465 if (winetest_debug > 1) trace("y scale %f\n", yscale);
466 ok(fabs(yscale - xform.eM22) < 0.01, "%d: vp_ext_y %d, wnd_ext_y %d, eM22 %f\n",
467 restore_no, vp_ext_y, wnd_ext_y, xform.eM22);
468
469 edx = (FLOAT)vp_org_x - xform.eM11 * (FLOAT)wnd_org_x;
470 ok(fabs(edx - xform.eDx) < 0.01, "%d: edx %f != eDx %f\n", restore_no, edx, xform.eDx);
471 edy = (FLOAT)vp_org_y - xform.eM22 * (FLOAT)wnd_org_y;
472 ok(fabs(edy - xform.eDy) < 0.01, "%d: edy %f != eDy %f\n", restore_no, edy, xform.eDy);
473}
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define SetLastError(x)
Definition: compat.h:752
_ACRTIMP double __cdecl fabs(double)
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FLOAT
Definition: i386-dis.c:525
int winetest_debug
HDC hdc
Definition: main.c:9
FLOAT eDy
Definition: wingdi.h:2172
FLOAT eM11
Definition: wingdi.h:2167
FLOAT eM21
Definition: wingdi.h:2169
FLOAT eM22
Definition: wingdi.h:2170
FLOAT eM12
Definition: wingdi.h:2168
FLOAT eDx
Definition: wingdi.h:2171
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx
Definition: synth_sse3d.h:87
float FLOAT
Definition: typedefs.h:69
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
BOOL WINAPI GetWorldTransform(_In_ HDC, _Out_ LPXFORM)
Definition: coord.c:278

Referenced by savedc_emf_enum_proc().

◆ check_mf_records()

static int WINAPI check_mf_records ( HDC  hdc,
HANDLETABLE htable,
METARECORD rec,
int  n,
LPARAM  ctx 
)
static

Definition at line 5103 of file metafile.c.

5105{
5106 struct check_mf_arg *records = (struct check_mf_arg *)ctx;
5107
5108 ok(rec->rdFunction == records->records[records->pos], "got record %x, expected %x\n",
5109 rec->rdFunction, records->records[records->pos]);
5110 return rec->rdFunction == records->records[records->pos++];
5111}
const WORD * records
Definition: metafile.c:5100
WORD rdFunction
Definition: wingdi.h:2792

Referenced by test_PlayMetaFile().

◆ checkConvertedFrameAndBounds()

static void checkConvertedFrameAndBounds ( UINT  buffer_size,
BYTE buffer,
BOOL  mfpIsNull,
LONG  mm,
LONG  xExt,
LONG  yExt,
RECTL rclBoundsExpected,
RECTL rclFrameExpected 
)
static

Definition at line 8854 of file metafile.c.

8857{
8858 RECTL rclBounds, rclFrame;
8859
8860 if (getConvertedFrameAndBounds(buffer_size, buffer, mfpIsNull, mm, xExt, yExt, &rclBounds, &rclFrame))
8861 {
8862 const char * msg;
8863 char buf[64];
8864
8865 if (mfpIsNull)
8866 {
8867 msg = "mfp == NULL";
8868 }
8869 else
8870 {
8871 const char * mm_str;
8872 switch (mm)
8873 {
8874 case MM_ANISOTROPIC: mm_str = "MM_ANISOTROPIC"; break;
8875 case MM_ISOTROPIC: mm_str = "MM_ISOTROPIC"; break;
8876 default: mm_str = "Unexpected";
8877 }
8878 sprintf(buf, "mm=%s, xExt=%ld, yExt=%ld", mm_str, xExt, yExt);
8879 msg = buf;
8880 }
8881
8882 ok(rclBounds.left == rclBoundsExpected->left, "rclBounds.left: Expected %ld, got %ld (%s)\n", rclBoundsExpected->left, rclBounds.left, msg);
8883 ok(rclBounds.top == rclBoundsExpected->top, "rclBounds.top: Expected %ld, got %ld (%s)\n", rclBoundsExpected->top, rclBounds.top, msg);
8884 ok(rclBounds.right == rclBoundsExpected->right, "rclBounds.right: Expected %ld, got %ld (%s)\n", rclBoundsExpected->right, rclBounds.right, msg);
8885 ok(rclBounds.bottom == rclBoundsExpected->bottom, "rclBounds.bottom: Expected %ld, got %ld (%s)\n", rclBoundsExpected->bottom, rclBounds.bottom, msg);
8886 ok(rclFrame.left == rclFrameExpected->left, "rclFrame.left: Expected %ld, got %ld (%s)\n", rclFrameExpected->left, rclFrame.left, msg);
8887 ok(rclFrame.top == rclFrameExpected->top, "rclFrame.top: Expected %ld, got %ld (%s)\n", rclFrameExpected->top, rclFrame.top, msg);
8888 ok(rclFrame.right == rclFrameExpected->right, "rclFrame.right: Expected %ld, got %ld (%s)\n", rclFrameExpected->right, rclFrame.right, msg);
8889 ok(rclFrame.bottom == rclFrameExpected->bottom, "rclFrame.bottom: Expected %ld, got %ld (%s)\n", rclFrameExpected->bottom, rclFrame.bottom, msg);
8890 }
8891}
#define msg(x)
Definition: auth_time.c:54
GLuint buffer
Definition: glext.h:5915
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf
Definition: sprintf.c:45
static BOOL getConvertedFrameAndBounds(UINT buffer_size, BYTE *buffer, BOOL mfpIsNull, LONG mm, LONG xExt, LONG yExt, RECTL *rclBounds, RECTL *rclFrame)
Definition: metafile.c:8823
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
#define MM_ANISOTROPIC
Definition: wingdi.h:867
#define MM_ISOTROPIC
Definition: wingdi.h:870

Referenced by test_SetWinMetaFileBits().

◆ clip_emf_enum_proc()

static int CALLBACK clip_emf_enum_proc ( HDC  hdc,
HANDLETABLE handle_table,
const ENHMETARECORD emr,
int  n_objs,
LPARAM  param 
)
static

Definition at line 8289 of file metafile.c.

8291{
8292 if (emr->iType == EMR_EXTSELECTCLIPRGN)
8293 {
8294 const EMREXTSELECTCLIPRGN *clip = (const EMREXTSELECTCLIPRGN *)emr;
8295 union _rgn
8296 {
8297 RGNDATA data;
8298 char buf[sizeof(RGNDATAHEADER) + sizeof(RECT)];
8299 };
8300 const union _rgn *rgn1;
8301 union _rgn rgn2;
8302 RECT rect, rc_transformed;
8303 const RECT *rc = (const RECT *)param;
8304 HRGN hrgn;
8305 XFORM xform;
8306 INT ret;
8307
8308 if (winetest_debug > 1)
8309 trace("EMR_EXTSELECTCLIPRGN: cbRgnData %#lx, iMode %lu\n", clip->cbRgnData, clip->iMode);
8310
8311 ok(clip->iMode == RGN_COPY, "expected RGN_COPY, got %lu\n", clip->iMode);
8312 ok(clip->cbRgnData >= sizeof(RGNDATAHEADER) + sizeof(RECT),
8313 "too small data block: %lu bytes\n", clip->cbRgnData);
8314 if (clip->cbRgnData < sizeof(RGNDATAHEADER) + sizeof(RECT))
8315 return 0;
8316
8317 rgn1 = (const union _rgn *)clip->RgnData;
8318
8319 if (winetest_debug > 1)
8320 trace("size %lu, type %lu, count %lu, rgn size %lu, bound %s\n",
8321 rgn1->data.rdh.dwSize, rgn1->data.rdh.iType,
8322 rgn1->data.rdh.nCount, rgn1->data.rdh.nRgnSize,
8323 wine_dbgstr_rect(&rgn1->data.rdh.rcBound));
8324
8325 ok(EqualRect(&rgn1->data.rdh.rcBound, rc), "rects don't match\n");
8326
8327 rect = *(const RECT *)rgn1->data.Buffer;
8328 if (winetest_debug > 1) trace("rect %s\n", wine_dbgstr_rect(&rect));
8329 ok(EqualRect(&rect, rc), "rects don't match\n");
8330
8331 ok(rgn1->data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %lu\n", rgn1->data.rdh.dwSize);
8332 ok(rgn1->data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %lu\n", rgn1->data.rdh.iType);
8333 ok(rgn1->data.rdh.nCount == 1, "expected 1, got %lu\n", rgn1->data.rdh.nCount);
8334 ok(rgn1->data.rdh.nRgnSize == sizeof(RECT),
8335 "expected sizeof(RECT), got %lu\n", rgn1->data.rdh.nRgnSize);
8336
8337 hrgn = CreateRectRgn(0, 0, 0, 0);
8338
8339 memset(&xform, 0, sizeof(xform));
8340 SetLastError(0xdeadbeef);
8341 ret = GetWorldTransform(hdc, &xform);
8342 ok(ret, "GetWorldTransform error %lu\n", GetLastError());
8343
8344 if (winetest_debug > 1) trace("xform.eM11 %f, xform.eM22 %f\n", xform.eM11, xform.eM22);
8345
8346 ret = GetClipRgn(hdc, hrgn);
8347 ok(ret == 0, "GetClipRgn returned %d, expected 0\n", ret);
8348
8349 PlayEnhMetaFileRecord(hdc, handle_table, emr, n_objs);
8350
8351 ret = GetClipRgn(hdc, hrgn);
8352 ok(ret == 1, "GetClipRgn returned %d, expected 1\n", ret);
8353
8354 ret = GetRegionData(hrgn, 0, NULL);
8355 ok(ret == sizeof(rgn2.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
8356
8357 ret = GetRegionData(hrgn, sizeof(rgn2), &rgn2.data);
8358 ok(ret == sizeof(rgn2), "expected sizeof(rgn2), got %u\n", ret);
8359
8360 if (winetest_debug > 1)
8361 trace("size %lu, type %lu, count %lu, rgn size %lu, bound %s\n", rgn2.data.rdh.dwSize,
8362 rgn2.data.rdh.iType, rgn2.data.rdh.nCount, rgn2.data.rdh.nRgnSize,
8363 wine_dbgstr_rect(&rgn2.data.rdh.rcBound));
8364
8365 rect = rgn2.data.rdh.rcBound;
8366 rc_transformed = *rc;
8367 translate((POINT *)&rc_transformed, 2, &xform);
8368 if (winetest_debug > 1)
8369 trace("transformed %s\n", wine_dbgstr_rect(&rc_transformed));
8370 ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n");
8371
8372 rect = *(const RECT *)rgn2.data.Buffer;
8373 if (winetest_debug > 1) trace("rect %s\n", wine_dbgstr_rect(&rect));
8374 rc_transformed = *rc;
8375 translate((POINT *)&rc_transformed, 2, &xform);
8376 if (winetest_debug > 1) trace("transformed %s\n", wine_dbgstr_rect(&rc_transformed));
8377 ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n");
8378
8379 ok(rgn2.data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %lu\n", rgn2.data.rdh.dwSize);
8380 ok(rgn2.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %lu\n", rgn2.data.rdh.iType);
8381 ok(rgn2.data.rdh.nCount == 1, "expected 1, got %lu\n", rgn2.data.rdh.nCount);
8382 ok(rgn2.data.rdh.nRgnSize == sizeof(RECT),
8383 "expected sizeof(RECT), got %lu\n", rgn2.data.rdh.nRgnSize);
8384
8386 }
8387 return 1;
8388}
static HRGN hrgn
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
struct _RGNDATAHEADER RGNDATAHEADER
RECT rect
Definition: combotst.c:67
#define NULL
Definition: types.h:112
pKey DeleteObject()
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLfloat param
Definition: glext.h:5796
if(dx< 0)
Definition: linetemp.h:194
static void translate(POINT *pt, UINT count, const XFORM *xform)
Definition: metafile.c:8268
static BOOL is_equal_rect(const RECT *rc1, const RECT *rc2)
Definition: metafile.c:8281
#define memset(x, y, z)
Definition: compat.h:39
int32_t INT
Definition: typedefs.h:58
#define EMR_EXTSELECTCLIPRGN
Definition: wingdi.h:148
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI PlayEnhMetaFileRecord(_In_ HDC hdc, _In_reads_(cht) LPHANDLETABLE pht, _In_ CONST ENHMETARECORD *pmr, _In_ UINT cht)
#define RDH_RECTANGLES
Definition: wingdi.h:669
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define RGN_COPY
Definition: wingdi.h:357
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)

Referenced by test_emf_clipping().

◆ clip_mf_enum_proc()

static int CALLBACK clip_mf_enum_proc ( HDC  hdc,
HANDLETABLE handle_table,
METARECORD mr,
int  n_objs,
LPARAM  param 
)
static

Definition at line 8552 of file metafile.c.

8554{
8555 switch (mr->rdFunction) {
8558 break;
8559 case META_SELECTOBJECT:
8561 break;
8562 }
8563 return 1;
8564}
static int clip_mf_enum_proc_seen_selectclipregion
Definition: metafile.c:8549
static int clip_mf_enum_proc_seen_selectobject
Definition: metafile.c:8550
#define META_SELECTCLIPREGION
Definition: wingdi.h:254
#define META_SELECTOBJECT
Definition: wingdi.h:255

Referenced by test_mf_clipping().

◆ COLORREF()

static COLORREF ( WINAPI pSetDCBrushColor)
static

◆ compare_emf_bits()

static int compare_emf_bits ( const HENHMETAFILE  mf,
const unsigned char bits,
UINT  bsize,
const char desc,
BOOL  ignore_scaling 
)
static

Definition at line 2337 of file metafile.c.

2340{
2341 unsigned char buf[MF_BUFSIZE];
2342 UINT mfsize, offset1, offset2;
2343 const ENHMETAHEADER *emh1, *emh2;
2344
2345 mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf);
2346 ok (mfsize > 0, "%s: GetEnhMetaFileBits error %ld\n", desc, GetLastError());
2347
2348 if (mfsize < MF_BUFSIZE)
2349 {
2350 ok(mfsize == bsize, "%s: mfsize=%d, bsize=%d\n", desc, mfsize, bsize);
2351 }
2352 else
2353 ok(bsize >= MF_BUFSIZE, "%s: mfsize > bufsize (%d bytes), bsize=%d\n",
2354 desc, mfsize, bsize);
2355
2356 /* basic things must match */
2357 emh1 = (const ENHMETAHEADER *)bits;
2358 emh2 = (const ENHMETAHEADER *)buf;
2359 ok(emh1->iType == EMR_HEADER, "expected EMR_HEADER, got %lu\n", emh1->iType);
2360 ok(emh1->nSize == sizeof(ENHMETAHEADER), "expected sizeof(ENHMETAHEADER), got %lu\n", emh1->nSize);
2361 ok(emh2->nBytes == mfsize, "expected emh->nBytes %u, got %lu\n", mfsize, emh2->nBytes);
2362 ok(emh1->dSignature == ENHMETA_SIGNATURE, "expected ENHMETA_SIGNATURE, got %lu\n", emh1->dSignature);
2363
2364 ok(emh1->iType == emh2->iType, "expected EMR_HEADER, got %lu\n", emh2->iType);
2365 ok(emh1->nSize == emh2->nSize,
2366 "expected nSize %lu, got %lu\n", emh1->nSize, emh2->nSize);
2367 ok(emh1->rclBounds.left == emh2->rclBounds.left, "%s: expected rclBounds.left = %ld, got %ld\n",
2368 desc, emh1->rclBounds.left, emh2->rclBounds.left);
2369 ok(emh1->rclBounds.top == emh2->rclBounds.top, "%s: expected rclBounds.top = %ld, got %ld\n",
2370 desc, emh1->rclBounds.top, emh2->rclBounds.top);
2371 ok(emh1->rclBounds.right == emh2->rclBounds.right, "%s: expected rclBounds.right = %ld, got %ld\n",
2372 desc, emh1->rclBounds.right, emh2->rclBounds.right);
2373 ok(emh1->rclBounds.bottom == emh2->rclBounds.bottom, "%s: expected rclBounds.bottom = %ld, got %ld\n",
2374 desc, emh1->rclBounds.bottom, emh2->rclBounds.bottom);
2375 ok(emh1->dSignature == emh2->dSignature, "expected dSignature %lu, got %lu\n", emh1->dSignature, emh2->dSignature);
2376 ok(emh1->nBytes == emh2->nBytes,
2377 "expected nBytes %lu, got %lu\n", emh1->nBytes, emh2->nBytes);
2378 ok(emh1->nRecords == emh2->nRecords, "expected nRecords %lu, got %lu\n", emh1->nRecords, emh2->nRecords);
2379
2380 offset1 = emh1->nSize;
2381 offset2 = emh2->nSize; /* Needed for Win9x/WinME/NT4 */
2382 while (offset1 < emh1->nBytes)
2383 {
2384 const ENHMETARECORD *emr1 = (const ENHMETARECORD *)(bits + offset1);
2385 const ENHMETARECORD *emr2 = (const ENHMETARECORD *)(buf + offset2);
2386
2387 if (winetest_debug > 1)
2388 trace("%s: EMF record %lu, size %lu/record %lu, size %lu\n",
2389 desc, emr1->iType, emr1->nSize, emr2->iType, emr2->nSize);
2390
2391 if (!match_emf_record(emr1, emr2, desc, ignore_scaling)) return -1;
2392
2393 /* We have already bailed out if iType or nSize don't match */
2394 offset1 += emr1->nSize;
2395 offset2 += emr2->nSize;
2396 }
2397 return 0;
2398}
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1204
#define MF_BUFSIZE
Definition: metafile.c:1007
static BOOL match_emf_record(const ENHMETARECORD *emr1, const ENHMETARECORD *emr2, const char *desc, BOOL ignore_scaling)
Definition: metafile.c:2238
unsigned int UINT
Definition: ndis.h:50
DWORD nRecords
Definition: wingdi.h:2773
DWORD dSignature
Definition: wingdi.h:2770
RECTL rclBounds
Definition: wingdi.h:2768
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
#define ENHMETA_SIGNATURE
Definition: wingdi.h:204
#define EMR_HEADER
Definition: wingdi.h:75

Referenced by test_emf_AlphaBlend(), test_emf_BitBlt(), test_emf_blit(), test_emf_clipping(), test_emf_DCBrush(), test_emf_ExtTextOut_on_path(), test_emf_GradientFill(), test_emf_mask_blit(), test_emf_palette(), test_emf_paths(), test_emf_pattern_brush(), test_emf_polybezier(), test_emf_PolyPolyline(), test_emf_select(), test_emf_SetDIBitsToDevice(), test_emf_StretchDIBits(), test_enhmetafile_file(), and test_mf_conversions().

◆ compare_mf_bits()

static int compare_mf_bits ( const HMETAFILE  mf,
const unsigned char bits,
UINT  bsize,
const char desc 
)
static

Definition at line 2083 of file metafile.c.

2085{
2086 unsigned char buf[MF_BUFSIZE];
2087 UINT mfsize, i;
2088 int diff;
2089
2090 mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf);
2091 ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc);
2092 if (mfsize < MF_BUFSIZE)
2093 ok (mfsize == bsize, "%s: mfsize=%d, bsize=%d.\n",
2094 desc, mfsize, bsize);
2095 else
2096 ok (bsize >= MF_BUFSIZE, "%s: mfsize > bufsize (%d bytes), bsize=%d.\n",
2097 desc, mfsize, bsize);
2098 if (mfsize != bsize)
2099 return -1;
2100
2101 diff = 0;
2102 for (i=0; i<bsize; i++)
2103 {
2104 if (buf[i] != bits[i])
2105 diff++;
2106 }
2107 ok (diff == 0, "%s: mfsize=%d, bsize=%d, diff=%d\n",
2108 desc, mfsize, bsize, diff);
2109
2110 return diff;
2111}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
UINT WINAPI GetMetaFileBitsEx(_In_ HMETAFILE hMF, _In_ UINT cbBuffer, _Out_writes_bytes_opt_(cbBuffer) LPVOID lpData)

Referenced by create_converted_emf(), test_CopyMetaFile(), test_metafile_file(), test_mf_Blank(), test_mf_blit(), test_mf_clipping(), test_mf_DCBrush(), test_mf_ExtTextOut_on_path(), test_mf_FloodFill(), test_mf_GetPath(), test_mf_Graphics(), test_mf_palette(), test_mf_palette_brush(), test_mf_PatternBrush(), test_mf_select(), test_mf_SetLayout(), and test_SetMetaFileBits().

◆ compare_mf_disk_bits()

static int compare_mf_disk_bits ( LPCSTR  name,
const BYTE bits,
UINT  bsize,
const char desc 
)
static

Definition at line 2113 of file metafile.c.

2114{
2115 unsigned char buf[MF_BUFSIZE];
2116 DWORD mfsize, rd_size, i;
2117 int diff;
2118 HANDLE hfile;
2119 BOOL ret;
2120
2122 assert(hfile != INVALID_HANDLE_VALUE);
2123
2124 mfsize = GetFileSize(hfile, NULL);
2125 assert(mfsize <= MF_BUFSIZE);
2126
2127 ret = ReadFile(hfile, buf, sizeof(buf), &rd_size, NULL);
2128 ok( ret && rd_size == mfsize, "ReadFile: error %ld\n", GetLastError());
2129
2130 CloseHandle(hfile);
2131
2132 ok(mfsize == bsize, "%s: mfsize=%ld, bsize=%d.\n", desc, mfsize, bsize);
2133
2134 if (mfsize != bsize)
2135 return -1;
2136
2137 diff = 0;
2138 for (i=0; i<bsize; i++)
2139 {
2140 if (buf[i] != bits[i])
2141 diff++;
2142 }
2143 ok(diff == 0, "%s: mfsize=%ld, bsize=%d, diff=%d\n",
2144 desc, mfsize, bsize, diff);
2145
2146 return diff;
2147}
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
#define assert(_expr)
Definition: assert.h:32
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: name.c:39

Referenced by test_CopyMetaFile().

◆ create_converted_emf()

static HENHMETAFILE create_converted_emf ( const METAFILEPICT mfp)
static

Definition at line 8718 of file metafile.c.

8719{
8720 HDC hdcMf;
8721 HMETAFILE hmf;
8722 HENHMETAFILE hemf;
8723 BOOL ret;
8724 UINT size;
8725 LPBYTE pBits;
8726
8727 hdcMf = CreateMetaFileA(NULL);
8728 ok(hdcMf != NULL, "CreateMetaFile failed with error %ld\n", GetLastError());
8729 ret = LineTo(hdcMf, (INT)LINE_X, (INT)LINE_Y);
8730 ok(ret, "LineTo failed with error %ld\n", GetLastError());
8731 hmf = CloseMetaFile(hdcMf);
8732 ok(hmf != NULL, "CloseMetaFile failed with error %ld\n", GetLastError());
8733
8734 if (compare_mf_bits (hmf, MF_LINETO_BITS, sizeof(MF_LINETO_BITS), "mf_LineTo") != 0)
8735 {
8736 dump_mf_bits(hmf, "mf_LineTo");
8737 EnumMetaFile(0, hmf, mf_enum_proc, 0);
8738 }
8739
8740 size = GetMetaFileBitsEx(hmf, 0, NULL);
8741 ok(size, "GetMetaFileBitsEx failed with error %ld\n", GetLastError());
8742 pBits = malloc(size);
8743 GetMetaFileBitsEx(hmf, size, pBits);
8744 DeleteMetaFile(hmf);
8745 hemf = SetWinMetaFileBits(size, pBits, NULL, mfp);
8746 free(pBits);
8747 return hemf;
8748}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
GLsizeiptr size
Definition: glext.h:5919
static HDC
Definition: imagelist.c:88
static const unsigned char MF_LINETO_BITS[]
Definition: metafile.c:1181
static void dump_mf_bits(const HMETAFILE mf, const char *desc)
Definition: metafile.c:2052
#define LINE_Y
Definition: metafile.c:36
static INT CALLBACK mf_enum_proc(HDC hdc, HANDLETABLE *ht, METARECORD *mr, INT nobj, LPARAM param)
Definition: metafile.c:2040
static int compare_mf_bits(const HMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc)
Definition: metafile.c:2083
#define LINE_X
Definition: metafile.c:35
unsigned char * LPBYTE
Definition: typedefs.h:53
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
HDC WINAPI CreateMetaFileA(_In_opt_ LPCSTR)
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
BOOL WINAPI EnumMetaFile(_In_ HDC, _In_ HMETAFILE, _In_ MFENUMPROC, _In_opt_ LPARAM)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
HENHMETAFILE WINAPI SetWinMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *lpMeta16Data, _In_opt_ HDC hdcRef, _In_opt_ const METAFILEPICT *lpMFP)

Referenced by test_mf_conversions().

◆ dump_emf_bits()

static void dump_emf_bits ( const HENHMETAFILE  mf,
const char desc 
)
static

Definition at line 2152 of file metafile.c.

2153{
2155 UINT mfsize, i;
2156
2157 if (!winetest_debug) return;
2158
2159 mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf);
2160 ok (mfsize > 0, "%s: GetEnhMetaFileBits failed\n", desc);
2161
2162 printf("EMF %s has bits:\n{\n ", desc);
2163 for (i = 0; i < mfsize; i++)
2164 {
2165 printf ("0x%02x", buf[i]);
2166 if (i == mfsize-1)
2167 printf ("\n");
2168 else if (i % 8 == 7)
2169 printf (",\n ");
2170 else
2171 printf (", ");
2172 }
2173 printf ("};\n");
2174}
#define printf
Definition: freeldr.h:103
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_emf_AlphaBlend(), test_emf_BitBlt(), test_emf_blit(), test_emf_clipping(), test_emf_DCBrush(), test_emf_ExtTextOut_on_path(), test_emf_GradientFill(), test_emf_mask_blit(), test_emf_palette(), test_emf_paths(), test_emf_pattern_brush(), test_emf_polybezier(), test_emf_PolyPolyline(), test_emf_select(), test_emf_SetDIBitsToDevice(), test_emf_StretchDIBits(), test_enhmetafile_file(), and test_mf_conversions().

◆ dump_emf_record()

static void dump_emf_record ( const ENHMETARECORD emr,
const char desc 
)
static

Definition at line 2200 of file metafile.c.

2201{
2202 const BYTE *buf;
2203 DWORD i;
2204
2205 if (!winetest_debug) return;
2206
2207 printf ("%s: EMF record %lu has bits:\n{\n", desc, emr->iType);
2208 buf = (const BYTE *)emr;
2209 for (i = 0; i < emr->nSize; i++)
2210 {
2211 printf ("0x%02x", buf[i]);
2212 if (i == emr->nSize - 1)
2213 printf ("\n");
2214 else if (i % 8 == 7)
2215 printf (",\n");
2216 else
2217 printf (", ");
2218 }
2219 printf ("};\n");
2220}

Referenced by match_emf_record().

◆ dump_emf_records()

static void dump_emf_records ( const HENHMETAFILE  mf,
const char desc 
)
static

Definition at line 2176 of file metafile.c.

2177{
2178 BYTE *emf;
2180 UINT mfsize, offset;
2181
2182 if (!winetest_debug) return;
2183
2184 mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf);
2185 ok (mfsize > 0, "%s: GetEnhMetaFileBits error %ld\n", desc, GetLastError());
2186
2187 printf("EMF %s has records:\n", desc);
2188
2189 emf = buf;
2190 offset = 0;
2191 while(offset < mfsize)
2192 {
2193 EMR *emr = (EMR *)(emf + offset);
2194 printf("emr->iType %ld, emr->nSize %lu\n", emr->iType, emr->nSize);
2195 /*trace("emr->iType 0x%04lx, emr->nSize 0x%04lx\n", emr->iType, emr->nSize);*/
2196 offset += emr->nSize;
2197 }
2198}
GLintptr offset
Definition: glext.h:5920
Definition: emfdc.c:45
DWORD iType
Definition: wingdi.h:2136
DWORD nSize
Definition: wingdi.h:2137

Referenced by test_emf_AlphaBlend(), test_emf_BitBlt(), test_emf_blit(), test_emf_clipping(), test_emf_DCBrush(), test_emf_ExtTextOut_on_path(), test_emf_GradientFill(), test_emf_mask_blit(), test_emf_palette(), test_emf_paths(), test_emf_pattern_brush(), test_emf_polybezier(), test_emf_PolyPolyline(), test_emf_select(), test_emf_SetDIBitsToDevice(), test_emf_StretchDIBits(), test_enhmetafile_file(), and test_mf_conversions().

◆ dump_EMREXTTEXTOUT()

static void dump_EMREXTTEXTOUT ( const EMREXTTEXTOUTW eto)
static

Definition at line 2222 of file metafile.c.

2223{
2224 trace("rclBounds %ld,%ld - %ld,%ld\n", eto->rclBounds.left, eto->rclBounds.top,
2225 eto->rclBounds.right, eto->rclBounds.bottom);
2226 trace("iGraphicsMode %lu\n", eto->iGraphicsMode);
2227 trace("exScale: %f\n", eto->exScale);
2228 trace("eyScale: %f\n", eto->eyScale);
2229 trace("emrtext.ptlReference %ld,%ld\n", eto->emrtext.ptlReference.x, eto->emrtext.ptlReference.y);
2230 trace("emrtext.nChars %lu\n", eto->emrtext.nChars);
2231 trace("emrtext.offString %#lx\n", eto->emrtext.offString);
2232 trace("emrtext.fOptions %#lx\n", eto->emrtext.fOptions);
2233 trace("emrtext.rcl %ld,%ld - %ld,%ld\n", eto->emrtext.rcl.left, eto->emrtext.rcl.top,
2234 eto->emrtext.rcl.right, eto->emrtext.rcl.bottom);
2235 trace("emrtext.offDx %#lx\n", eto->emrtext.offDx);
2236}
LONG y
Definition: windef.h:130
LONG x
Definition: windef.h:129
DWORD iGraphicsMode
Definition: wingdi.h:2428
EMRTEXT emrtext
Definition: wingdi.h:2431
DWORD fOptions
Definition: wingdi.h:2421
DWORD offDx
Definition: wingdi.h:2423
DWORD nChars
Definition: wingdi.h:2419
RECTL rcl
Definition: wingdi.h:2422
POINTL ptlReference
Definition: wingdi.h:2418
DWORD offString
Definition: wingdi.h:2420

Referenced by match_emf_record().

◆ dump_mf_bits()

static void dump_mf_bits ( const HMETAFILE  mf,
const char desc 
)
static

Definition at line 2052 of file metafile.c.

2053{
2055 UINT mfsize, i;
2056
2057 if (!winetest_debug) return;
2058
2059 mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf);
2060 ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc);
2061
2062 printf ("MetaFile %s has bits:\n{\n ", desc);
2063 for (i=0; i<mfsize; i++)
2064 {
2065 printf ("0x%02x", buf[i]);
2066 if (i == mfsize-1)
2067 printf ("\n");
2068 else if (i % 8 == 7)
2069 printf (",\n ");
2070 else
2071 printf (", ");
2072 }
2073 printf ("};\n");
2074}

Referenced by create_converted_emf(), test_CopyMetaFile(), test_metafile_file(), test_mf_Blank(), test_mf_blit(), test_mf_clipping(), test_mf_DCBrush(), test_mf_ExtTextOut_on_path(), test_mf_FloodFill(), test_mf_GetPath(), test_mf_Graphics(), test_mf_palette(), test_mf_palette_brush(), test_mf_PatternBrush(), test_mf_select(), test_mf_SetLayout(), and test_SetMetaFileBits().

◆ EmfEnumProc()

static INT CALLBACK EmfEnumProc ( HDC  hdc,
HANDLETABLE lpHTable,
const ENHMETARECORD lpEMFR,
INT  nObj,
LPARAM  lpData 
)
static

Definition at line 8678 of file metafile.c.

8679{
8680 LPMETAFILEPICT lpMFP = (LPMETAFILEPICT)lpData;
8681 POINT mapping[2] = { { 0, 0 }, { 10, 10 } };
8682 /* When using MM_TEXT Win9x does not update the mapping mode
8683 * until a record is played which actually outputs something */
8684 PlayEnhMetaFileRecord(hdc, lpHTable, lpEMFR, nObj);
8685 LPtoDP(hdc, mapping, 2);
8686 if (winetest_debug > 1)
8687 trace("EMF record: iType %ld, nSize %ld, (%ld,%ld)-(%ld,%ld)\n",
8688 lpEMFR->iType, lpEMFR->nSize,
8689 mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y);
8690
8691 if (lpEMFR->iType == EMR_LINETO)
8692 {
8693 INT x0, y0, x1, y1;
8694 if (!lpMFP || lpMFP->mm == MM_TEXT)
8695 {
8696 x0 = 0;
8697 y0 = 0;
8698 x1 = (INT)floor(10 * 100.0 / LINE_X + 0.5);
8699 y1 = (INT)floor(10 * 100.0 / LINE_Y + 0.5);
8700 }
8701 else
8702 {
8703 ok(lpMFP->mm == MM_ANISOTROPIC, "mm=%ld\n", lpMFP->mm);
8704
8709 }
8710 ok(mapping[0].x == x0 && mapping[0].y == y0 && mapping[1].x == x1 && mapping[1].y == y1,
8711 "(%ld,%ld)->(%ld,%ld), expected (%d,%d)->(%d,%d)\n",
8712 mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y,
8713 x0, y0, x1, y1);
8714 }
8715 return TRUE;
8716}
#define TRUE
Definition: types.h:120
_ACRTIMP double __cdecl floor(double)
Definition: floor.c:18
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
GLint x0
Definition: linetemp.h:95
GLint y0
Definition: linetemp.h:96
static INT
Definition: metafile.c:39
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
#define HORZRES
Definition: wingdi.h:716
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define VERTSIZE
Definition: wingdi.h:715
#define EMR_LINETO
Definition: wingdi.h:128
BOOL WINAPI LPtoDP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
struct tagMETAFILEPICT * LPMETAFILEPICT
#define HORZSIZE
Definition: wingdi.h:714
#define VERTRES
Definition: wingdi.h:717
#define MM_TEXT
Definition: wingdi.h:873

Referenced by test_mf_conversions().

◆ enum_emf_WorldTransform()

static INT CALLBACK enum_emf_WorldTransform ( HDC  hdc,
HANDLETABLE ht,
const ENHMETARECORD emr,
INT  nobj,
LPARAM  param 
)
static

Definition at line 9747 of file metafile.c.

9749{
9750 XFORM xform = {0};
9752 BOOL ret;
9753
9754 switch(emr->iType)
9755 {
9757 {
9758 const EMRSETWORLDTRANSFORM *lpXfrm = (const EMRSETWORLDTRANSFORM *)emr;
9759
9760 /* get scale factors with an identity world transform */
9762
9763 /* play back record */
9764 ret = PlayEnhMetaFileRecord(hdc, ht, emr, nobj);
9765 ok(ret == TRUE, "%s: PlayEnhMetaFileRecord failed\n", test_data->name);
9766
9767 test_data->stored = lpXfrm->xform;
9768 CombineTransform(&test_data->expected, &test_data->stored, &test_data->scale);
9769
9770 /* verify it is updated immediately */
9771 ret = GetWorldTransform(hdc, &xform);
9772 ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
9773 ok(xform_eq(&xform, &test_data->expected),
9774 "%s: After SWT playback, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
9775 test_data->name,
9776 xform.eM11, xform.eM12,
9777 xform.eM21, xform.eM22,
9778 xform.eDx, xform.eDy,
9779 test_data->expected.eM11, test_data->expected.eM12,
9780 test_data->expected.eM21, test_data->expected.eM22,
9781 test_data->expected.eDx, test_data->expected.eDy);
9782
9783 break;
9784 }
9785
9787 {
9788 const EMRMODIFYWORLDTRANSFORM *lpXfrm = (const EMRMODIFYWORLDTRANSFORM *)emr;
9789
9790 /* transform persists across calls */
9791 ret = GetWorldTransform(hdc, &xform);
9792 ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
9793 ok(xform_eq(&xform, &test_data->expected),
9794 "%s: On MWT entry, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
9795 test_data->name,
9796 xform.eM11, xform.eM12,
9797 xform.eM21, xform.eM22,
9798 xform.eDx, xform.eDy,
9799 test_data->expected.eM11, test_data->expected.eM12,
9800 test_data->expected.eM21, test_data->expected.eM22,
9801 test_data->expected.eDx, test_data->expected.eDy);
9802
9803 if(test_data->do_playback)
9804 {
9805 /* play back record */
9806 ret = PlayEnhMetaFileRecord(hdc, ht, emr, nobj);
9807 ok(ret == TRUE, "%s: PlayEnhMetaFileRecord failed\n", test_data->name);
9808
9809 if(lpXfrm->iMode == MWT_LEFTMULTIPLY)
9810 {
9811 /* left multiply does not discard direct modifications */
9812 CombineTransform(&test_data->expected, &lpXfrm->xform, &test_data->expected);
9813
9814 /* and updates the stored matrix separately */
9815 CombineTransform(&test_data->stored, &lpXfrm->xform, &test_data->stored);
9816
9817 }
9818 else if(lpXfrm->iMode == MWT_RIGHTMULTIPLY)
9819 {
9820 /* but right multiply does discard */
9821 CombineTransform(&test_data->stored, &test_data->stored, &lpXfrm->xform);
9822
9823 CombineTransform(&test_data->expected, &test_data->stored, &test_data->scale);
9824 }
9825 else if(lpXfrm->iMode == MWT_IDENTITY)
9826 {
9827 /* reset to identity matrix also does discard */
9828 test_data->stored.eM11 = 1.0f;
9829 test_data->stored.eM12 = 0.0f;
9830 test_data->stored.eM21 = 0.0f;
9831 test_data->stored.eM22 = 1.0f;
9832 test_data->stored.eDx = 0.0f;
9833 test_data->stored.eDy = 0.0f;
9834
9835 CombineTransform(&test_data->expected, &test_data->stored, &test_data->scale);
9836 }
9837
9838 /* verify it is updated immediately */
9839 ret = GetWorldTransform(hdc, &xform);
9840 ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
9841 ok(xform_eq(&xform, &test_data->expected),
9842 "%s: After MWT playback, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
9843 test_data->name,
9844 xform.eM11, xform.eM12,
9845 xform.eM21, xform.eM22,
9846 xform.eDx, xform.eDy,
9847 test_data->expected.eM11, test_data->expected.eM12,
9848 test_data->expected.eM21, test_data->expected.eM22,
9849 test_data->expected.eDx, test_data->expected.eDy);
9850 }
9851
9852 if(test_data->do_modify)
9853 {
9854 /* modify directly */
9855 set_rotation_xform(&xform, M_PI / 4.f, 1, -1);
9857 ok(ret == TRUE, "%s: ModifyWorldTransform failed\n", test_data->name);
9858
9859 /* the modified transform persists across callback calls */
9860 CombineTransform(&test_data->expected, &xform, &test_data->expected);
9861
9862 ret = GetWorldTransform(hdc, &xform);
9863 ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
9864 ok(xform_eq(&xform, &test_data->expected),
9865 "%s: After ModifyWT, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
9866 test_data->name,
9867 xform.eM11, xform.eM12,
9868 xform.eM21, xform.eM22,
9869 xform.eDx, xform.eDy,
9870 test_data->expected.eM11, test_data->expected.eM12,
9871 test_data->expected.eM21, test_data->expected.eM22,
9872 test_data->expected.eDx, test_data->expected.eDy);
9873 }
9874
9875 break;
9876 }
9877
9878 case EMR_LINETO:
9879 ret = GetWorldTransform(hdc, &xform);
9880 ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
9881 ok(xform_eq(&xform, &test_data->expected),
9882 "%s: Before LINETO playback, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
9883 test_data->name,
9884 xform.eM11, xform.eM12,
9885 xform.eM21, xform.eM22,
9886 xform.eDx, xform.eDy,
9887 test_data->expected.eM11, test_data->expected.eM12,
9888 test_data->expected.eM21, test_data->expected.eM22,
9889 test_data->expected.eDx, test_data->expected.eDy);
9890
9891 ret = PlayEnhMetaFileRecord(hdc, ht, emr, nobj);
9892 ok(ret == TRUE, "%s: PlayEnhMetaFileRecord failed\n", test_data->name);
9893
9894 /* transform doesn't change during LINETO playback */
9895 ret = GetWorldTransform(hdc, &xform);
9896 ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
9897 ok(xform_eq(&xform, &test_data->expected),
9898 "%s: After LINETO playback, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
9899 test_data->name,
9900 xform.eM11, xform.eM12,
9901 xform.eM21, xform.eM22,
9902 xform.eDx, xform.eDy,
9903 test_data->expected.eM11, test_data->expected.eM12,
9904 test_data->expected.eM21, test_data->expected.eM22,
9905 test_data->expected.eDx, test_data->expected.eDy);
9906
9907 break;
9908
9909 default:
9910 PlayEnhMetaFileRecord(hdc, ht, emr, nobj);
9911 break;
9912 }
9913
9914 return 1;
9915}
static const struct newhuff ht[]
Definition: huffman.h:296
#define M_PI
Definition: macros.h:263
static void set_rotation_xform(XFORM *out, float rad, int dx, int dy)
Definition: metafile.c:9715
static BOOL xform_eq(const XFORM *a, const XFORM *b)
Definition: metafile.c:9737
#define MWT_LEFTMULTIPLY
Definition: wingdi.h:945
#define MWT_RIGHTMULTIPLY
Definition: wingdi.h:946
#define MWT_IDENTITY
Definition: wingdi.h:944
BOOL WINAPI CombineTransform(_Out_ LPXFORM pxformResult, _In_ const XFORM *pxform1, _In_ const XFORM *pxform2)
Definition: coord.c:64
#define EMR_MODIFYWORLDTRANSFORM
Definition: wingdi.h:110
#define EMR_SETWORLDTRANSFORM
Definition: wingdi.h:109
BOOL WINAPI ModifyWorldTransform(_In_ HDC, _In_opt_ const XFORM *, _In_ DWORD)

Referenced by test_emf_WorldTransform().

◆ eto_emf_enum_proc()

static int CALLBACK eto_emf_enum_proc ( HDC  hdc,
HANDLETABLE handle_table,
const ENHMETARECORD emr,
int  n_objs,
LPARAM  param 
)
static

Definition at line 63 of file metafile.c.

65{
66 static int n_record;
67 DWORD i;
68 const INT *dx;
69 INT *orig_dx = (INT *)param;
70 LOGFONTA device_lf;
71 INT ret;
72
73 if(!hdc) return 1;
74
76
77 switch (emr->iType)
78 {
79 case EMR_HEADER:
80 ok(GetTextAlign(hdc) == 0, "text align %08x\n", GetTextAlign(hdc));
81 ok(GetBkColor(hdc) == RGB(0xff, 0xff, 0xff), "bk color %08lx\n", GetBkColor(hdc));
82 ok(GetTextColor(hdc) == RGB(0x0, 0x0, 0x0), "text color %08lx\n", GetTextColor(hdc));
83 ok(GetROP2(hdc) == R2_COPYPEN, "rop %d\n", GetROP2(hdc));
85 ok(GetPolyFillMode(hdc) == ALTERNATE, "poly fill %d\n", GetPolyFillMode(hdc));
86 ok(GetStretchBltMode(hdc) == BLACKONWHITE, "stretchblt mode %d\n", GetStretchBltMode(hdc));
87
88 /* GetBkMode, GetRelAbs do not get reset to the default value */
89 ok(GetBkMode(hdc) == OPAQUE, "bk mode %d\n", GetBkMode(hdc));
90 if(pSetRelAbs && pGetRelAbs)
91 ok(pGetRelAbs(hdc, 0) == RELATIVE, "relabs %d\n", pGetRelAbs(hdc, 0));
92
93 n_record = 0;
94 break;
95
96 case EMR_EXTTEXTOUTA:
97 {
98 const EMREXTTEXTOUTA *emr_ExtTextOutA = (const EMREXTTEXTOUTA *)emr;
99 dx = (const INT *)((const char *)emr + emr_ExtTextOutA->emrtext.offDx);
100
101 ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
102 ok( ret == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError());
103
104 /* compare up to lfOutPrecision, other values are not interesting,
105 * and in fact sometimes arbitrary adapted by Win9x.
106 */
107 ok(!memcmp(&orig_lf, &device_lf, FIELD_OFFSET(LOGFONTA, lfOutPrecision)), "fonts don't match\n");
108 ok(!lstrcmpA(orig_lf.lfFaceName, device_lf.lfFaceName), "font names don't match\n");
109
110 for(i = 0; i < emr_ExtTextOutA->emrtext.nChars; i++)
111 {
112 ok(orig_dx[i] == dx[i], "pass %d: dx[%ld] (%d) didn't match %d\n",
113 n_record, i, dx[i], orig_dx[i]);
114 }
115 n_record++;
117 break;
118 }
119
120 case EMR_EXTTEXTOUTW:
121 {
122 const EMREXTTEXTOUTW *emr_ExtTextOutW = (const EMREXTTEXTOUTW *)emr;
123 dx = (const INT *)((const char *)emr + emr_ExtTextOutW->emrtext.offDx);
124
125 SetLastError(0xdeadbeef);
126 ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
127 ok( ret == sizeof(device_lf) ||
128 broken(ret == (sizeof(device_lf) - LF_FACESIZE + strlen(device_lf.lfFaceName) + 1)), /* NT4 */
129 "GetObjectA error %ld\n", GetLastError());
130
131 /* compare up to lfOutPrecision, other values are not interesting,
132 * and in fact sometimes arbitrary adapted by Win9x.
133 */
134 ok(!memcmp(&orig_lf, &device_lf, FIELD_OFFSET(LOGFONTA, lfOutPrecision)), "fonts don't match\n");
135 ok(!lstrcmpA(orig_lf.lfFaceName, device_lf.lfFaceName), "font names don't match\n");
136
137 ok(!emr_ExtTextOutW->rclBounds.left, "emr_ExtTextOutW->rclBounds.left = %ld\n",
138 emr_ExtTextOutW->rclBounds.left);
139 ok(emr_ExtTextOutW->rclBounds.right != -1, "emr_ExtTextOutW->rclBounds.right = %ld\n",
140 emr_ExtTextOutW->rclBounds.right);
141 ok(emr_ExtTextOutW->rclBounds.bottom != -1, "emr_ExtTextOutW->rclBounds.bottom = %ld\n",
142 emr_ExtTextOutW->rclBounds.bottom);
143
144 if(emr_ExtTextOutW->emrtext.fOptions & ETO_PDY)
145 {
146 ok(emr_ExtTextOutW->rclBounds.top < 0, "emr_ExtTextOutW->rclBounds.top = %ld\n",
147 emr_ExtTextOutW->rclBounds.top);
148 for(i = 0; i < emr_ExtTextOutW->emrtext.nChars * 2; i++)
149 {
150 ok(orig_dx[i] == dx[i], "pass %d: dx[%ld] (%d) didn't match %d\n",
151 n_record, i, dx[i], orig_dx[i]);
152 }
153 }
154 else
155 {
156 for(i = 0; i < emr_ExtTextOutW->emrtext.nChars; i++)
157 {
158 ok(orig_dx[2 * i] == dx[i], "pass %d: dx[%ld] (%d) didn't match %d\n",
159 n_record, i, dx[i], orig_dx[i]);
160 }
161 }
162 n_record++;
164 break;
165 }
166
167 default:
168 break;
169 }
170
171 return 1;
172}
#define broken(x)
Definition: atltest.h:178
#define ALTERNATE
Definition: constants.h:278
#define LF_FACESIZE
Definition: dimm.idl:39
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4104
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
#define RGB(r, g, b)
Definition: precomp.h:67
GLint dx
Definition: linetemp.h:97
static LOGFONTA orig_lf
Definition: metafile.c:31
static BOOL emr_processed
Definition: metafile.c:32
#define RELATIVE(wait)
Definition: nfs41_driver.c:113
#define OBJ_FONT
Definition: objidl.idl:1019
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int WINAPI GetBkMode(_In_ HDC)
int WINAPI GetPolyFillMode(_In_ HDC)
#define EMR_EXTTEXTOUTA
Definition: wingdi.h:156
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
UINT WINAPI GetTextAlign(_In_ HDC)
Definition: text.c:837
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:860
#define EMR_EXTTEXTOUTW
Definition: wingdi.h:157
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
#define BLACKONWHITE
Definition: wingdi.h:952
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
int WINAPI GetROP2(_In_ HDC)
Definition: dc.c:1093
int WINAPI GetStretchBltMode(_In_ HDC)
#define OPAQUE
Definition: wingdi.h:949
#define AD_COUNTERCLOCKWISE
Definition: wingdi.h:667
#define ETO_PDY
Definition: wingdi.h:657
#define R2_COPYPEN
Definition: wingdi.h:339
int WINAPI GetArcDirection(_In_ HDC)
Definition: dc.c:358

Referenced by test_ExtTextOut().

◆ eto_scale_enum_proc()

static int CALLBACK eto_scale_enum_proc ( HDC  hdc,
HANDLETABLE handle_table,
const ENHMETARECORD emr,
int  n_objs,
LPARAM  param 
)
static

Definition at line 318 of file metafile.c.

320{
322
323 if (emr->iType == EMR_EXTTEXTOUTW)
324 {
325 const EMREXTTEXTOUTW *pExtTextOutW = (const EMREXTTEXTOUTW *)emr;
326 ok(fabs(test->ex_scale - pExtTextOutW->exScale) < 0.001,
327 "Got exScale %f, expected %f\n", pExtTextOutW->exScale, test->ex_scale);
328 ok(fabs(test->ey_scale - pExtTextOutW->eyScale) < 0.001,
329 "Got eyScale %f, expected %f\n", pExtTextOutW->eyScale, test->ey_scale);
330 test->processed = TRUE;
331 }
332
333 return 1;
334}
#define test
Definition: rosglue.h:37

Referenced by test_ExtTextOutScale().

◆ getConvertedFrameAndBounds()

static BOOL getConvertedFrameAndBounds ( UINT  buffer_size,
BYTE buffer,
BOOL  mfpIsNull,
LONG  mm,
LONG  xExt,
LONG  yExt,
RECTL rclBounds,
RECTL rclFrame 
)
static

Definition at line 8823 of file metafile.c.

8826{
8827 METAFILEPICT mfp;
8828 METAFILEPICT * mfpPtr = NULL;
8829 HENHMETAFILE emf;
8831 UINT res;
8832
8833 if (!mfpIsNull)
8834 {
8835 mfp.mm = mm;
8836 mfp.xExt = xExt;
8837 mfp.yExt = yExt;
8838 mfpPtr = &mfp;
8839 }
8840
8842 ok(emf != NULL, "SetWinMetaFileBits failed\n");
8843 if (!emf) return FALSE;
8845 ok(res != 0, "GetEnhMetaHeader failed\n");
8847 if (!res) return FALSE;
8848
8849 *rclBounds = header.rclBounds;
8850 *rclFrame = header.rclFrame;
8851 return TRUE;
8852}
#define FALSE
Definition: types.h:117
GLuint res
Definition: glext.h:9613
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
UINT WINAPI GetEnhMetaFileHeader(_In_ HENHMETAFILE hemf, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPENHMETAHEADER lpEnhMetaHeader)

Referenced by checkConvertedFrameAndBounds(), and test_SetWinMetaFileBits().

◆ getwinmetafilebits()

static void getwinmetafilebits ( UINT  mode,
int  scale,
RECT rc 
)
static

Definition at line 9048 of file metafile.c.

9049{
9050 HENHMETAFILE emf, emf2;
9051 HDC display_dc, emf_dc;
9052 ENHMETAHEADER *enh_header, *enh2_header;
9053 UINT size, emf_size, i, emf2_size;
9054 WORD check = 0;
9055 DWORD rec_num = 0;
9056 METAHEADER *mh = NULL;
9057 METARECORD *rec;
9058 INT horz_res, vert_res, horz_size, vert_size;
9059 INT curve_caps, line_caps, poly_caps;
9060 METAFILEPICT mfp;
9061
9063 ok(display_dc != NULL, "display_dc is NULL\n");
9064
9065 horz_res = GetDeviceCaps(display_dc, HORZRES);
9066 vert_res = GetDeviceCaps(display_dc, VERTRES);
9067 horz_size = GetDeviceCaps(display_dc, HORZSIZE);
9068 vert_size = GetDeviceCaps(display_dc, VERTSIZE);
9069
9070 emf_dc = CreateEnhMetaFileA(display_dc, NULL, rc, NULL);
9071 ok(emf_dc != NULL, "emf_dc is NULL\n");
9072
9073 curve_caps = GetDeviceCaps(emf_dc, CURVECAPS);
9074 ok(curve_caps == 511, "expect 511 got %d\n", curve_caps);
9075
9076 line_caps = GetDeviceCaps(emf_dc, LINECAPS);
9077 ok(line_caps == 254, "expect 254 got %d\n", line_caps);
9078
9079 poly_caps = GetDeviceCaps(emf_dc, POLYGONALCAPS);
9080 ok(poly_caps == 255, "expect 511 got %d\n", poly_caps);
9081
9082 for(i = 0; i < 3000; i++) /* This is enough to take emf_size > 0xffff */
9083 Rectangle(emf_dc, 0, 0, 1000, 20);
9084 emf = CloseEnhMetaFile(emf_dc);
9085 ok(emf != NULL, "emf is NULL\n");
9086
9087 emf_size = GetEnhMetaFileBits(emf, 0, NULL);
9088 enh_header = malloc(emf_size);
9089 emf_size = GetEnhMetaFileBits(emf, emf_size, (BYTE*)enh_header);
9091 /* multiply szlDevice.cx by scale, when scale != 1 the recording and playback dcs
9092 have different resolutions */
9093 enh_header->szlDevice.cx *= scale;
9094 emf = SetEnhMetaFileBits(emf_size, (BYTE*)enh_header);
9095 ok(emf != NULL, "emf is NULL\n");
9096 ok(EqualRect((RECT*)&enh_header->rclFrame, rc), "Frame rectangles differ\n");
9097
9099 ok(size ||
9100 broken(size == 0), /* some versions of winxp fail for some reason */
9101 "GetWinMetaFileBits returns 0\n");
9102 if(!size) goto end;
9103 mh = malloc(size);
9105
9106 for(i = 0; i < size / 2; i++) check += ((WORD*)mh)[i];
9107 ok(check == 0, "check %04x\n", check);
9108
9109 rec = (METARECORD*)(mh + 1);
9110
9111 while(rec->rdSize && rec->rdFunction)
9112 {
9113 const DWORD chunk_size = 0x2000;
9114 DWORD mfcomment_chunks = (emf_size + chunk_size - 1) / chunk_size;
9115
9116 if(rec_num < mfcomment_chunks)
9117 {
9118 DWORD this_chunk_size = chunk_size;
9119
9120 if(rec_num == mfcomment_chunks - 1)
9121 this_chunk_size = emf_size - rec_num * chunk_size;
9122
9123 ok(rec->rdSize == (this_chunk_size + 44) / 2, "%04lx: got %04lx expected %04lx\n", rec_num, rec->rdSize, (this_chunk_size + 44) / 2);
9124 ok(rec->rdFunction == META_ESCAPE, "%04lx: got %04x\n", rec_num, rec->rdFunction);
9125 if(rec->rdSize < (this_chunk_size + 44) / 2) break;
9126 ok(rec->rdParm[0] == MFCOMMENT, "got %04x\n", rec->rdParm[0]);
9127 ok(rec->rdParm[1] == this_chunk_size + 34, "got %04x %x\n", rec->rdParm[1], emf_size + 34);
9128 ok(rec->rdParm[2] == 0x4d57, "got %04x\n", rec->rdParm[2]); /* WMFC */
9129 ok(rec->rdParm[3] == 0x4346, "got %04x\n", rec->rdParm[3]); /* " */
9130 ok(rec->rdParm[4] == 1, "got %04x\n", rec->rdParm[4]);
9131 ok(rec->rdParm[5] == 0, "got %04x\n", rec->rdParm[5]);
9132 ok(rec->rdParm[6] == 0, "got %04x\n", rec->rdParm[6]);
9133 ok(rec->rdParm[7] == 1, "got %04x\n", rec->rdParm[7]);
9134 /* parm[8] is the checksum, tested above */
9135 if(rec_num > 0) ok(rec->rdParm[8] == 0, "got %04x\n", rec->rdParm[8]);
9136 ok(rec->rdParm[9] == 0, "got %04x\n", rec->rdParm[9]);
9137 ok(rec->rdParm[10] == 0, "got %04x\n", rec->rdParm[10]);
9138 ok(rec->rdParm[11] == mfcomment_chunks, "got %04x\n", rec->rdParm[11]); /* num chunks */
9139 ok(rec->rdParm[12] == 0, "got %04x\n", rec->rdParm[12]);
9140 ok(rec->rdParm[13] == this_chunk_size, "got %04x expected %04lx\n", rec->rdParm[13], this_chunk_size);
9141 ok(rec->rdParm[14] == 0, "got %04x\n", rec->rdParm[14]);
9142 ok(*(DWORD*)(rec->rdParm + 15) == emf_size - this_chunk_size - rec_num * chunk_size, "got %08lx\n", *(DWORD*)(rec->rdParm + 15)); /* DWORD size remaining after current chunk */
9143 ok(*(DWORD*)(rec->rdParm + 17) == emf_size, "got %08lx emf_size %08x\n", *(DWORD*)(rec->rdParm + 17), emf_size);
9144 ok(!memcmp(rec->rdParm + 19, (char*)enh_header + rec_num * chunk_size, this_chunk_size), "bits mismatch\n");
9145 }
9146
9147 else if(rec_num == mfcomment_chunks)
9148 {
9149 ok(rec->rdFunction == META_SETMAPMODE, "got %04x\n", rec->rdFunction);
9150 ok(rec->rdParm[0] == mode, "got %04x\n", rec->rdParm[0]);
9151 }
9152 else if(rec_num == mfcomment_chunks + 1)
9153 {
9154 POINT pt;
9155 ok(rec->rdFunction == META_SETWINDOWORG, "got %04x\n", rec->rdFunction);
9156 switch(mode)
9157 {
9158 case MM_TEXT:
9159 case MM_ISOTROPIC:
9160 case MM_ANISOTROPIC:
9161 pt.y = MulDiv(rc->top, vert_res, vert_size * 100) + 1;
9162 pt.x = MulDiv(rc->left, horz_res, horz_size * 100);
9163 break;
9164 case MM_LOMETRIC:
9165 pt.y = MulDiv(-rc->top, 1, 10) + 1;
9166 pt.x = MulDiv( rc->left, 1, 10);
9167 break;
9168 case MM_HIMETRIC:
9169 pt.y = -rc->top + 1;
9170 pt.x = (rc->left >= 0) ? rc->left : rc->left + 1; /* strange but true */
9171 break;
9172 case MM_LOENGLISH:
9173 pt.y = MulDiv(-rc->top, 10, 254) + 1;
9174 pt.x = MulDiv( rc->left, 10, 254);
9175 break;
9176 case MM_HIENGLISH:
9177 pt.y = MulDiv(-rc->top, 100, 254) + 1;
9178 pt.x = MulDiv( rc->left, 100, 254);
9179 break;
9180 case MM_TWIPS:
9181 pt.y = MulDiv(-rc->top, 72 * 20, 2540) + 1;
9182 pt.x = MulDiv( rc->left, 72 * 20, 2540);
9183 break;
9184 default:
9185 pt.x = pt.y = 0;
9186 }
9187 ok(near_match((short)rec->rdParm[0], pt.y), "got %d expect %ld\n", (short)rec->rdParm[0], pt.y);
9188 ok(near_match((short)rec->rdParm[1], pt.x), "got %d expect %ld\n", (short)rec->rdParm[1], pt.x);
9189 }
9190 if(rec_num == mfcomment_chunks + 2)
9191 {
9192 ok(rec->rdFunction == META_SETWINDOWEXT, "got %04x\n", rec->rdFunction);
9193 ok(near_match((short)rec->rdParm[0], MulDiv(rc->bottom - rc->top, vert_res, vert_size * 100)),
9194 "got %d\n", (short)rec->rdParm[0]);
9195 ok(near_match((short)rec->rdParm[1], MulDiv(rc->right - rc->left, horz_res, horz_size * 100)),
9196 "got %d\n", (short)rec->rdParm[1]);
9197 }
9198
9199 rec_num++;
9200 rec = (METARECORD*)((WORD*)rec + rec->rdSize);
9201 }
9202
9203 /* Show that we get the original back when we do the reverse conversion.
9204 mfp is ignored in this case. */
9205 mfp.mm = MM_ISOTROPIC;
9206 mfp.xExt = 0xcafe;
9207 mfp.yExt = 0xbeef;
9208 emf2 = SetWinMetaFileBits( size, (BYTE*)mh, NULL, &mfp );
9209 ok( !!emf2, "got NULL\n" );
9210 emf2_size = GetEnhMetaFileBits( emf2, 0, NULL );
9211 enh2_header = malloc( emf2_size );
9212 emf2_size = GetEnhMetaFileBits( emf2, emf2_size, (BYTE*)enh2_header );
9213 ok( emf_size == emf2_size, "%d %d\n", emf_size, emf2_size );
9214 ok( !memcmp( enh_header, enh2_header, emf_size ), "mismatch\n" );
9215 free( enh2_header );
9216 DeleteEnhMetaFile( emf2 );
9217
9218end:
9219 free(mh);
9220 free(enh_header);
9222
9224}
static HDC display_dc
Definition: main.c:41
#define check(expected, result)
Definition: dplayx.c:32
#define pt(x, y)
Definition: drawing.c:79
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint end
Definition: gl.h:1545
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
GLenum mode
Definition: glext.h:6217
#define near_match(a, b)
Definition: font.c:39
LONG cx
Definition: kdterminal.h:27
RECTL rclFrame
Definition: wingdi.h:2769
SIZEL szlDevice
Definition: wingdi.h:2779
DWORD rdSize
Definition: wingdi.h:2791
WORD rdParm[1]
Definition: wingdi.h:2793
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#define MM_HIENGLISH
Definition: wingdi.h:868
#define MM_LOENGLISH
Definition: wingdi.h:871
#define META_ESCAPE
Definition: wingdi.h:248
#define MM_HIMETRIC
Definition: wingdi.h:869
#define META_SETMAPMODE
Definition: wingdi.h:212
#define POLYGONALCAPS
Definition: wingdi.h:779
UINT WINAPI GetWinMetaFileBits(_In_ HENHMETAFILE hemf, _In_ UINT cbData16, _Out_writes_bytes_opt_(cbData16) LPBYTE pData16, _In_ INT iMapMode, _In_ HDC hdcRef)
#define MM_TWIPS
Definition: wingdi.h:874
#define META_SETWINDOWORG
Definition: wingdi.h:221
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
#define META_SETWINDOWEXT
Definition: wingdi.h:222
#define MM_LOMETRIC
Definition: wingdi.h:872
#define CURVECAPS
Definition: wingdi.h:759
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
HENHMETAFILE WINAPI SetEnhMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *pb)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define LINECAPS
Definition: wingdi.h:770
#define MFCOMMENT
Definition: wingdi.h:1008
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by test_GetWinMetaFileBits().

◆ init_function_pointers()

static void init_function_pointers ( void  )
static

Definition at line 48 of file metafile.c.

49{
50 HMODULE hGDI;
51
52 pGetRelAbs = NULL;
53 pSetRelAbs = NULL;
54
55 hGDI = GetModuleHandleA("gdi32.dll");
56 assert(hGDI);
61}
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define GDI_GET_PROC(func)
Definition: metafile.c:43
COLORREF WINAPI SetDCPenColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:941
DWORD WINAPI GetRelAbs(_In_ HDC hdc, _In_ DWORD dwIgnore)
Definition: dc.c:720
COLORREF WINAPI SetDCBrushColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:905
INT WINAPI SetRelAbs(HDC, INT)
Definition: dc.c:733

Referenced by START_TEST().

◆ INT()

static INT ( WINAPI pGetRelAbs)
static

◆ is_equal_rect()

static BOOL is_equal_rect ( const RECT rc1,
const RECT rc2 
)
static

Definition at line 8281 of file metafile.c.

8282{
8283 return abs(rc1->left - rc2->left) <= 1 &&
8284 abs(rc1->top - rc2->top) <= 1 &&
8285 abs(rc1->right - rc2->right) <= 1 &&
8286 abs(rc1->bottom - rc2->bottom) <= 1;
8287}
static const WCHAR rc2[]
Definition: oid.c:1216
#define abs(i)
Definition: fconv.c:206

Referenced by clip_emf_enum_proc().

◆ match_emf_record()

static BOOL match_emf_record ( const ENHMETARECORD emr1,
const ENHMETARECORD emr2,
const char desc,
BOOL  ignore_scaling 
)
static

Definition at line 2238 of file metafile.c.

2240{
2241 int diff;
2242
2243 ok(emr1->iType == emr2->iType, "%s: emr->iType %lu != %lu\n",
2244 desc, emr1->iType, emr2->iType);
2245
2246 ok(emr1->nSize == emr2->nSize, "%s: emr->nSize %lu != %lu\n",
2247 desc, emr1->nSize, emr2->nSize);
2248
2249 /* iType and nSize mismatches are fatal */
2250 if (emr1->iType != emr2->iType || emr1->nSize != emr2->nSize) return FALSE;
2251
2252 /* contents of EMR_GDICOMMENT are not interesting */
2253 if (emr1->iType == EMR_GDICOMMENT) return TRUE;
2254
2255 /* different Windows versions setup DC scaling differently when
2256 * converting an old style metafile to an EMF.
2257 */
2258 if (ignore_scaling && (emr1->iType == EMR_SETWINDOWEXTEX ||
2259 emr1->iType == EMR_SETVIEWPORTEXTEX))
2260 return TRUE;
2261
2262 if (emr1->iType == EMR_EXTTEXTOUTW || emr1->iType == EMR_EXTTEXTOUTA)
2263 {
2264 EMREXTTEXTOUTW *eto1, *eto2;
2265
2266 eto1 = malloc(emr1->nSize);
2267 memcpy(eto1, emr1, emr1->nSize);
2268 eto2 = malloc(emr2->nSize);
2269 memcpy(eto2, emr2, emr2->nSize);
2270
2271 /* different Windows versions setup DC scaling differently */
2272 eto1->exScale = eto1->eyScale = 0.0;
2273 eto2->exScale = eto2->eyScale = 0.0;
2274
2275 diff = memcmp(eto1, eto2, emr1->nSize);
2276 if (diff)
2277 {
2278 dump_EMREXTTEXTOUT(eto1);
2279 dump_EMREXTTEXTOUT(eto2);
2280 }
2281 free(eto1);
2282 free(eto2);
2283 }
2284 else if (emr1->iType == EMR_EXTSELECTCLIPRGN && !lstrcmpA(desc, "emf_clipping"))
2285 {
2286 diff = memcmp(emr1, emr2, emr1->nSize);
2287 }
2288 else if (emr1->iType == EMR_POLYBEZIERTO16 || emr1->iType == EMR_POLYBEZIER16)
2289 {
2290 EMRPOLYBEZIER16 *eto1, *eto2;
2291
2292 eto1 = (EMRPOLYBEZIER16*)emr1;
2293 eto2 = (EMRPOLYBEZIER16*)emr2;
2294
2295 diff = eto1->cpts != eto2->cpts;
2296 if(!diff)
2297 diff = memcmp(eto1->apts, eto2->apts, eto1->cpts * sizeof(POINTS));
2298 }
2299 else if (emr1->iType == EMR_POLYBEZIERTO || emr1->iType == EMR_POLYBEZIER)
2300 {
2301 EMRPOLYBEZIER *eto1, *eto2;
2302
2303 eto1 = (EMRPOLYBEZIER*)emr1;
2304 eto2 = (EMRPOLYBEZIER*)emr2;
2305
2306 diff = eto1->cptl != eto2->cptl;
2307 if(!diff)
2308 diff = memcmp(eto1->aptl, eto2->aptl, eto1->cptl * sizeof(POINTL));
2309 }
2310 else if (emr1->iType == EMR_PLGBLT && emr2->iType == EMR_PLGBLT)
2311 {
2312 EMRPLGBLT *eto1 = (EMRPLGBLT *)emr1;
2313 EMRPLGBLT *eto2 = (EMRPLGBLT *)emr2;
2314 diff = memcmp(emr1, emr2, sizeof(*emr1)) ||
2315 memcmp(&eto1->aptlDest, &eto2->aptlDest, emr1->nSize - FIELD_OFFSET(EMRPLGBLT, aptlDest));
2316 }
2317 else
2318 diff = memcmp(emr1, emr2, emr1->nSize);
2319
2320 ok(diff == 0, "%s: contents of record %lu don't match\n", desc, emr1->iType);
2321
2322 if (diff)
2323 {
2324 dump_emf_record(emr1, "expected bits");
2325 dump_emf_record(emr2, "actual bits");
2326 }
2327
2328 return diff == 0; /* report all non-fatal record mismatches */
2329}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void dump_emf_record(const ENHMETARECORD *emr, const char *desc)
Definition: metafile.c:2200
static void dump_EMREXTTEXTOUT(const EMREXTTEXTOUTW *eto)
Definition: metafile.c:2222
POINTL aptlDest[3]
Definition: wingdi.h:2519
POINTS apts[1]
Definition: wingdi.h:2563
DWORD cptl
Definition: wingdi.h:2556
POINTL aptl[1]
Definition: wingdi.h:2557
#define EMR_SETWINDOWEXTEX
Definition: wingdi.h:83
#define EMR_SETVIEWPORTEXTEX
Definition: wingdi.h:85
#define EMR_POLYBEZIER16
Definition: wingdi.h:158
#define EMR_PLGBLT
Definition: wingdi.h:152
#define EMR_POLYBEZIERTO16
Definition: wingdi.h:161
#define EMR_POLYBEZIER
Definition: wingdi.h:76
#define EMR_POLYBEZIERTO
Definition: wingdi.h:79
#define EMR_GDICOMMENT
Definition: wingdi.h:143

Referenced by compare_emf_bits().

◆ mf_enum_proc()

static INT CALLBACK mf_enum_proc ( HDC  hdc,
HANDLETABLE ht,
METARECORD mr,
INT  nobj,
LPARAM  param 
)
static

◆ near_match()

static BOOL near_match ( int  x,
int  y 
)
static

Definition at line 9038 of file metafile.c.

9039{
9040 int epsilon = min(abs(x), abs(y));
9041
9042 epsilon = max(epsilon/100, 2);
9043
9044 if(x < y - epsilon || x > y + epsilon) return FALSE;
9045 return TRUE;
9046}
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63

◆ pattern_brush_emf_enum_proc()

static int CALLBACK pattern_brush_emf_enum_proc ( HDC  hdc,
HANDLETABLE htable,
const ENHMETARECORD rec,
int  n,
LPARAM  arg 
)
static

Definition at line 4214 of file metafile.c.

4216{
4217 LOGBRUSH brush;
4218 BOOL ret;
4219
4220 switch (rec->iType)
4221 {
4222 case EMR_HEADER:
4223 case EMR_SELECTOBJECT:
4224 case EMR_EOF:
4226 return 1;
4228 ok(!htable->objectHandle[2], "objectHandle[2] already used\n");
4229 ret = PlayEnhMetaFileRecord(hdc, htable, rec, n);
4230 ok(ret, "PlayEnhMetaFileRecord failed\n");
4231 ok(htable->objectHandle[2] != NULL, "objectHandle[2] not created\n");
4232
4233 ret = GetObjectW(htable->objectHandle[2], sizeof(brush), &brush);
4234 ok(ret, "GetObjectW failed\n");
4235 ok(brush.lbStyle == BS_DIBPATTERN, "brush.lbStyle = %d\n", brush.lbStyle);
4236 ok(brush.lbHatch > (ULONG_PTR)rec && brush.lbHatch < (ULONG_PTR)rec + rec->nSize,
4237 "brush.lbHatch = %p, not in %p-%p range\n",
4238 (void *)brush.lbHatch, rec, (const BYTE *)rec + rec->nSize);
4239 return 1;
4240 default:
4241 ok(0, "unexpected record %lu\n", rec->iType);
4242 return 0;
4243 }
4244}
GLdouble n
Definition: glext.h:7729
HGDIOBJ objectHandle[1]
Definition: wingdi.h:2801
UINT lbStyle
Definition: wingdi.h:2193
ULONG_PTR lbHatch
Definition: wingdi.h:2195
uint32_t ULONG_PTR
Definition: typedefs.h:65
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define EMR_SELECTOBJECT
Definition: wingdi.h:111
#define EMR_CREATEMONOBRUSH
Definition: wingdi.h:166
#define EMR_EOF
Definition: wingdi.h:88
#define BS_DIBPATTERN
Definition: wingdi.h:1092
#define EMR_CREATEDIBPATTERNBRUSHPT
Definition: wingdi.h:167

Referenced by test_emf_pattern_brush().

◆ savedc_emf_enum_proc()

static int CALLBACK savedc_emf_enum_proc ( HDC  hdc,
HANDLETABLE handle_table,
const ENHMETARECORD emr,
int  n_objs,
LPARAM  param 
)
static

Definition at line 475 of file metafile.c.

477{
478 BOOL ret;
479 XFORM xform;
480 POINT pt;
481 SIZE size;
482 static int save_state;
483 static int restore_no;
484 static int select_no;
485
486 if (winetest_debug > 1)
487 trace("hdc %p, emr->iType %ld, emr->nSize %ld, param %p\n",
488 hdc, emr->iType, emr->nSize, (void *)param);
489
490 SetLastError(0xdeadbeef);
491 ret = GetWorldTransform(hdc, &xform);
493 {
495 ok(ret, "GetWindowOrgEx error %lu\n", GetLastError());
496 trace("window org (%ld,%ld)\n", pt.x, pt.y);
498 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
499 trace("vport org (%ld,%ld)\n", pt.x, pt.y);
501 ok(ret, "GetWindowExtEx error %lu\n", GetLastError());
502 trace("window ext (%ld,%ld)\n", size.cx, size.cy);
504 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
505 trace("vport ext (%ld,%ld)\n", size.cx, size.cy);
506 }
507 else
508 {
509 ok(ret, "GetWorldTransform error %lu\n", GetLastError());
510 if (winetest_debug > 1)
511 trace("eM11 %f, eM22 %f, eDx %f, eDy %f\n", xform.eM11, xform.eM22, xform.eDx, xform.eDy);
512 }
513
515
516 switch (emr->iType)
517 {
518 case EMR_HEADER:
519 {
520 static RECT exp_bounds = { 0, 0, 150, 150 };
521 RECT bounds;
522 const ENHMETAHEADER *emf = (const ENHMETAHEADER *)emr;
523
524 if (winetest_debug > 1)
525 {
526 trace("bounds %ld,%ld-%ld,%ld, frame %ld,%ld-%ld,%ld\n",
527 emf->rclBounds.left, emf->rclBounds.top, emf->rclBounds.right, emf->rclBounds.bottom,
528 emf->rclFrame.left, emf->rclFrame.top, emf->rclFrame.right, emf->rclFrame.bottom);
529 trace("mm %ld x %ld, device %ld x %ld\n", emf->szlMillimeters.cx, emf->szlMillimeters.cy,
530 emf->szlDevice.cx, emf->szlDevice.cy);
531 }
532
533 SetRect(&bounds, emf->rclBounds.left, emf->rclBounds.top, emf->rclBounds.right, emf->rclBounds.bottom);
534 ok(EqualRect(&bounds, &exp_bounds), "wrong bounds\n");
535
536 save_state = 0;
537 restore_no = 0;
538 select_no = 0;
539 check_dc_state(hdc, restore_no, 0, 0, 1, 1, 0, 0, 1, 1);
540 break;
541 }
542
543 case EMR_LINETO:
544 {
545 const EMRLINETO *line = (const EMRLINETO *)emr;
546 if (winetest_debug > 1) trace("EMR_LINETO %ld,%ld\n", line->ptl.x, line->ptl.x);
547 break;
548 }
550 {
551 const EMRSETWINDOWORGEX *org = (const EMRSETWINDOWORGEX *)emr;
552 if (winetest_debug > 1)
553 trace("EMR_SETWINDOWORGEX: %ld,%ld\n", org->ptlOrigin.x, org->ptlOrigin.y);
554 break;
555 }
557 {
558 const EMRSETWINDOWEXTEX *ext = (const EMRSETWINDOWEXTEX *)emr;
559 if (winetest_debug > 1)
560 trace("EMR_SETWINDOWEXTEX: %ld,%ld\n", ext->szlExtent.cx, ext->szlExtent.cy);
561 break;
562 }
564 {
565 const EMRSETVIEWPORTORGEX *org = (const EMRSETVIEWPORTORGEX *)emr;
566 if (winetest_debug > 1)
567 trace("EMR_SETVIEWPORTORGEX: %ld,%ld\n", org->ptlOrigin.x, org->ptlOrigin.y);
568 break;
569 }
571 {
572 const EMRSETVIEWPORTEXTEX *ext = (const EMRSETVIEWPORTEXTEX *)emr;
573 if (winetest_debug > 1)
574 trace("EMR_SETVIEWPORTEXTEX: %ld,%ld\n", ext->szlExtent.cx, ext->szlExtent.cy);
575 break;
576 }
577 case EMR_SAVEDC:
578 save_state++;
579 if (winetest_debug > 1) trace("EMR_SAVEDC\n");
580 break;
581
582 case EMR_RESTOREDC:
583 {
584 const EMRRESTOREDC *restoredc = (const EMRRESTOREDC *)emr;
585 if (winetest_debug > 1) trace("EMR_RESTOREDC: %ld\n", restoredc->iRelative);
586
587 switch(++restore_no)
588 {
589 case 1:
590 ok(restoredc->iRelative == -1, "first restore %ld\n", restoredc->iRelative);
591 check_dc_state(hdc, restore_no, -2, -2, 8192, 8192, 20, 20, 20479, 20478);
592 break;
593 case 2:
594 ok(restoredc->iRelative == -3, "second restore %ld\n", restoredc->iRelative);
595 check_dc_state(hdc, restore_no, 0, 0, 16384, 16384, 0, 0, 17873, 17872);
596 break;
597 case 3:
598 ok(restoredc->iRelative == -2, "third restore %ld\n", restoredc->iRelative);
599 check_dc_state(hdc, restore_no, -4, -4, 32767, 32767, 40, 40, 3276, 3276);
600 break;
601 }
602 ok(restore_no <= 3, "restore_no %d\n", restore_no);
603 save_state += restoredc->iRelative;
604 break;
605 }
606 case EMR_SELECTOBJECT:
607 {
608 const EMRSELECTOBJECT *selectobj = (const EMRSELECTOBJECT*)emr;
609 if (winetest_debug > 1) trace("EMR_SELECTOBJECT: %lx\n",selectobj->ihObject);
610 select_no ++;
611 break;
612 }
613 case EMR_EOF:
614 ok(save_state == 0, "EOF save_state %d\n", save_state);
615 ok(select_no == 3, "Too many/few selects %i\n",select_no);
616 break;
617 }
618
619 SetLastError(0xdeadbeef);
620 ret = GetWorldTransform(hdc, &xform);
622 {
624 ok(ret, "GetWindowOrgEx error %lu\n", GetLastError());
625 if (winetest_debug > 1) trace("window org (%ld,%ld)\n", pt.x, pt.y);
627 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
628 if (winetest_debug > 1) trace("vport org (%ld,%ld)\n", pt.x, pt.y);
630 ok(ret, "GetWindowExtEx error %lu\n", GetLastError());
631 if (winetest_debug > 1) trace("window ext (%ld,%ld)\n", size.cx, size.cy);
633 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
634 if (winetest_debug > 1) trace("vport ext (%ld,%ld)\n", size.cx, size.cy);
635 }
636 else
637 {
638 ok(ret, "GetWorldTransform error %lu\n", GetLastError());
639 if (winetest_debug > 1)
640 trace("eM11 %f, eM22 %f, eDx %f, eDy %f\n", xform.eM11, xform.eM22, xform.eDx, xform.eDy);
641 }
642
643 return 1;
644}
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
static const WCHAR *const ext[]
Definition: module.c:53
static char org[]
Definition: encode.c:7395
static void check_dc_state(HDC hdc, int restore_no, int wnd_org_x, int wnd_org_y, int wnd_ext_x, int wnd_ext_y, int vp_org_x, int vp_org_y, int vp_ext_x, int vp_ext_y)
Definition: metafile.c:440
Definition: parser.c:49
LONG iRelative
Definition: wingdi.h:2597
#define EMR_SAVEDC
Definition: wingdi.h:107
#define EMR_RESTOREDC
Definition: wingdi.h:108
BOOL WINAPI GetWindowOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:439
#define EMR_SETWINDOWORGEX
Definition: wingdi.h:84
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:411
#define EMR_SETVIEWPORTORGEX
Definition: wingdi.h:86
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:351
BOOL WINAPI GetViewportOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:383
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by test_SaveDC().

◆ set_rotation_xform()

static void set_rotation_xform ( XFORM out,
float  rad,
int  dx,
int  dy 
)
static

Definition at line 9715 of file metafile.c.

9716{
9717 out->eM11 = cosf(rad);
9718 out->eM12 = -1.f * sinf(rad);
9719 out->eM21 = sinf(rad);
9720 out->eM22 = cosf(rad);
9721 out->eDx = dx;
9722 out->eDy = dy;
9723}
_ACRTIMP float __cdecl cosf(float)
Definition: cosf.c:13
_ACRTIMP float __cdecl sinf(float)
Definition: sinf.c:13
GLint dy
Definition: linetemp.h:97
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by enum_emf_WorldTransform(), and test_emf_WorldTransform().

◆ START_TEST()

START_TEST ( metafile  )

Definition at line 10821 of file metafile.c.

10822{
10824
10825 /* For enhanced metafiles (enhmfdrv) */
10828 test_SaveDC();
10844 test_emf_blit();
10850
10851 /* For win-format metafiles (mfdrv) */
10853 test_mf_Blank();
10867 test_mf_attrs();
10870 test_mf_blit();
10872
10873 /* For metafile conversions */
10877
10878 test_gdiis();
10880}
static void test_emf_text_extents(void)
Definition: metafile.c:10694
static void test_mf_blit(void)
Definition: metafile.c:4910
static void test_mf_Graphics(void)
Definition: metafile.c:4044
static void test_emf_GradientFill(void)
Definition: metafile.c:9672
static void test_SetMetaFileBits(void)
Definition: metafile.c:3954
static void test_emf_pattern_brush(void)
Definition: metafile.c:4246
static void test_gdiis(void)
Definition: metafile.c:9258
static void test_mf_attrs(void)
Definition: metafile.c:3725
static void test_ExtTextOutScale(void)
Definition: metafile.c:336
static void test_mf_Blank(void)
Definition: metafile.c:3556
static void test_mf_DCBrush(void)
Definition: metafile.c:4367
static void test_mf_GetPath(void)
Definition: metafile.c:8636
static void test_SetEnhMetaFileBits(void)
Definition: metafile.c:9304
static void test_SetWinMetaFileBits(void)
Definition: metafile.c:8893
static void test_mf_palette(void)
Definition: metafile.c:4764
static void test_metafile_file(void)
Definition: metafile.c:3591
static void test_mf_SetPixel(void)
Definition: metafile.c:3689
static void test_CopyMetaFile(void)
Definition: metafile.c:3906
static void test_emf_WorldTransform(void)
Definition: metafile.c:9917
static void test_emf_paths(void)
Definition: metafile.c:9518
static void init_function_pointers(void)
Definition: metafile.c:48
static void test_emf_polybezier(void)
Definition: metafile.c:9350
static void test_ExtTextOut(void)
Definition: metafile.c:174
static void test_mf_conversions(void)
Definition: metafile.c:8750
static void test_emf_blit(void)
Definition: metafile.c:5032
static void test_emf_DCBrush(void)
Definition: metafile.c:3502
static void test_mf_SetLayout(void)
Definition: metafile.c:10778
static void test_emf_select(void)
Definition: metafile.c:4563
static void test_PlayMetaFile(void)
Definition: metafile.c:5113
static void test_mf_ExtTextOut_on_path(void)
Definition: metafile.c:8031
static void test_emf_palette(void)
Definition: metafile.c:4833
static void test_emf_attrs(void)
Definition: metafile.c:3882
static void test_emf_clipping(void)
Definition: metafile.c:8390
static void test_emf_SetDIBitsToDevice(void)
Definition: metafile.c:7900
static void test_emf_AlphaBlend(void)
Definition: metafile.c:10571
static void test_mf_select(void)
Definition: metafile.c:4414
static void test_enhmetafile_file(void)
Definition: metafile.c:3749
static void test_emf_BitBlt(void)
Definition: metafile.c:3371
static void test_mf_palette_brush(void)
Definition: metafile.c:4314
static void test_mf_FloodFill(void)
Definition: metafile.c:4099
static void test_GetWinMetaFileBits(void)
Definition: metafile.c:9226
static void test_emf_StretchDIBits(void)
Definition: metafile.c:6514
static void test_mf_PatternBrush(void)
Definition: metafile.c:4144
static void test_mf_SaveDC(void)
Definition: metafile.c:855
static void test_mf_clipping(void)
Definition: metafile.c:8566
static void test_SaveDC(void)
Definition: metafile.c:646
static void test_emf_PolyPolyline(void)
Definition: metafile.c:9618
static void test_emf_mask_blit(void)
Definition: metafile.c:5156
static void test_emf_ExtTextOut_on_path(void)
Definition: metafile.c:8084
static void test_emf_SetPixel(void)
Definition: metafile.c:3849

◆ test_CopyMetaFile()

static void test_CopyMetaFile ( void  )
static

Definition at line 3906 of file metafile.c.

3907{
3908 HDC hdcMetafile;
3909 HMETAFILE hMetafile, hmf_copy;
3910 BOOL ret;
3911 char temp_path[MAX_PATH];
3912 char mf_name[MAX_PATH];
3913 INT type;
3914
3915 hdcMetafile = CreateMetaFileA(NULL);
3916 ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
3917
3918 hMetafile = CloseMetaFile(hdcMetafile);
3919 ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
3920 type = GetObjectType(hMetafile);
3921 ok(type == OBJ_METAFILE, "CloseMetaFile created object with type %d\n", type);
3922
3923 if (compare_mf_bits (hMetafile, MF_BLANK_BITS, sizeof(MF_BLANK_BITS),
3924 "mf_blank") != 0)
3925 {
3926 dump_mf_bits(hMetafile, "mf_Blank");
3927 EnumMetaFile(0, hMetafile, mf_enum_proc, 0);
3928 }
3929
3931 GetTempFileNameA(temp_path, "wmf", 0, mf_name);
3932
3933 hmf_copy = CopyMetaFileA(hMetafile, mf_name);
3934 ok(hmf_copy != 0, "CopyMetaFile error %ld\n", GetLastError());
3935
3936 type = GetObjectType(hmf_copy);
3937 ok(type == OBJ_METAFILE, "CopyMetaFile created object with type %d\n", type);
3938
3939 ret = DeleteMetaFile(hMetafile);
3940 ok( ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
3941
3942 if (compare_mf_disk_bits(mf_name, MF_BLANK_BITS, sizeof(MF_BLANK_BITS), "mf_blank") != 0)
3943 {
3944 dump_mf_bits(hmf_copy, "mf_Blank");
3945 EnumMetaFile(0, hmf_copy, mf_enum_proc, 0);
3946 }
3947
3948 ret = DeleteMetaFile(hmf_copy);
3949 ok( ret, "DeleteMetaFile(%p) error %ld\n", hmf_copy, GetLastError());
3950
3951 DeleteFileA(mf_name);
3952}
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:1973
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static int compare_mf_disk_bits(LPCSTR name, const BYTE *bits, UINT bsize, const char *desc)
Definition: metafile.c:2113
static const unsigned char MF_BLANK_BITS[]
Definition: metafile.c:1021
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
#define OBJ_METAFILE
Definition: objidl.idl:1022
HMETAFILE WINAPI CopyMetaFileA(_In_ HMETAFILE hmfSrc, _In_opt_ LPCSTR pszFile)

Referenced by START_TEST().

◆ test_emf_AlphaBlend()

static void test_emf_AlphaBlend ( void  )
static

Definition at line 10571 of file metafile.c.

10572{
10573 static const XFORM xform = {0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};
10574 static const BLENDFUNCTION blend = {AC_SRC_OVER, 0, 128, 0};
10575 static const int bitmap_width = 4, bitmap_height = 4;
10576#ifdef __REACTOS__
10577 unsigned char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
10578#else
10579 unsigned char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
10580#endif
10581 BITMAPINFO *bmi = (BITMAPINFO *)bmi_buffer;
10582 HDC hdc, hdc_emf, hdc_emf2, hdc_bitmap;
10583 HBITMAP hbitmap, old_hbitmap;
10584 HENHMETAFILE hemf, hemf2;
10585 int ret, test_idx;
10586 char comment[64];
10587 void *bits;
10588
10589 static const struct
10590 {
10591 WORD bpp;
10593 const void *bits;
10594 size_t bits_count;
10595 DWORD used_color_count;
10596 DWORD color_count;
10597 RGBQUAD colors[3];
10598 }
10599 tests[] =
10600 {
10601 {1, BI_RGB, EMF_ALPHABLEND_1BIT, sizeof(EMF_ALPHABLEND_1BIT), 1, 1, {{0xff, 0xff, 0xff}}},
10602 {4, BI_RGB, EMF_ALPHABLEND_4BIT, sizeof(EMF_ALPHABLEND_4BIT), 1, 1, {{0xff, 0xff, 0xff}}},
10603 {8, BI_RGB, EMF_ALPHABLEND_8BIT, sizeof(EMF_ALPHABLEND_8BIT), 1, 1, {{0xff, 0xff, 0xff}}},
10607 {16, BI_BITFIELDS, EMF_ALPHABLEND_16BIT, sizeof(EMF_ALPHABLEND_16BIT), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
10608 {32, BI_BITFIELDS, EMF_ALPHABLEND_32BIT, sizeof(EMF_ALPHABLEND_32BIT), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
10609 };
10610
10611 hdc = GetDC(0);
10612
10613 /* Test that source DC cannot be an enhanced metafile */
10614 hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
10615 ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
10616 hdc_emf2 = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
10617 ok(!!hdc_emf2, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
10618
10619 ret = GdiAlphaBlend(hdc_emf, 0, 0, 1, 1, hdc_emf2, 0, 0, 1, 1, blend);
10620 ok(!ret, "GdiAlphaBlend succeeded\n");
10621
10622 hemf2 = CloseEnhMetaFile(hdc_emf2);
10623 ok(!!hemf2, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
10624 hemf = CloseEnhMetaFile(hdc_emf);
10625 ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
10626 DeleteEnhMetaFile(hemf2);
10627 DeleteEnhMetaFile(hemf);
10628
10629 /* Test AlphaBlend with different format of bitmaps */
10630 for (test_idx = 0; test_idx < ARRAY_SIZE(tests); ++test_idx)
10631 {
10632 memset(bmi_buffer, 0, sizeof(bmi_buffer));
10633 bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
10634 bmi->bmiHeader.biHeight = bitmap_width;
10635 bmi->bmiHeader.biWidth = bitmap_height;
10636 bmi->bmiHeader.biBitCount = tests[test_idx].bpp;
10637 bmi->bmiHeader.biPlanes = 1;
10638 bmi->bmiHeader.biCompression = tests[test_idx].compression;
10639 bmi->bmiHeader.biClrUsed = tests[test_idx].used_color_count;
10640 memcpy(bmi->bmiColors, tests[test_idx].colors, sizeof(RGBQUAD) * tests[test_idx].color_count);
10641
10643 ok(!!hbitmap, "Test %d: CreateDIBSection failed, error %ld\n", test_idx, GetLastError());
10644 hdc_bitmap = CreateCompatibleDC(hdc);
10645 ok(!!hdc_bitmap, "Test %d: CreateCompatibleDC failed, error %ld\n", test_idx, GetLastError());
10646 old_hbitmap = SelectObject(hdc_bitmap, hbitmap);
10647
10648 SetBkColor(hdc_bitmap, RGB(0xff, 0xff, 0xff));
10649 ret = SetGraphicsMode(hdc_bitmap, GM_ADVANCED);
10650 ok(ret, "Test %d: SetGraphicsMode failed, error %ld\n", test_idx, GetLastError());
10651 ret = SetWorldTransform(hdc_bitmap, &xform);
10652 ok(ret, "Test %d: SetWorldTransform failed, error %ld\n", test_idx, GetLastError());
10653 ret = SetMapMode(hdc_bitmap, MM_ANISOTROPIC);
10654 ok(ret, "Test %d: SetMapMode failed, error %ld\n", test_idx, GetLastError());
10655 ret = SetWindowOrgEx(hdc_bitmap, 0, 0, NULL);
10656 ok(ret, "Test %d: SetWindowOrgEx failed, error %ld\n", test_idx, GetLastError());
10657 ret = SetWindowExtEx(hdc_bitmap, 400, 400, NULL);
10658 ok(ret, "Test %d: SetWindowExtEx failed, error %ld\n", test_idx, GetLastError());
10659 ret = SetViewportOrgEx(hdc_bitmap, 0, 0, NULL);
10660 ok(ret, "Test %d: SetViewportOrgEx failed, error %ld\n", test_idx, GetLastError());
10661 ret = SetViewportExtEx(hdc_bitmap, bitmap_width, bitmap_height, NULL);
10662 ok(ret, "Test %d: SetViewportExtEx failed, error %ld\n", test_idx, GetLastError());
10663
10664 hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
10665 ok(!!hdc_emf, "Test %d: CreateEnhMetaFileW failed, error %ld\n", test_idx, GetLastError());
10666
10667 ret = BitBlt(hdc_emf, 0, 0, bitmap_width, bitmap_height, 0, 0, 0, WHITENESS);
10668 ok(ret, "Test %d: BitBlt failed, error %ld\n", test_idx, GetLastError());
10669 ret = BitBlt(hdc_bitmap, 0, 0, bitmap_width, bitmap_height, 0, 0, 0, BLACKNESS);
10670 ok(ret, "Test %d: BitBlt failed, error %ld\n", test_idx, GetLastError());
10671 ret = GdiAlphaBlend(hdc_emf, 0, 0, bitmap_width, bitmap_height, hdc_bitmap, 0, 0, 400, 400, blend);
10672 ok(ret, "Test %d: GdiAlphaBlend failed, error %ld\n", test_idx, GetLastError());
10673
10674 hemf = CloseEnhMetaFile(hdc_emf);
10675 ok(!!hemf, "Test %d: CloseEnhMetaFile failed, %ld\n", test_idx, GetLastError());
10676
10677 sprintf(comment, "test_emf_AlphaBlend() test %d", test_idx);
10678 ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count, comment, FALSE);
10679 if (ret)
10680 {
10681 dump_emf_bits(hemf, comment);
10683 }
10684
10685 DeleteEnhMetaFile(hemf);
10686 SelectObject(hdc_bitmap, old_hbitmap);
10687 DeleteDC(hdc_bitmap);
10689 }
10690
10691 ReleaseDC(0, hdc);
10692}
static HBITMAP hbitmap
#define ARRAY_SIZE(A)
Definition: main.h:20
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t compression
Definition: btrfs_drv.h:1365
DWORD bpp
Definition: surface.c:185
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
ULONG RGBQUAD
Definition: precomp.h:47
#define bits
Definition: infblock.c:15
#define BI_BITFIELDS
Definition: mmreg.h:507
static struct test_info tests[]
BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heightDst, HDC hdcSrc, int xSrc, int ySrc, int widthSrc, int heightSrc, BLENDFUNCTION blendFunction)
static HBITMAP
Definition: button.c:44
#define comment(fmt, arg1)
Definition: rebar.c:847
static const unsigned char EMF_ALPHABLEND_1BIT[]
Definition: metafile.c:9982
static const unsigned char EMF_ALPHABLEND_32BIT_888[]
Definition: metafile.c:10449
static void dump_emf_records(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:2176
static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc, BOOL ignore_scaling)
Definition: metafile.c:2337
static void dump_emf_bits(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:2152
static const unsigned char EMF_ALPHABLEND_32BIT[]
Definition: metafile.c:10510
static const unsigned char EMF_ALPHABLEND_8BIT[]
Definition: metafile.c:10097
static const unsigned char EMF_ALPHABLEND_24BIT[]
Definition: metafile.c:10392
static const unsigned char EMF_ALPHABLEND_16BIT[]
Definition: metafile.c:10278
static const unsigned char EMF_ALPHABLEND_4BIT[]
Definition: metafile.c:10036
static const unsigned char EMF_ALPHABLEND_16BIT_555[]
Definition: metafile.c:10335
USHORT biBitCount
Definition: precomp.h:34
ULONG biCompression
Definition: precomp.h:35
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1922
RGBQUAD bmiColors[1]
Definition: wingdi.h:1923
#define BI_RGB
Definition: uefivid.c:46
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define BLACKNESS
Definition: wingdi.h:323
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
Definition: dc.c:1233
#define GM_ADVANCED
Definition: wingdi.h:865
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define WHITENESS
Definition: wingdi.h:337
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
Definition: coord.c:465
#define AC_SRC_OVER
Definition: wingdi.h:1369
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
HDC WINAPI CreateEnhMetaFileW(_In_opt_ HDC, _In_opt_ LPCWSTR, _In_opt_ LPCRECT, _In_opt_ LPCWSTR)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
BOOL WINAPI SetWorldTransform(_In_ HDC, _In_ const XFORM *)
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by START_TEST().

◆ test_emf_attrs()

static void test_emf_attrs ( void  )
static

Definition at line 3882 of file metafile.c.

3883{
3884 HENHMETAFILE mf;
3885 UINT attr;
3886 HDC hdc;
3887
3889 ok(hdc != 0, "CreateEnhMetaFile failed\n");
3890
3892 ok(attr == 0, "attr = %x\n", attr);
3894 ok(attr == TA_BOTTOM, "attr = %x\n", attr);
3895
3897 ok(attr == OPAQUE, "attr = %x\n", attr);
3899 ok(attr == TRANSPARENT, "attr = %x\n", attr);
3900
3901 mf = CloseEnhMetaFile(hdc);
3902 ok(mf != 0, "CloseEnhMetaFile failed\n");
3904}
Definition: cookie.c:202
UINT WINAPI SetTextAlign(_In_ HDC, _In_ UINT)
Definition: text.c:882
#define TRANSPARENT
Definition: wingdi.h:950
#define TA_TOP
Definition: wingdi.h:930
#define TA_BOTTOM
Definition: wingdi.h:929
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056

Referenced by START_TEST().

◆ test_emf_BitBlt()

static void test_emf_BitBlt ( void  )
static

Definition at line 3371 of file metafile.c.

3372{
3373 static const XFORM xform = {0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};
3374 static const int bitmap_width = 4, bitmap_height = 4;
3375#ifdef __REACTOS__
3376 unsigned char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
3377#else
3378 unsigned char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
3379#endif
3380 BITMAPINFO *bmi = (BITMAPINFO *)bmi_buffer;
3381 HDC hdc, hdc_emf, hdc_emf2, hdc_bitmap;
3382 HBITMAP hbitmap, old_hbitmap;
3383 HENHMETAFILE hemf, hemf2;
3384 int ret, test_idx;
3385 void *bits;
3386
3387 static const struct
3388 {
3389 WORD bpp;
3390 int src_width;
3391 int src_height;
3393 const void *bits;
3394 size_t bits_count;
3395 DWORD used_color_count;
3396 DWORD color_count;
3397 RGBQUAD colors[3];
3398 }
3399 tests[] =
3400 {
3401 {1, 3, 3, BI_RGB, EMF_STRETCHBLT_1BIT_3X3, sizeof(EMF_STRETCHBLT_1BIT_3X3), 1, 1, {{0xff, 0xff, 0xff}}},
3402 {4, 3, 3, BI_RGB, EMF_STRETCHBLT_4BIT_3X3, sizeof(EMF_STRETCHBLT_4BIT_3X3), 1, 1, {{0xff, 0xff, 0xff}}},
3403 {8, 3, 3, BI_RGB, EMF_STRETCHBLT_8BIT_3X3, sizeof(EMF_STRETCHBLT_8BIT_3X3), 1, 1, {{0xff, 0xff, 0xff}}},
3407 {16, 3, 3, BI_BITFIELDS, EMF_STRETCHBLT_16BIT_3X3, sizeof(EMF_STRETCHBLT_16BIT_3X3), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
3408 {32, 3, 3, BI_BITFIELDS, EMF_STRETCHBLT_32BIT_3X3, sizeof(EMF_STRETCHBLT_32BIT_3X3), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
3409 {1, 4, 4, BI_RGB, EMF_BITBLT_1BIT_4X4, sizeof(EMF_BITBLT_1BIT_4X4), 1, 1, {{0xff, 0xff, 0xff}}},
3410 {4, 4, 4, BI_RGB, EMF_BITBLT_4BIT_4X4, sizeof(EMF_BITBLT_4BIT_4X4), 1, 1, {{0xff, 0xff, 0xff}}},
3411 {8, 4, 4, BI_RGB, EMF_BITBLT_8BIT_4X4, sizeof(EMF_BITBLT_8BIT_4X4), 1, 1, {{0xff, 0xff, 0xff}}},
3413 {24, 4, 4, BI_RGB, EMF_BITBLT_24BIT_4X4, sizeof(EMF_BITBLT_24BIT_4X4)},
3415 {16, 4, 4, BI_BITFIELDS, EMF_BITBLT_16BIT_4X4, sizeof(EMF_BITBLT_16BIT_4X4), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
3416 {32, 4, 4, BI_BITFIELDS, EMF_BITBLT_32BIT_4X4, sizeof(EMF_BITBLT_32BIT_4X4), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
3417 };
3418
3419 hdc = GetDC(0);
3420
3421 /* Test that source DC cannot be an enhanced metafile */
3422 hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
3423 ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
3424 hdc_emf2 = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
3425 ok(!!hdc_emf2, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
3426
3427 ret = StretchBlt(hdc_emf, 0, 0, 1, 1, hdc_emf2, 0, 0, 1, 1, SRCCOPY);
3428 ok(!ret, "StretchBlt succeeded\n");
3429
3430 hemf2 = CloseEnhMetaFile(hdc_emf2);
3431 ok(!!hemf2, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
3432 hemf = CloseEnhMetaFile(hdc_emf);
3433 ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
3434 DeleteEnhMetaFile(hemf2);
3435 DeleteEnhMetaFile(hemf);
3436
3437 for (test_idx = 0; test_idx < ARRAY_SIZE(tests); ++test_idx)
3438 {
3439 winetest_push_context("Test %d", test_idx);
3440
3441 memset(bmi_buffer, 0, sizeof(bmi_buffer));
3442 bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
3443 bmi->bmiHeader.biHeight = bitmap_width;
3444 bmi->bmiHeader.biWidth = bitmap_height;
3445 bmi->bmiHeader.biBitCount = tests[test_idx].bpp;
3446 bmi->bmiHeader.biPlanes = 1;
3447 bmi->bmiHeader.biCompression = tests[test_idx].compression;
3448 bmi->bmiHeader.biClrUsed = tests[test_idx].used_color_count;
3449 memcpy(bmi->bmiColors, tests[test_idx].colors, sizeof(RGBQUAD) * tests[test_idx].color_count);
3450
3452 ok(!!hbitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
3453 hdc_bitmap = CreateCompatibleDC(hdc);
3454 ok(!!hdc_bitmap, "CreateCompatibleDC failed, error %ld\n", GetLastError());
3455 old_hbitmap = SelectObject(hdc_bitmap, hbitmap);
3456
3457 SetBkColor(hdc_bitmap, RGB(0xff, 0xff, 0xff));
3458 ret = SetGraphicsMode(hdc_bitmap, GM_ADVANCED);
3459 ok(ret, "SetGraphicsMode failed, error %ld\n", GetLastError());
3460 ret = SetWorldTransform(hdc_bitmap, &xform);
3461 ok(ret, "SetWorldTransform failed, error %ld\n", GetLastError());
3462
3463 hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
3464 ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
3465
3466 ret = BitBlt(hdc_bitmap, 0, 0, bitmap_width, bitmap_height, 0, 0, 0, BLACKNESS);
3467 ok(ret, "BitBlt failed, error %ld\n", GetLastError());
3468 if (tests[test_idx].src_width == bitmap_width && tests[test_idx].src_height == bitmap_height)
3469 {
3470 ret = BitBlt(hdc_emf, 0, 0, bitmap_width, bitmap_height, hdc_bitmap, 0, 0, SRCCOPY);
3471 ok(ret, "BitBlt failed, error %ld\n", GetLastError());
3472 }
3473 else
3474 {
3475 ret = StretchBlt(hdc_emf, 0, 0, bitmap_width, bitmap_height, hdc_bitmap, 0, 0,
3476 tests[test_idx].src_width, tests[test_idx].src_height, SRCCOPY);
3477 ok(ret, "StretchBlt failed, error %ld\n", GetLastError());
3478 }
3479
3480 hemf = CloseEnhMetaFile(hdc_emf);
3481 ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
3482
3483 ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count,
3484 "test_emf_BitBlt", FALSE);
3485 if (ret)
3486 {
3487 dump_emf_bits(hemf, "test_emf_BitBlt");
3488 dump_emf_records(hemf, "test_emf_BitBlt");
3489 }
3490
3491 DeleteEnhMetaFile(hemf);
3492 SelectObject(hdc_bitmap, old_hbitmap);
3493 DeleteDC(hdc_bitmap);
3495
3497 }
3498
3499 ReleaseDC(0, hdc);
3500}
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:537
static const unsigned char EMF_BITBLT_32BIT_888_4X4[]
Definition: metafile.c:3233
static const unsigned char EMF_BITBLT_16BIT_4X4[]
Definition: metafile.c:3280
static const unsigned char EMF_STRETCHBLT_24BIT_3X3[]
Definition: metafile.c:2704
static const unsigned char EMF_STRETCHBLT_1BIT_3X3[]
Definition: metafile.c:2400
static const unsigned char EMF_BITBLT_24BIT_4X4[]
Definition: metafile.c:3189
static const unsigned char EMF_BITBLT_4BIT_4X4[]
Definition: metafile.c:2930
static const unsigned char EMF_STRETCHBLT_16BIT_555_3X3[]
Definition: metafile.c:2660
static const unsigned char EMF_BITBLT_1BIT_4X4[]
Definition: metafile.c:2889
static const unsigned char EMF_STRETCHBLT_8BIT_3X3[]
Definition: metafile.c:2491
static const unsigned char EMF_BITBLT_8BIT_4X4[]
Definition: metafile.c:2978
static const unsigned char EMF_STRETCHBLT_4BIT_3X3[]
Definition: metafile.c:2442
static const unsigned char EMF_STRETCHBLT_16BIT_3X3[]
Definition: metafile.c:2797
static const unsigned char EMF_STRETCHBLT_32BIT_3X3[]
Definition: metafile.c:2841
static const unsigned char EMF_BITBLT_32BIT_4X4[]
Definition: metafile.c:3323
static const unsigned char EMF_BITBLT_16BIT_555_4X4[]
Definition: metafile.c:3146
static const unsigned char EMF_STRETCHBLT_32BIT_888_3X3[]
Definition: metafile.c:2749
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define SRCCOPY
Definition: wingdi.h:333

Referenced by START_TEST().

◆ test_emf_blit()

static void test_emf_blit ( void  )
static

Definition at line 5032 of file metafile.c.

5033{
5034 BITMAPINFO bmi = {{ sizeof(bmi) }};
5035 HENHMETAFILE hmf;
5036 HBITMAP bitmap, old_bitmap;
5037 void *bits;
5038 HDC hdc, dib_hdc;
5039 unsigned int i;
5040 BOOL ret;
5041
5043 ok(hdc != 0, "CreateMetaFileA failed\n");
5044
5045 ret = PatBlt(hdc, 2, 3, 4, 5, PATCOPY);
5046 ok(ret, "PatBlt failed\n");
5047
5048 dib_hdc = CreateCompatibleDC(NULL);
5049 ok(!!dib_hdc, "CreateCompatibleDC failed\n");
5050
5051 bmi.bmiHeader.biHeight = 3;
5052 bmi.bmiHeader.biWidth = 4;
5053 bmi.bmiHeader.biBitCount = 24;
5054 bmi.bmiHeader.biPlanes = 1;
5056 bitmap = CreateDIBSection(dib_hdc, &bmi, DIB_RGB_COLORS, &bits, NULL, 0);
5057 ok(!!bitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
5058 for (i = 0; i < bmi.bmiHeader.biHeight * bmi.bmiHeader.biWidth * 3; i++)
5059 ((BYTE *)bits)[i] = i + 10;
5060
5061 old_bitmap = SelectObject(dib_hdc, bitmap);
5062 ok(!!old_bitmap, "SelectObject failed\n");
5063
5064 ret = StretchBlt(hdc, 1, 2, 4, 6, dib_hdc, 0, 0, 2, 3, SRCCOPY);
5065 ok(ret, "StretchBlt failed\n");
5066
5067 /* PATCOPY is recorded as PatBlt */
5068 ret = StretchBlt(hdc, 1, 2, 4, 6, dib_hdc, 0, 0, 2, 3, PATCOPY);
5069 ok(ret, "StretchBlt failed\n");
5070
5071 /* same src and dst size, still recorded as StretchBlt */
5072 ret = StretchBlt(hdc, 1, 2, 2, 3, dib_hdc, 0, 0, 2, 3, SRCCOPY);
5073 ok(ret, "StretchBlt failed\n");
5074
5075 ret = BitBlt(hdc, 1, 2, 2, 3, dib_hdc, 0, 0, SRCCOPY);
5076 ok(ret, "BitBlt failed\n");
5077
5078 ret = GdiTransparentBlt(hdc, 1, 2, 2, 3, dib_hdc, 0, 0, 2, 3, RGB(10,20,30));
5079 ok(ret, "GdiTransparentBlt failed\n");
5080
5081 DeleteDC(dib_hdc);
5083
5084 hmf = CloseEnhMetaFile(hdc);
5085 ok(hmf != 0, "CloseMetaFile failed\n");
5086
5087 if (compare_emf_bits(hmf, emf_blit_bits, sizeof(emf_blit_bits), "emf_blit", FALSE) != 0)
5088 {
5089 dump_emf_bits(hmf, "emf_blit");
5090 dump_emf_records(hmf, "emf_blit");
5091 }
5092
5093 ret = DeleteEnhMetaFile(hmf);
5094 ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
5095}
static const unsigned char emf_blit_bits[]
Definition: metafile.c:1790
Definition: uimain.c:89
BOOL WINAPI GdiTransparentBlt(HDC hdcDst, int xDst, int yDst, int wDst, int hDst, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, UINT crTransparent)
#define PATCOPY
Definition: wingdi.h:335
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)

Referenced by START_TEST().

◆ test_emf_clipping()

static void test_emf_clipping ( void  )
static

Definition at line 8390 of file metafile.c.

8391{
8392 char buffer[100];
8393 RGNDATA *rgndata = (RGNDATA *)buffer;
8394 static const RECT rc = { 0, 0, 100, 100 };
8395 RECT rc_clip = { 100, 100, 1024, 1024 };
8396 HWND hwnd;
8397 HDC hdc;
8398 HENHMETAFILE hemf;
8399 HRGN hrgn;
8400 INT ret;
8401 RECT rc_res, rc_sclip;
8402
8403 SetLastError(0xdeadbeef);
8405 ok(hdc != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
8406
8407 /* Need to write something to the emf, otherwise Windows won't play it back */
8408 LineTo(hdc, 1, 1);
8409
8410 hrgn = CreateRectRgn(rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
8412 ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
8413
8414 BeginPath(hdc);
8415 Rectangle(hdc, rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
8416 EndPath(hdc);
8418 ok(ret, "SelectClipPath error %ld\n", GetLastError());
8419
8420 SetLastError(0xdeadbeef);
8421 hemf = CloseEnhMetaFile(hdc);
8422 ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
8423
8424 if (compare_emf_bits(hemf, EMF_CLIPPING, sizeof(EMF_CLIPPING),
8425 "emf_clipping", FALSE) != 0)
8426 {
8427 dump_emf_bits(hemf, "emf_clipping");
8428 dump_emf_records(hemf, "emf_clipping");
8429 }
8430
8432
8433 /* Win9x doesn't play EMFs on invisible windows */
8434 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
8435 0, 0, 200, 200, 0, 0, 0, NULL);
8436 ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
8437
8438 hdc = GetDC(hwnd);
8439
8440 ret = EnumEnhMetaFile(hdc, hemf, clip_emf_enum_proc, &rc_clip, &rc);
8441 ok(ret, "EnumEnhMetaFile error %ld\n", GetLastError());
8442
8443 DeleteEnhMetaFile(hemf);
8444 ReleaseDC(hwnd, hdc);
8446
8448
8450 hrgn = CreateRectRgn(rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom);
8452 SetRect(&rc_res, -1, -1, -1, -1);
8453 ret = GetClipBox(hdc, &rc_res);
8454 ok(ret == SIMPLEREGION, "got %d\n", ret);
8455 ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
8456 wine_dbgstr_rect(&rc_res));
8457
8458 OffsetRect(&rc_sclip, -100, -100);
8459 ret = OffsetClipRgn(hdc, -100, -100);
8460 ok(ret == SIMPLEREGION, "got %d\n", ret);
8461 SetRect(&rc_res, -1, -1, -1, -1);
8462 ret = GetClipBox(hdc, &rc_res);
8463 ok(ret == SIMPLEREGION, "got %d\n", ret);
8464 ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
8465 wine_dbgstr_rect(&rc_res));
8466
8467 ret = IntersectClipRect(hdc, 0, 0, 100, 100);
8468 /* all versions of Windows return COMPLEXREGION despite the region comprising one rectangle */
8469 ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "wrong region type %d\n", ret);
8470 ret = GetClipRgn(hdc, hrgn);
8471 ok(ret == 1, "expected 1, got %d\n", ret);
8472 ret = GetRegionData(hrgn, sizeof(buffer), rgndata);
8473 ok(ret == sizeof(RGNDATAHEADER) + sizeof(RECT), "got %u\n", ret);
8474 ok(rgndata->rdh.nCount == 1, "got %lu rectangles\n", rgndata->rdh.nCount);
8475 ok(EqualRect((RECT *)rgndata->Buffer, &rc), "got rect %s\n", wine_dbgstr_rect((RECT *)rgndata->Buffer));
8476 SetRect(&rc_res, -1, -1, -1, -1);
8477 ret = GetClipBox(hdc, &rc_res);
8478 ok(ret == SIMPLEREGION, "got %d\n", ret);
8479 ok(EqualRect(&rc_res, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rc),
8480 wine_dbgstr_rect(&rc_res));
8481
8482 SetRect(&rc_sclip, 0, 0, 100, 50);
8483 ret = ExcludeClipRect(hdc, 0, 50, 100, 100);
8484 /* all versions of Windows return COMPLEXREGION despite the region comprising one rectangle */
8485 ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "wrong region type %d\n", ret);
8486 ret = GetClipRgn(hdc, hrgn);
8487 ok(ret == 1, "expected 1, got %d\n", ret);
8488 ret = GetRegionData(hrgn, sizeof(buffer), rgndata);
8489 ok(ret == sizeof(RGNDATAHEADER) + sizeof(RECT), "got %u\n", ret);
8490 ok(rgndata->rdh.nCount == 1, "got %lu rectangles\n", rgndata->rdh.nCount);
8491 ok(EqualRect((RECT *)rgndata->Buffer, &rc_sclip), "got rect %s\n", wine_dbgstr_rect((RECT *)rgndata->Buffer));
8492 SetRect(&rc_res, -1, -1, -1, -1);
8493 ret = GetClipBox(hdc, &rc_res);
8494 ok(ret == SIMPLEREGION, "got %d\n", ret);
8495 ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
8496 wine_dbgstr_rect(&rc_res));
8497
8498 hemf = CloseEnhMetaFile(hdc);
8499 DeleteEnhMetaFile(hemf);
8501}
static int CALLBACK clip_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param)
Definition: metafile.c:8289
static const unsigned char EMF_CLIPPING[]
Definition: metafile.c:8231
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
RGNDATAHEADER rdh
Definition: axextend.idl:399
char Buffer[1]
Definition: axextend.idl:400
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define COMPLEXREGION
Definition: wingdi.h:363
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI ExcludeClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI SelectClipPath(_In_ HDC, _In_ int)
#define RGN_AND
Definition: wingdi.h:356
#define SIMPLEREGION
Definition: wingdi.h:362
BOOL WINAPI EnumEnhMetaFile(_In_opt_ HDC, _In_ HENHMETAFILE, _In_ ENHMFENUMPROC, _In_opt_ PVOID, _In_opt_ LPCRECT)
int WINAPI OffsetClipRgn(_In_ HDC, _In_ int, _In_ int)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
BOOL WINAPI EndPath(_In_ HDC)
BOOL WINAPI BeginPath(_In_ HDC hdc)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define SM_CYSCREEN
Definition: winuser.h:971
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SM_CXSCREEN
Definition: winuser.h:970
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)

Referenced by START_TEST().

◆ test_emf_DCBrush()

static void test_emf_DCBrush ( void  )
static

Definition at line 3502 of file metafile.c.

3503{
3504 HDC hdcMetafile;
3505 HENHMETAFILE hMetafile;
3506 HBRUSH hBrush;
3507 HPEN hPen;
3508 BOOL ret;
3510
3511 if (!pSetDCBrushColor || !pSetDCPenColor)
3512 {
3513 win_skip( "SetDCBrush/PenColor not supported\n" );
3514 return;
3515 }
3516
3517 hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
3518 ok( hdcMetafile != 0, "CreateEnhMetaFileA failed\n" );
3519
3520 hBrush = SelectObject(hdcMetafile, GetStockObject(DC_BRUSH));
3521 ok(hBrush != 0, "SelectObject error %ld.\n", GetLastError());
3522
3523 hPen = SelectObject(hdcMetafile, GetStockObject(DC_PEN));
3524 ok(hPen != 0, "SelectObject error %ld.\n", GetLastError());
3525
3526 color = pSetDCBrushColor( hdcMetafile, RGB(0x55,0x55,0x55) );
3527 ok( color == 0xffffff, "SetDCBrushColor returned %lx\n", color );
3528
3529 color = pSetDCPenColor( hdcMetafile, RGB(0x33,0x44,0x55) );
3530 ok( color == 0, "SetDCPenColor returned %lx\n", color );
3531
3532 Rectangle( hdcMetafile, 10, 10, 20, 20 );
3533
3534 color = pSetDCBrushColor( hdcMetafile, RGB(0x12,0x34,0x56) );
3535 ok( color == 0x555555, "SetDCBrushColor returned %lx\n", color );
3536
3537 hMetafile = CloseEnhMetaFile(hdcMetafile);
3538 ok( hMetafile != 0, "CloseEnhMetaFile failed\n" );
3539
3540 if (compare_emf_bits (hMetafile, EMF_DCBRUSH_BITS, sizeof(EMF_DCBRUSH_BITS),
3541 "emf_DC_Brush", FALSE ) != 0)
3542 {
3543 dump_emf_bits(hMetafile, "emf_DC_Brush");
3544 dump_emf_records(hMetafile, "emf_DC_Brush");
3545 }
3546 ret = DeleteEnhMetaFile(hMetafile);
3547 ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
3548 ret = DeleteObject(hBrush);
3549 ok( ret, "DeleteObject(HBRUSH) error %ld\n", GetLastError());
3550 ret = DeleteObject(hPen);
3551 ok( ret, "DeleteObject(HPEN) error %ld\n", GetLastError());
3552}
GLuint color
Definition: glext.h:6243
#define win_skip
Definition: minitest.h:67
static const unsigned char EMF_DCBRUSH_BITS[]
Definition: metafile.c:1305
DWORD COLORREF
Definition: windef.h:100
HGDIOBJ WINAPI GetStockObject(_In_ int)

Referenced by START_TEST().

◆ test_emf_ExtTextOut_on_path()

static void test_emf_ExtTextOut_on_path ( void  )
static

Definition at line 8084 of file metafile.c.

8085{
8086 HWND hwnd;
8087 HDC hdcDisplay, hdcMetafile;
8088 HENHMETAFILE hMetafile;
8089 BOOL ret;
8090 LOGFONTA lf;
8091 HFONT hFont;
8092 static const INT dx[4] = { 3, 5, 8, 12 };
8093 RECT rect = { 10, 20, 30, 40 };
8094
8095 /* Win9x doesn't play EMFs on invisible windows */
8096 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
8097 0, 0, 200, 200, 0, 0, 0, NULL);
8098 ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
8099
8100 hdcDisplay = GetDC(hwnd);
8101 ok(hdcDisplay != 0, "GetDC error %ld\n", GetLastError());
8102
8103 /* with default font */
8104 ret = BeginPath(hdcDisplay);
8105 ok(ret, "BeginPath error %ld\n", GetLastError());
8106
8107 ret = ExtTextOutA(hdcDisplay, 11, 22, 0, NULL, "Test", 4, dx);
8108 ok(ret, "ExtTextOut error %ld\n", GetLastError());
8109
8110 ret = EndPath(hdcDisplay);
8111 ok(ret, "EndPath error %ld\n", GetLastError());
8112
8113 ret = GetPath(hdcDisplay, NULL, NULL, 0);
8114 ok(!ret, "expected 0, got %d\n", ret);
8115
8116 hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
8117 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
8118
8119 ret = BeginPath(hdcMetafile);
8120 ok(ret, "BeginPath error %ld\n", GetLastError());
8121
8122 ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
8123 ok(ret, "ExtTextOut error %ld\n", GetLastError());
8124
8125 ret = EndPath(hdcMetafile);
8126 ok(ret, "EndPath error %ld\n", GetLastError());
8127
8128 ret = GetPath(hdcMetafile, NULL, NULL, 0);
8129 ok(!ret, "expected 0, got %d\n", ret);
8130
8131 hMetafile = CloseEnhMetaFile(hdcMetafile);
8132 ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
8133
8134 /* this doesn't succeed yet: EMF has correct size, all EMF records
8135 * are there, but their contents don't match for different reasons.
8136 */
8138 "emf_TextOut_on_path", FALSE) != 0)
8139 {
8140 dump_emf_bits(hMetafile, "emf_TextOut_on_path");
8141 dump_emf_records(hMetafile, "emf_TextOut_on_path");
8142 }
8143
8144 ret = DeleteEnhMetaFile(hMetafile);
8145 ok(ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
8146
8147 /* with outline font */
8148 memset(&lf, 0, sizeof(lf));
8151 lf.lfWeight = FW_DONTCARE;
8152 lf.lfHeight = 7;
8154 lstrcpyA(lf.lfFaceName, "Tahoma");
8156 ok(hFont != 0, "CreateFontIndirectA error %ld\n", GetLastError());
8157 hFont = SelectObject(hdcDisplay, hFont);
8158
8159 ret = BeginPath(hdcDisplay);
8160 ok(ret, "BeginPath error %ld\n", GetLastError());
8161
8162 ret = ExtTextOutA(hdcDisplay, 11, 22, 0, NULL, "Test", 4, dx);
8163 ok(ret, "ExtTextOut error %ld\n", GetLastError());
8164
8165 ret = EndPath(hdcDisplay);
8166 ok(ret, "EndPath error %ld\n", GetLastError());
8167
8168 ret = GetPath(hdcDisplay, NULL, NULL, 0);
8169 ok(ret != 0, "expected != 0\n");
8170
8171 SelectObject(hdcDisplay, hFont);
8172
8173 hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
8174 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
8175
8176 hFont = SelectObject(hdcMetafile, hFont);
8177
8178 ret = BeginPath(hdcMetafile);
8179 ok(ret, "BeginPath error %ld\n", GetLastError());
8180
8181 ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
8182 ok(ret, "ExtTextOut error %ld\n", GetLastError());
8183
8184 ret = EndPath(hdcMetafile);
8185 ok(ret, "EndPath error %ld\n", GetLastError());
8186
8187 ret = GetPath(hdcMetafile, NULL, NULL, 0);
8188 ok(!ret, "expected 0, got %d\n", ret);
8189
8190 hFont = SelectObject(hdcMetafile, hFont);
8192
8193 hMetafile = CloseEnhMetaFile(hdcMetafile);
8194 ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
8195
8197 "emf_TextOut_outline_on_path", FALSE) != 0)
8198 {
8199 dump_emf_bits(hMetafile, "emf_TextOut_outline_on_path");
8200 dump_emf_records(hMetafile, "emf_TextOut_outline_on_path");
8201 }
8202
8203 ret = DeleteEnhMetaFile(hMetafile);
8204 ok(ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
8205
8206 /* test ExtTextOut with count == -1 doesn't get written */
8207 hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
8208 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
8209
8210 ret = ExtTextOutA(hdcMetafile, 11, 22, ETO_OPAQUE, &rect, "Test", -1, dx);
8211 ok(!ret, "ExtTextOut error %ld\n", GetLastError());
8212
8213 hMetafile = CloseEnhMetaFile(hdcMetafile);
8214 ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
8215
8216 if (compare_emf_bits(hMetafile, EMF_EMPTY_BITS, sizeof(EMF_EMPTY_BITS),
8217 "emf_TextOut_negative_count", FALSE) != 0)
8218 {
8219 dump_emf_bits(hMetafile, "emf_TextOut_negative_count");
8220 dump_emf_records(hMetafile, "emf_TextOut_negative_count");
8221 }
8222
8223 ret = DeleteEnhMetaFile(hMetafile);
8224 ok(ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
8225
8226 ret = ReleaseDC(hwnd, hdcDisplay);
8227 ok(ret, "ReleaseDC error %ld\n", GetLastError());
8229}
HFONT hFont
Definition: main.c:53
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static const unsigned char EMF_EMPTY_BITS[]
Definition: metafile.c:8064
static const unsigned char EMF_TEXTOUT_ON_PATH_BITS[]
Definition: metafile.c:1108
static const unsigned char EMF_TEXTOUT_OUTLINE_ON_PATH_BITS[]
Definition: metafile.c:1143
BYTE lfClipPrecision
Definition: dimm.idl:52
BYTE lfQuality
Definition: dimm.idl:53
LONG lfHeight
Definition: dimm.idl:42
BYTE lfCharSet
Definition: dimm.idl:50
LONG lfWeight
Definition: dimm.idl:46
#define FW_DONTCARE
Definition: wingdi.h:368
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
#define DEFAULT_QUALITY
Definition: wingdi.h:436
BOOL WINAPI ExtTextOutA(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
#define ANSI_CHARSET
Definition: wingdi.h:383
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
int WINAPI GetPath(_In_ HDC hdc, _Out_writes_opt_(cpt) LPPOINT apt, _Out_writes_opt_(cpt) LPBYTE aj, int cpt)

Referenced by START_TEST().

◆ test_emf_GradientFill()

static void test_emf_GradientFill ( void  )
static

Definition at line 9672 of file metafile.c.

9673{
9674 HDC mf;
9675 HENHMETAFILE hemf;
9676 TRIVERTEX v[] =
9677 {
9678 { 1, 10, 0xff00, 0x8000, 0x0000, 0x8001 },
9679 { 200, 210, 0x0000, 0x0000, 0xff00, 0xff00 },
9680 { 180, 190, 0x1234, 0x5678, 0x9abc, 0xdef0 },
9681 { 300, 310, 0xff00, 0xff00, 0xff00, 0x0000 },
9682 { 400, 410, 0xff00, 0xff00, 0xff00, 0x0000 }
9683 };
9684 GRADIENT_TRIANGLE tri[] = { { 0, 1, 2 }, { 3, 1, 0 } };
9685 BOOL ret;
9686
9687 mf = CreateEnhMetaFileA( GetDC( 0 ), NULL, NULL, NULL );
9688 ok( mf != 0, "CreateEnhMetaFileA error %ld\n", GetLastError() );
9689
9690 /* Don't test the GRADIENT_FILL_RECT_ modes since a Windows bug
9691 * means it allocates three mesh indices rather than two per
9692 * rectangle. This results in uninitialised values being written
9693 * to the EMF which is rather difficult to test against.
9694 *
9695 * Note also that the final vertex here is not required, yet it is
9696 * written to the EMF, but is not considered in the bounds
9697 * calculation.
9698 */
9699 ret = GdiGradientFill( mf, v, ARRAY_SIZE(v), tri, ARRAY_SIZE(tri), GRADIENT_FILL_TRIANGLE );
9700 ok( ret, "GradientFill\n" );
9701
9702 hemf = CloseEnhMetaFile( mf );
9703 ok( hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError() );
9704
9706 "emf_GradientFill", FALSE ) != 0)
9707 {
9708 dump_emf_bits( hemf, "emf_GradientFill" );
9709 dump_emf_records( hemf, "emf_GradientFill" );
9710 }
9711
9712 DeleteEnhMetaFile( hemf );
9713}
const GLdouble * v
Definition: gl.h:2040
BOOL WINAPI GdiGradientFill(HDC hdc, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode)
static const unsigned char EMF_GRADIENTFILL_BITS[]
Definition: metafile.c:1448

Referenced by START_TEST().

◆ test_emf_mask_blit()

static void test_emf_mask_blit ( void  )
static

Definition at line 5156 of file metafile.c.

5157{
5158 BITMAPINFO bmi = {{ sizeof(bmi) }};
5159 HBITMAP bitmap, mask_bitmap;
5160 HENHMETAFILE emf;
5161 HDC hdc, dib_hdc;
5162 unsigned int i;
5163 void *bits;
5164 BOOL ret;
5165
5166 static const POINT plg_points[] = { { 2, 1 }, { 1, 1 }, { 1, 2 } };
5167
5169 ok(hdc != 0, "CreateMetaFileA failed\n");
5170
5171 dib_hdc = CreateCompatibleDC(NULL);
5172 ok(!!dib_hdc, "CreateCompatibleDC failed\n");
5173
5174 bmi.bmiHeader.biHeight = 3;
5175 bmi.bmiHeader.biWidth = 4;
5176 bmi.bmiHeader.biBitCount = 24;
5177 bmi.bmiHeader.biPlanes = 1;
5179 bitmap = CreateDIBSection(dib_hdc, &bmi, DIB_RGB_COLORS, &bits, NULL, 0);
5180 ok(!!bitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
5181 for (i = 0; i < bmi.bmiHeader.biHeight * bmi.bmiHeader.biWidth * 3; i++)
5182 ((BYTE *)bits)[i] = i + 10;
5183
5184 bmi.bmiHeader.biHeight = 3;
5185 bmi.bmiHeader.biWidth = 4;
5186 bmi.bmiHeader.biBitCount = 1;
5187 bmi.bmiHeader.biPlanes = 1;
5189 mask_bitmap = CreateDIBSection(dib_hdc, &bmi, DIB_RGB_COLORS, &bits, NULL, 0);
5190 ok(!!mask_bitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
5191 memset(bits, ~0, bmi.bmiHeader.biHeight * 4);
5192
5193 SelectObject(dib_hdc, bitmap);
5194
5195 ret = MaskBlt(hdc, 0, 0, 3, 4, dib_hdc, 0, 0, mask_bitmap, 0, 0, SRCCOPY);
5196 ok(ret, "MaskBlt failed\n");
5197
5198 ret = MaskBlt(hdc, 0, 0, 3, 4, dib_hdc, 0, 0, NULL, 0, 0, SRCCOPY);
5199 ok(ret, "MaskBlt failed\n");
5200
5201 ret = PlgBlt(hdc, plg_points, dib_hdc, 0, 0, 3, 4, mask_bitmap, 0, 0);
5202 ok(ret, "PlgBlt failed\n");
5203
5204 DeleteDC(dib_hdc);
5206 DeleteObject(mask_bitmap);
5207
5209 ok(emf != 0, "CloseMetaFile failed\n");
5210
5212 "emf_mask_blit", FALSE) != 0)
5213 {
5214 dump_emf_bits(emf, "emf_mask_blit");
5215 dump_emf_records(emf, "emf_mask_blit");
5216 }
5217
5219 ok(ret, "DeleteMetaFile(%p) error %ld\n", emf, GetLastError());
5220}
static const unsigned char emf_mask_blit_bits[]
Definition: metafile.c:1926
BOOL WINAPI MaskBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ HDC, _In_ int, _In_ int, _In_ HBITMAP, _In_ int, _In_ int, _In_ DWORD)
BOOL WINAPI PlgBlt(_In_ HDC hdcDest, _In_reads_(3) const POINT *lpPoint, _In_ HDC hdcSrc, _In_ int xSrc, _In_ int ySrc, _In_ int width, _In_ int height, _In_opt_ HBITMAP hbmMask, _In_ int xMask, _In_ int yMask)

Referenced by START_TEST().

◆ test_emf_palette()

static void test_emf_palette ( void  )
static

Definition at line 4833 of file metafile.c.

4834{
4835 char logpalettebuf[sizeof(LOGPALETTE) + sizeof(logpalettedata)];
4836 LOGPALETTE *logpalette = (PLOGPALETTE)logpalettebuf;
4837 HPALETTE hpal, old_pal, def_pal;
4838 HENHMETAFILE emf;
4839 HDC hdc;
4840 BOOL ret;
4841
4842 static const unsigned char palette_bits[] =
4843 {
4844 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
4845 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4846 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
4847 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4848 0xe6, 0xff, 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff,
4849 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
4850 0xf0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
4851 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4852 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
4853 0x80, 0x07, 0x00, 0x00, 0xcd, 0x03, 0x00, 0x00,
4854 0xfc, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
4855 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4856 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
4857 0x9f, 0xed, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00,
4858 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
4859 0x00, 0x03, 0x08, 0x00, 0x10, 0x20, 0x30, 0x00,
4860 0x20, 0x30, 0x40, 0x00, 0x30, 0x40, 0x50, 0x00,
4861 0x40, 0x50, 0x60, 0x00, 0x50, 0x60, 0x70, 0x00,
4862 0x60, 0x70, 0x80, 0x00, 0x70, 0x80, 0x90, 0x00,
4863 0x80, 0x90, 0xa0, 0x00, 0x30, 0x00, 0x00, 0x00,
4864 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
4865 0x34, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
4866 0x30, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
4867 0x0f, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x00,
4868 0x34, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
4869 0x10, 0x00, 0x00, 0x00, 0x10, 0x20, 0x30, 0x00,
4870 0x20, 0x30, 0x40, 0x00, 0x30, 0x40, 0x50, 0x00,
4871 0x40, 0x50, 0x60, 0x00, 0x50, 0x60, 0x70, 0x00,
4872 0x60, 0x70, 0x80, 0x00, 0x70, 0x80, 0x90, 0x00,
4873 0x80, 0x90, 0xa0, 0x00, 0x34, 0x00, 0x00, 0x00
4874 };
4875
4877 ok(hdc != 0, "CreateMetaFileA error %ld\n", GetLastError());
4878
4879 /* Initialize the logical palette with a few colours */
4880 logpalette->palVersion = 0x300;
4882 memcpy(logpalette->palPalEntry, logpalettedata, sizeof(logpalettedata));
4883 hpal = CreatePalette(logpalette);
4884 old_pal = SelectPalette(hdc, hpal, FALSE);
4886 ok(old_pal == def_pal, "old_pal=%p, expected %p\n", old_pal, def_pal);
4887
4889 ok(!ret, "RealizePalette returned %d\n", ret);
4890
4892 ok(old_pal == hpal, "old_pal=%p, expected %p\n", old_pal, hpal);
4893
4895 ok(!ret, "RealizePalette returned %d\n", ret);
4896
4898 ok(emf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
4899
4900 if (compare_emf_bits(emf, palette_bits, sizeof(palette_bits), "emf_palette", FALSE))
4901 {
4902 dump_emf_bits(emf, "emf_palette");
4903 dump_emf_records(emf, "emf_palette");
4904 }
4905
4907 ok(ret, "DeleteMetaFile error %ld\n", GetLastError());
4908}
static const PALETTEENTRY logpalettedata[8]
Definition: metafile.c:4753
static const LOGPALETTE logpalette
Definition: clipboard.c:1458
WORD palNumEntries
Definition: wingdi.h:2280
WORD palVersion
Definition: wingdi.h:2279
UINT WINAPI RealizePalette(_In_ HDC)
Definition: palette.c:138
#define DEFAULT_PALETTE
Definition: wingdi.h:913
struct tagLOGPALETTE * PLOGPALETTE
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
HPALETTE WINAPI SelectPalette(_In_ HDC, _In_ HPALETTE, _In_ BOOL)
struct tagLOGPALETTE LOGPALETTE

Referenced by START_TEST().

◆ test_emf_paths()

static void test_emf_paths ( void  )
static

Definition at line 9518 of file metafile.c.

9519{
9520 POINT pts[9] = {{10, 10}, {20, 10}, {10, 20}, {20, 20}, {30, 30}, {40, 20}, {20, 30}, {20, 20}, {20, 10}};
9521 DWORD counts[2] = {2, 2};
9524 HDC hdcMetafile;
9525 HENHMETAFILE hemf;
9526 BOOL ret;
9527 int size;
9528
9529 SetLastError(0xdeadbeef);
9530 hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
9531 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
9532
9533 ret = BeginPath(hdcMetafile);
9534 ok(ret, "BeginPath error %ld\n", GetLastError());
9535 ret = MoveToEx(hdcMetafile, 50, 50, NULL);
9536 ok( ret, "MoveToEx error %ld.\n", GetLastError());
9537 ret = LineTo(hdcMetafile, 50, 150);
9538 ok( ret, "LineTo error %ld.\n", GetLastError());
9539 ret = LineTo(hdcMetafile, 150, 150);
9540 ok( ret, "LineTo error %ld.\n", GetLastError());
9541 ret = LineTo(hdcMetafile, 150, 50);
9542 ok( ret, "LineTo error %ld.\n", GetLastError());
9543 ret = LineTo(hdcMetafile, 50, 50);
9544 ok( ret, "LineTo error %ld.\n", GetLastError());
9545 Rectangle(hdcMetafile, 10, 10, 20, 20);
9546 Arc(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21);
9547 ArcTo(hdcMetafile, 23, 23, 37, 27, 37, 27, 23, 23);
9548 Chord(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21);
9549 Pie(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21);
9550 Ellipse(hdcMetafile, 10, 10, 20, 20);
9551 RoundRect(hdcMetafile, 10, 10, 20, 20, 3, 5);
9552 Polyline(hdcMetafile, pts, 4);
9553 PolylineTo(hdcMetafile, pts, 4);
9554 PolyPolyline(hdcMetafile, pts, counts, 2);
9555 PolyDraw(hdcMetafile, pts, types, 9);
9556 AngleArc(hdcMetafile, 37, 36, 23, 90, 180);
9557 ret = EndPath(hdcMetafile);
9558 ok(ret, "EndPath failed: %lu\n", GetLastError());
9559
9560 size = GetPath(hdcMetafile, NULL, NULL, 0);
9561 ok( size == 112, "GetPath returned %d.\n", size);
9562
9563 /* EndPath with no open path is recorded, but fails */
9564 ret = EndPath(hdcMetafile);
9565 ok(!ret, "EndPath succeeded\n");
9566
9567 ret = StrokeAndFillPath( hdcMetafile );
9568 ok( ret, "StrokeAndFillPath failed err %ld\n", GetLastError() );
9569 ret = StrokeAndFillPath( hdcMetafile );
9570 ok( !ret, "StrokeAndFillPath succeeded\n" );
9571
9572 hemf = CloseEnhMetaFile(hdcMetafile);
9573 ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
9574
9575 if (compare_emf_bits(hemf, EMF_PATH_BITS, sizeof(EMF_PATH_BITS), "test_emf_paths", FALSE) != 0)
9576 {
9577 dump_emf_bits(hemf, "test_emf_paths");
9578 dump_emf_records(hemf, "test_emf_paths");
9579 }
9580
9581 DeleteEnhMetaFile(hemf);
9582
9583 SetLastError(0xdeadbeef);
9584 hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
9585 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
9586
9587 ret = BeginPath(hdcMetafile);
9588 ok( ret, "BeginPath failed error %ld\n", GetLastError() );
9589 ret = CloseFigure(hdcMetafile);
9590 ok( ret, "CloseFigure failed error %ld\n", GetLastError() );
9591 ret = BeginPath(hdcMetafile);
9592 ok( ret, "BeginPath failed error %ld\n", GetLastError() );
9593 ret = EndPath(hdcMetafile);
9594 ok( ret, "EndPath failed error %ld\n", GetLastError() );
9595 ret = EndPath(hdcMetafile);
9596 ok( !ret, "EndPath succeeded\n" );
9597 ret = CloseFigure(hdcMetafile);
9598 ok( !ret, "CloseFigure succeeded\n" );
9599 ret = BeginPath(hdcMetafile);
9600 ok( ret, "BeginPath failed error %ld\n", GetLastError() );
9601 ret = AbortPath(hdcMetafile);
9602 ok( ret, "AbortPath failed error %ld\n", GetLastError() );
9603 ret = AbortPath(hdcMetafile);
9604 ok( ret, "AbortPath failed error %ld\n", GetLastError() );
9605
9606 hemf = CloseEnhMetaFile(hdcMetafile);
9607 ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
9608
9609 if (compare_emf_bits(hemf, EMF_EMPTY_PATH_BITS, sizeof(EMF_EMPTY_PATH_BITS), "empty path", FALSE) != 0)
9610 {
9611 dump_emf_bits(hemf, "empty path");
9612 dump_emf_records(hemf, "empty path");
9613 }
9614
9615 DeleteEnhMetaFile(hemf);
9616}
Definition: arc.h:55
static const unsigned char EMF_PATH_BITS[]
Definition: metafile.c:9389
static const unsigned char EMF_EMPTY_PATH_BITS[]
Definition: metafile.c:9489
Definition: cmds.c:130
BOOL WINAPI ArcTo(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom, _In_ INT xRadial1, _In_ INT yRadial1, _In_ INT xRadial2, _In_ INT yRadial2)
Definition: arc.c:79
BOOL WINAPI Chord(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom, _In_ INT xRadial1, _In_ INT yRadial1, _In_ INT xRadial2, _In_ INT yRadial2)
Definition: arc.c:119
BOOL WINAPI Polyline(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ int cpt)
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI PolylineTo(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:397
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PT_LINETO
Definition: wingdi.h:885
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
#define PT_MOVETO
Definition: wingdi.h:884
BOOL WINAPI StrokeAndFillPath(_In_ HDC)
#define PT_BEZIERTO
Definition: wingdi.h:886
BOOL WINAPI RoundRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI PolyDraw(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_reads_(cpt) const BYTE *aj, _In_ int cpt)
BOOL WINAPI AngleArc(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ DWORD dwRadius, _In_ FLOAT eStartAngle, _In_ FLOAT eSweepAngle)
Definition: arc.c:49
BOOL WINAPI PolyPolyline(_In_ HDC hdc, _In_ const POINT *apt, _In_reads_(csz) const DWORD *asz, _In_ DWORD csz)
BOOL WINAPI CloseFigure(_In_ HDC hdc)
BOOL WINAPI AbortPath(_In_ HDC hdc)
BOOL WINAPI Pie(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by START_TEST().

◆ test_emf_pattern_brush()

static void test_emf_pattern_brush ( void  )
static

Definition at line 4246 of file metafile.c.

4247{
4248 char buffer[sizeof(BITMAPINFOHEADER) + (2 + 32 * 32 / 8) * sizeof(RGBQUAD)];
4250 HDC hdc;
4251 HENHMETAFILE emf;
4252 LOGBRUSH *orig_lb;
4253 HBRUSH bitmap_brush, dib_brush;
4254 DWORD *bits;
4255 unsigned int i;
4256 BOOL ret;
4257
4258 orig_lb = calloc(1, sizeof(LOGBRUSH));
4259
4260 orig_lb->lbStyle = BS_PATTERN;
4261 orig_lb->lbColor = RGB(0, 0, 0);
4262 orig_lb->lbHatch = (ULONG_PTR)CreateBitmap(8, 8, 1, 1, SAMPLE_PATTERN_BRUSH);
4263 ok((HBITMAP)orig_lb->lbHatch != NULL, "CreateBitmap error %ld.\n", GetLastError());
4264
4265 bitmap_brush = CreateBrushIndirect(orig_lb);
4266 ok(bitmap_brush != 0, "CreateBrushIndirect error %ld\n", GetLastError());
4267
4269 ok(hdc != 0, "CreateMetaFileA error %ld\n", GetLastError());
4270
4271 bitmap_brush = SelectObject(hdc, bitmap_brush);
4272 ok(bitmap_brush != 0, "SelectObject error %ld.\n", GetLastError());
4273
4274 memset(info, 0, sizeof(buffer));
4275 info->bmiHeader.biSize = sizeof(info->bmiHeader);
4276 info->bmiHeader.biHeight = 32;
4277 info->bmiHeader.biWidth = 32;
4278 info->bmiHeader.biBitCount = 1;
4279 info->bmiHeader.biPlanes = 1;
4280 info->bmiHeader.biCompression = BI_RGB;
4281 bits = (DWORD *)info->bmiColors;
4282 for (i = 0; i < 32 * 32 / 8; i++) bits[i] = i;
4283
4285 ok(dib_brush != NULL, "CreatePatternBrush failed\n");
4286
4287 dib_brush = SelectObject(hdc, dib_brush);
4288 ok(dib_brush != 0, "SelectObject error %ld.\n", GetLastError());
4289
4291 ok(emf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
4292
4294 "emf_pattern_brush", FALSE))
4295 {
4296 dump_emf_bits(emf, "emf_pattern_brush");
4297 dump_emf_records(emf, "emf_pattern_brush");
4298 }
4299
4300 ret = DeleteObject(bitmap_brush);
4301 ok(ret, "DeleteObject failed\n");
4302 ret = DeleteObject(dib_brush);
4303 ok(ret, "DeleteObject failed\n");
4304 ret = DeleteObject((HBITMAP)orig_lb->lbHatch);
4305 ok(ret, "DeleteObject failed\n");
4306 free(orig_lb);
4307
4309 ok(ret, "EnumEnhMetaFile error %ld\n", GetLastError());
4311 ok(ret, "DeleteMetaFile error %ld\n", GetLastError());
4312}
#define ULONG_PTR
Definition: config.h:101
for(i=0;i< ARRAY_SIZE(offsets);i++)
static const unsigned char emf_pattern_brush_bits[]
Definition: metafile.c:1486
static const unsigned char SAMPLE_PATTERN_BRUSH[]
Definition: metafile.c:1010
static int CALLBACK pattern_brush_emf_enum_proc(HDC hdc, HANDLETABLE *htable, const ENHMETARECORD *rec, int n, LPARAM arg)
Definition: metafile.c:4214
#define calloc
Definition: rosglue.h:14
COLORREF lbColor
Definition: wingdi.h:2194
HBRUSH WINAPI CreateBrushIndirect(_In_ const LOGBRUSH *plb)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
#define BS_PATTERN
Definition: wingdi.h:1090
HBRUSH WINAPI CreateDIBPatternBrushPt(_In_ const VOID *pvPackedDIB, _In_ UINT uUsage)

Referenced by START_TEST().

◆ test_emf_polybezier()

static void test_emf_polybezier ( void  )
static

Definition at line 9350 of file metafile.c.

9351{
9352 HDC hdcMetafile;
9353 HENHMETAFILE hemf;
9354 POINT pts[4];
9355 BOOL ret;
9356
9357 SetLastError(0xdeadbeef);
9358 hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
9359 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
9360
9361 pts[0].x = pts[0].y = 10;
9362 pts[1].x = pts[1].y = 20;
9363 pts[2].x = pts[2].y = 15;
9364 pts[3].x = pts[3].y = 25;
9365 ret = PolyBezierTo(hdcMetafile, pts, 3); /* EMR_POLYBEZIERTO16 */
9366 ok( ret, "PolyBezierTo failed\n" );
9367 ret = PolyBezier(hdcMetafile, pts, 4); /* EMR_POLYBEZIER16 */
9368 ok( ret, "PolyBezier failed\n" );
9369
9370 pts[0].x = pts[0].y = 32769;
9371 ret = PolyBezier(hdcMetafile, pts, 4); /* EMR_POLYBEZIER */
9372 ok( ret, "PolyBezier failed\n" );
9373 ret = PolyBezierTo(hdcMetafile, pts, 3); /* EMR_POLYBEZIERTO */
9374 ok( ret, "PolyBezierTo failed\n" );
9375
9376 hemf = CloseEnhMetaFile(hdcMetafile);
9377 ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
9378
9380 "emf_Bezier", FALSE) != 0)
9381 {
9382 dump_emf_bits(hemf, "emf_Bezier");
9383 dump_emf_records(hemf, "emf_Bezier");
9384 }
9385
9386 DeleteEnhMetaFile(hemf);
9387}
static const unsigned char EMF_BEZIER_BITS[]
Definition: metafile.c:1350
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
BOOL WINAPI PolyBezier(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:263
BOOL WINAPI PolyBezierTo(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:281

Referenced by START_TEST().

◆ test_emf_PolyPolyline()

static void test_emf_PolyPolyline ( void  )
static

Definition at line 9618 of file metafile.c.

9619{
9620 HDC hdcMetafile;
9621 HENHMETAFILE hemf;
9622 POINT pts[4] = {{10, 20}, {100, 200}, {0x9000,300}, {400, 500}};
9623 DWORD counts[2];
9624 BOOL ret;
9625
9626 SetLastError(0xdeadbeef);
9627 hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
9628 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
9629
9630 ret = PolyPolyline(hdcMetafile, NULL, NULL, 0);
9631 ok( !ret, "PolyPolyline\n" );
9632
9633 SetLastError( 0xdeadbeef );
9634 counts[0] = 0;
9635 counts[1] = 1;
9636 ret = PolyPolyline(hdcMetafile, pts, counts, 2);
9637 ok( !ret, "PolyPolyline\n" );
9638 ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %ld\n", GetLastError() );
9639
9640 SetLastError( 0xdeadbeef );
9641 counts[0] = 1;
9642 counts[1] = 1;
9643 ret = PolyPolyline(hdcMetafile, pts, counts, 2);
9644 ok( !ret, "PolyPolyline\n" );
9645 ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %ld\n", GetLastError() );
9646
9647 SetLastError( 0xdeadbeef );
9648 counts[0] = 2;
9649 counts[1] = 1;
9650 ret = PolyPolyline(hdcMetafile, pts, counts, 2);
9651 ok( !ret, "PolyPolyline\n" );
9652 ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %ld\n", GetLastError() );
9653
9654 counts[0] = 2;
9655 counts[1] = 2;
9656 ret = PolyPolyline(hdcMetafile, pts, counts, 2);
9657 ok( ret, "PolyPolyline\n" );
9658
9659 hemf = CloseEnhMetaFile(hdcMetafile);
9660 ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
9661
9663 "emf_PolyPolyline", FALSE) != 0)
9664 {
9665 dump_emf_bits(hemf, "emf_PolyPolyline");
9666 dump_emf_records(hemf, "emf_PolyPolyline");
9667 }
9668
9669 DeleteEnhMetaFile(hemf);
9670}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static const unsigned char EMF_POLYPOLYLINE_BITS[]
Definition: metafile.c:1395

Referenced by START_TEST().

◆ test_emf_select()

static void test_emf_select ( void  )
static

Definition at line 4563 of file metafile.c.

4564{
4565 HENHMETAFILE hemf;
4566 HDC hdc, hdc2;
4567 HGDIOBJ obj;
4568 HPEN pen;
4569 int cnt;
4570 BOOL ret;
4571
4572 static const unsigned char select_bits[] =
4573 {
4574 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
4575 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4576 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
4577 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4578 0xe6, 0xff, 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff,
4579 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
4580 0xf8, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
4581 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4582 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4583 0x09, 0x06, 0x00, 0x00, 0x07, 0x04, 0x00, 0x00,
4584 0x99, 0x01, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00,
4585 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4586 0x00, 0x00, 0x00, 0x00, 0xcd, 0x3c, 0x06, 0x00,
4587 0x91, 0x29, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00,
4588 0x0c, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x80,
4589 0x25, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
4590 0x00, 0x00, 0x00, 0x80, 0x26, 0x00, 0x00, 0x00,
4591 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
4592 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
4593 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00,
4594 0x25, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
4595 0x01, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
4596 0x08, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00,
4597 0x0c, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80,
4598 0x22, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
4599 0xff, 0xff, 0xff, 0xff, 0x25, 0x00, 0x00, 0x00,
4600 0x0c, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80,
4601 0x28, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
4602 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
4603 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4604 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
4605 };
4606
4607 static const unsigned char delete_not_selected_bits[] =
4608 {
4609 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
4610 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4611 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
4612 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4613 0xe6, 0xff, 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff,
4614 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
4615 0xc0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
4616 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4617 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4618 0x09, 0x06, 0x00, 0x00, 0x07, 0x04, 0x00, 0x00,
4619 0x99, 0x01, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00,
4620 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4621 0x00, 0x00, 0x00, 0x00, 0xcd, 0x3c, 0x06, 0x00,
4622 0x91, 0x29, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00,
4623 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
4624 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
4625 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00,
4626 0x25, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
4627 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00,
4628 0x0c, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80,
4629 0x28, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
4630 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
4631 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4632 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
4633 };
4634
4635 static const unsigned char delete_selected_bits[] =
4636 {
4637 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
4638 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4639 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
4640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4641 0xe6, 0xff, 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff,
4642 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
4643 0xb4, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
4644 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4645 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4646 0x09, 0x06, 0x00, 0x00, 0x07, 0x04, 0x00, 0x00,
4647 0x99, 0x01, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00,
4648 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4649 0x00, 0x00, 0x00, 0x00, 0xcd, 0x3c, 0x06, 0x00,
4650 0x91, 0x29, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00,
4651 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
4652 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
4653 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00,
4654 0x25, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
4655 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
4656 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
4657 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
4658 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
4659 0x14, 0x00, 0x00, 0x00
4660 };
4661
4663 ok(hdc != 0, "CreateEnhMetaFileA failed\n");
4664
4665 obj = SelectObject(hdc, GetStockObject(DC_BRUSH));
4666 ok(obj == GetStockObject(WHITE_BRUSH), "brush is not a stock WHITE_BRUSH: %p\n", obj);
4667
4669 ok(obj == GetStockObject(DC_BRUSH), "brush is not a stock DC_BRUSH: %p\n", obj);
4670
4671 pen = CreatePen(PS_SOLID, 1, RGB(1,1,1));
4672 obj = SelectObject(hdc, pen);
4673 ok(obj == GetStockObject(BLACK_PEN), "pen is not a stock BLACK_PEN: %p\n", obj);
4674
4675 cnt = SaveDC(hdc);
4676 ok(cnt == 1, "cnt = %d\n", cnt);
4677
4679 ok(obj == pen, "unexpected pen: %p\n", obj);
4680
4681 ret = RestoreDC(hdc, -1);
4682 ok(ret, "RestoreDC failed\n");
4683
4685 /* pen is still black after RestoreDC */
4686 ok(obj == pen, "unexpected pen: %p\n", obj);
4687 ret = DeleteObject(pen);
4688 ok(ret, "DeleteObject failed: %lu\n", GetLastError());
4689
4691 ok(obj == GetStockObject(BLACK_PEN), "GetCurrentObject returned %p\n", obj);
4692
4693 SetLastError(0xdeadbeef);
4695 ok(!obj, "SelectObject returned %p (%lu).\n", obj, GetLastError());
4696
4697 ret = RestoreDC(hdc, -5);
4698 ok(!ret, "RestoreDC succeeded\n");
4699
4700 hemf = CloseEnhMetaFile(hdc);
4701 ok(hemf != 0, "CloseEnhMetaFile failed\n");
4702
4703 if (compare_emf_bits(hemf, select_bits, sizeof(select_bits), "emf_select", FALSE))
4704 {
4705 dump_emf_bits(hemf, "emf_select");
4706 dump_emf_records(hemf, "emf_select");
4707 }
4708
4709 ret = DeleteEnhMetaFile(hemf);
4710 ok(ret, "DeleteEnhMetaFile(%p) error %ld\n", hemf, GetLastError());
4711
4712 /* create two EMFs, select the same pen to both of them,
4713 * unselect it from only one and then delete */
4715 ok(hdc != 0, "CreateEnhMetaFileA failed\n");
4717 ok(hdc2 != 0, "CreateEnhMetaFileA failed\n");
4718
4719 pen = CreatePen(PS_SOLID, 1, RGB(1,1,1));
4720 obj = SelectObject(hdc, pen);
4721 ok(obj == GetStockObject(BLACK_PEN), "pen is not a stock BLACK_PEN: %p\n", obj);
4722 obj = SelectObject(hdc2, pen);
4723 ok(obj == GetStockObject(BLACK_PEN), "pen is not a stock BLACK_PEN: %p\n", obj);
4724
4726 ok(obj == pen, "unexpected pen: %p\n", obj);
4727 ret = DeleteObject(pen);
4728 ok(ret, "DeleteObject failed: %lu\n", GetLastError());
4729
4730 hemf = CloseEnhMetaFile(hdc);
4731 ok(hemf != 0, "CloseEnhMetaFile failed\n");
4732 if (compare_emf_bits(hemf, delete_not_selected_bits, sizeof(delete_not_selected_bits),
4733 "emf_delete_not_selected", FALSE))
4734 {
4735 dump_emf_bits(hemf, "emf_delete_not_selected");
4736 dump_emf_records(hemf, "emf_delete_not_selected");
4737 }
4738 ret = DeleteEnhMetaFile(hemf);
4739 ok(ret, "DeleteEnhMetaFile(%p) error %ld\n", hemf, GetLastError());
4740
4741 hemf = CloseEnhMetaFile(hdc2);
4742 ok(hemf != 0, "CloseEnhMetaFile failed\n");
4743 if (compare_emf_bits(hemf, delete_selected_bits, sizeof(delete_selected_bits),
4744 "emf_delete_selected", FALSE))
4745 {
4746 dump_emf_bits(hemf, "emf_delete_selected");
4747 dump_emf_records(hemf, "emf_delete_selected");
4748 }
4749 ret = DeleteEnhMetaFile(hemf);
4750 ok(ret, "DeleteEnhMetaFile(%p) error %ld\n", hemf, GetLastError());
4751}
HDC hdc2
Definition: SelectObject.c:10
#define OBJ_PEN
Definition: objidl.idl:1014
_In_ size_t cnt
Definition: wcstombs.cpp:43
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define BLACK_PEN
Definition: wingdi.h:903
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586
int WINAPI SaveDC(_In_ HDC)

Referenced by START_TEST().

◆ test_emf_SetDIBitsToDevice()

static void test_emf_SetDIBitsToDevice ( void  )
static

Definition at line 7900 of file metafile.c.

7901{
7902 static const unsigned char dib_bits[4 * 4 * 4] = { 0 };
7903 static const int bitmap_width = 4, bitmap_height = 4;
7904 union {
7905#ifdef __REACTOS__
7906 unsigned char b[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
7907#else
7908 unsigned char b[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
7909#endif
7910 BITMAPINFO i;
7912 } bmi;
7913 HDC hdc, hdc_emf;
7914 HENHMETAFILE hemf;
7915 int ret, test_idx, color_idx;
7916
7917 static const struct
7918 {
7919 WORD bpp;
7920 int width;
7921 int height;
7923 unsigned char infomode;
7924 const void *bits;
7925 size_t bits_count;
7926 DWORD used_color_count;
7927 DWORD color_count;
7928 RGBQUAD colors[3];
7929 }
7930 tests[] =
7931 {
7932 {1, 3, 3, BI_RGB, 0, EMF_SETDIBITSTODEVICE_1BIT_3X3_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_1BIT_3X3_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
7933 {1, 3, 3, BI_RGB, 1, EMF_SETDIBITSTODEVICE_1BIT_3X3_SIZED, sizeof(EMF_SETDIBITSTODEVICE_1BIT_3X3_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
7934 {4, 3, 3, BI_RGB, 0, EMF_SETDIBITSTODEVICE_4BIT_3X3_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_4BIT_3X3_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
7935 {4, 3, 3, BI_RGB, 1, EMF_SETDIBITSTODEVICE_4BIT_3X3_SIZED, sizeof(EMF_SETDIBITSTODEVICE_4BIT_3X3_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
7936 {8, 3, 3, BI_RGB, 0, EMF_SETDIBITSTODEVICE_8BIT_3X3_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_8BIT_3X3_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
7937 {8, 3, 3, BI_RGB, 1, EMF_SETDIBITSTODEVICE_8BIT_3X3_SIZED, sizeof(EMF_SETDIBITSTODEVICE_8BIT_3X3_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
7945 {16, 3, 3, BI_BITFIELDS, 0, EMF_SETDIBITSTODEVICE_16BIT_3X3_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_16BIT_3X3_NOSIZE), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
7946 {16, 3, 3, BI_BITFIELDS, 1, EMF_SETDIBITSTODEVICE_16BIT_3X3_SIZED, sizeof(EMF_SETDIBITSTODEVICE_16BIT_3X3_SIZED), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
7947 {32, 3, 3, BI_BITFIELDS, 0, EMF_SETDIBITSTODEVICE_32BIT_3X3_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_32BIT_3X3_NOSIZE), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
7948 {32, 3, 3, BI_BITFIELDS, 1, EMF_SETDIBITSTODEVICE_32BIT_3X3_SIZED, sizeof(EMF_SETDIBITSTODEVICE_32BIT_3X3_SIZED), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
7949 {1, 4, 4, BI_RGB, 0, EMF_SETDIBITSTODEVICE_1BIT_4X4_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_1BIT_4X4_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
7950 {1, 4, 4, BI_RGB, 1, EMF_SETDIBITSTODEVICE_1BIT_4X4_SIZED, sizeof(EMF_SETDIBITSTODEVICE_1BIT_4X4_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
7951 {4, 4, 4, BI_RGB, 0, EMF_SETDIBITSTODEVICE_4BIT_4X4_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_4BIT_4X4_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
7952 {4, 4, 4, BI_RGB, 1, EMF_SETDIBITSTODEVICE_4BIT_4X4_SIZED, sizeof(EMF_SETDIBITSTODEVICE_4BIT_4X4_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
7953 {8, 4, 4, BI_RGB, 0, EMF_SETDIBITSTODEVICE_8BIT_4X4_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_8BIT_4X4_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
7954 {8, 4, 4, BI_RGB, 1, EMF_SETDIBITSTODEVICE_8BIT_4X4_SIZED, sizeof(EMF_SETDIBITSTODEVICE_8BIT_4X4_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
7962 {16, 4, 4, BI_BITFIELDS, 0, EMF_SETDIBITSTODEVICE_16BIT_4X4_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_16BIT_4X4_NOSIZE), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
7963 {16, 4, 4, BI_BITFIELDS, 1, EMF_SETDIBITSTODEVICE_16BIT_4X4_SIZED, sizeof(EMF_SETDIBITSTODEVICE_16BIT_4X4_SIZED), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
7964 {32, 4, 4, BI_BITFIELDS, 0, EMF_SETDIBITSTODEVICE_32BIT_4X4_NOSIZE, sizeof(EMF_SETDIBITSTODEVICE_32BIT_4X4_NOSIZE), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
7965 {32, 4, 4, BI_BITFIELDS, 1, EMF_SETDIBITSTODEVICE_32BIT_4X4_SIZED, sizeof(EMF_SETDIBITSTODEVICE_32BIT_4X4_SIZED), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
7966 };
7967
7968 hdc = GetDC(0);
7969
7970 for (test_idx = 0; test_idx < ARRAY_SIZE(tests); ++test_idx)
7971 {
7972 winetest_push_context("Test %d", test_idx);
7973
7974 memset(&bmi, 0, sizeof(bmi));
7975 if (tests[test_idx].infomode < 2)
7976 {
7977 bmi.i.bmiHeader.biSize = sizeof(bmi.i.bmiHeader);
7978 bmi.i.bmiHeader.biWidth = bitmap_width;
7979 bmi.i.bmiHeader.biHeight = bitmap_height;
7980 bmi.i.bmiHeader.biBitCount = tests[test_idx].bpp;
7981 bmi.i.bmiHeader.biPlanes = 1;
7982 bmi.i.bmiHeader.biCompression = tests[test_idx].compression;
7983 bmi.i.bmiHeader.biClrUsed = tests[test_idx].used_color_count;
7984 if (tests[test_idx].infomode == 1)
7985 bmi.i.bmiHeader.biSizeImage = (((bitmap_width * tests[test_idx].bpp + 31) >> 3) & ~3) * bitmap_height;
7986 memcpy(bmi.i.bmiColors, tests[test_idx].colors, sizeof(RGBQUAD) * tests[test_idx].color_count);
7987 }
7988 else
7989 {
7990 bmi.c.bmciHeader.bcSize = sizeof(bmi.c.bmciHeader);
7991 bmi.c.bmciHeader.bcWidth = bitmap_width;
7992 bmi.c.bmciHeader.bcHeight = bitmap_height;
7993 bmi.c.bmciHeader.bcPlanes = 1;
7994 bmi.c.bmciHeader.bcBitCount = tests[test_idx].bpp;
7995 for (color_idx = 0; color_idx < tests[test_idx].color_count; color_idx++)
7996 {
7997 bmi.c.bmciColors[color_idx].rgbtBlue = tests[test_idx].colors[color_idx].rgbBlue;
7998 bmi.c.bmciColors[color_idx].rgbtGreen = tests[test_idx].colors[color_idx].rgbGreen;
7999 bmi.c.bmciColors[color_idx].rgbtRed = tests[test_idx].colors[color_idx].rgbRed;
8000 }
8001 }
8002
8003 hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
8004 ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
8005
8006 ret = SetDIBitsToDevice(hdc_emf, 0, 0,
8007 tests[test_idx].width, tests[test_idx].height,
8008 0, 0, 0, bitmap_height,
8009 dib_bits, &bmi.i, DIB_RGB_COLORS);
8010 ok(ret == tests[test_idx].height, "expected SetDIBitsToDevice to return %d, got %d (lasterr %lu)\n", tests[test_idx].height, ret, GetLastError());
8011
8012 hemf = CloseEnhMetaFile(hdc_emf);
8013 ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
8014
8015 ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count,
8016 "test_emf_SetDIBitsToDevice", FALSE);
8017 if (ret)
8018 {
8019 dump_emf_bits(hemf, "test_emf_SetDIBitsToDevice");
8020 dump_emf_records(hemf, "test_emf_SetDIBitsToDevice");
8021 }
8022
8023 DeleteEnhMetaFile(hemf);
8024
8026 }
8027
8028 ReleaseDC(0, hdc);
8029}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define c
Definition: ke_i.h:80
static const unsigned char EMF_SETDIBITSTODEVICE_8BIT_4X4_SIZED[]
Definition: metafile.c:7449
static const unsigned char EMF_SETDIBITSTODEVICE_8BIT_4X4_NOSIZE[]
Definition: metafile.c:7412
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_4X4_NOSIZE[]
Definition: metafile.c:7812
static const unsigned char EMF_SETDIBITSTODEVICE_4BIT_4X4_NOSIZE[]
Definition: metafile.c:7338
static const unsigned char EMF_SETDIBITSTODEVICE_8BIT_3X3_NOSIZE[]
Definition: metafile.c:6792
static const unsigned char EMF_SETDIBITSTODEVICE_4BIT_3X3_SIZED[]
Definition: metafile.c:6755
static const unsigned char EMF_SETDIBITSTODEVICE_1BIT_4X4_SIZED[]
Definition: metafile.c:7301
static const unsigned char EMF_SETDIBITSTODEVICE_24BIT_4X4_SIZED[]
Definition: metafile.c:7605
static const unsigned char EMF_SETDIBITSTODEVICE_24BIT_3X3_SIZED[]
Definition: metafile.c:6981
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_3X3_SIZED[]
Definition: metafile.c:7222
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_3X3_NOSIZE[]
Definition: metafile.c:7102
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_4X4_SIZED[]
Definition: metafile.c:7772
static const unsigned char EMF_SETDIBITSTODEVICE_4BIT_4X4_SIZED[]
Definition: metafile.c:7375
static const unsigned char EMF_SETDIBITSTODEVICE_24BIT_4X4_NOSIZE[]
Definition: metafile.c:7564
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_3X3_NOSIZE[]
Definition: metafile.c:7020
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_3X3_SIZED[]
Definition: metafile.c:6904
static const unsigned char EMF_SETDIBITSTODEVICE_24BIT_3X3_NOSIZE[]
Definition: metafile.c:6942
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_3X3_SIZED[]
Definition: metafile.c:7061
static const unsigned char EMF_SETDIBITSTODEVICE_1BIT_3X3_SIZED[]
Definition: metafile.c:6681
static const unsigned char EMF_SETDIBITSTODEVICE_4BIT_3X3_NOSIZE[]
Definition: metafile.c:6718
static const unsigned char EMF_SETDIBITSTODEVICE_1BIT_4X4_NOSIZE[]
Definition: metafile.c:7264
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_4X4_SIZED[]
Definition: metafile.c:7856
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_3X3_SIZED[]
Definition: metafile.c:7141
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_3X3_NOSIZE[]
Definition: metafile.c:7180
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_4X4_NOSIZE[]
Definition: metafile.c:7486
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_4X4_NOSIZE[]
Definition: metafile.c:7732
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_4X4_SIZED[]
Definition: metafile.c:7525
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_4X4_NOSIZE[]
Definition: metafile.c:7646
static const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_4X4_SIZED[]
Definition: metafile.c:7689
static const unsigned char EMF_SETDIBITSTODEVICE_1BIT_3X3_NOSIZE[]
Definition: metafile.c:6644
static const unsigned char EMF_SETDIBITSTODEVICE_8BIT_3X3_SIZED[]
Definition: metafile.c:6829
static const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_3X3_NOSIZE[]
Definition: metafile.c:6866
int WINAPI SetDIBitsToDevice(_In_ HDC, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ int, _In_ int, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)

Referenced by START_TEST().

◆ test_emf_SetPixel()

static void test_emf_SetPixel ( void  )
static

Definition at line 3849 of file metafile.c.

3850{
3851 HENHMETAFILE emf;
3852 COLORREF c;
3853 BOOL ret;
3854 HDC hdc;
3855
3857 ok(hdc != 0, "CreateEnhMetaFile failed\n");
3858
3859 c = GetPixel(hdc, 5, 5);
3860 ok(c == CLR_INVALID, "c = %lx\n", c);
3861
3862 c = SetPixel(hdc, 5, 5, RGB(1,2,3));
3863 ok(c == CLR_INVALID, "c = %lx\n", c);
3864
3865 ret = SetPixelV(hdc, 5, 5, RGB(1,2,3));
3866 ok(!ret, "ret = %x\n", ret);
3867
3868 c = GetPixel(hdc, 5, 5);
3869 ok(c == CLR_INVALID, "c = %lx\n", c);
3870
3871 ret = Rectangle(hdc, 1, 1, 10, 10);
3872 ok(ret, "Rectangle failed\n");
3873
3874 c = GetPixel(hdc, 5, 5);
3875 ok(c == CLR_INVALID, "c = %lx\n", c);
3876
3878 ok(emf != 0, "CloseEnhMetaFile failed\n");
3880}
VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: bootvid.c:52
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
const GLubyte * c
Definition: glext.h:8905
#define CLR_INVALID
Definition: wingdi.h:883
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)

Referenced by START_TEST().

◆ test_emf_StretchDIBits()

static void test_emf_StretchDIBits ( void  )
static

Definition at line 6514 of file metafile.c.

6515{
6516 static const unsigned char dib_bits[4 * 4 * 4] = { 0 };
6517 static const int bitmap_width = 4, bitmap_height = 4;
6518 union {
6519#ifdef __REACTOS__
6520 unsigned char b[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
6521#else
6522 unsigned char b[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
6523#endif
6524 BITMAPINFO i;
6526 } bmi;
6527 HDC hdc, hdc_emf;
6528 HENHMETAFILE hemf;
6529 int ret, test_idx, color_idx;
6530
6531 static const struct
6532 {
6533 WORD bpp;
6534 int src_width;
6535 int src_height;
6537 unsigned char infomode;
6538 const void *bits;
6539 size_t bits_count;
6540 DWORD used_color_count;
6541 DWORD color_count;
6542 RGBQUAD colors[3];
6543 }
6544 tests[] =
6545 {
6546 {1, 3, 3, BI_RGB, 0, EMF_STRETCHDIBITS_1BIT_3X3_NOSIZE, sizeof(EMF_STRETCHDIBITS_1BIT_3X3_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
6547 {1, 3, 3, BI_RGB, 1, EMF_STRETCHDIBITS_1BIT_3X3_SIZED, sizeof(EMF_STRETCHDIBITS_1BIT_3X3_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
6548 {4, 3, 3, BI_RGB, 0, EMF_STRETCHDIBITS_4BIT_3X3_NOSIZE, sizeof(EMF_STRETCHDIBITS_4BIT_3X3_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
6549 {4, 3, 3, BI_RGB, 1, EMF_STRETCHDIBITS_4BIT_3X3_SIZED, sizeof(EMF_STRETCHDIBITS_4BIT_3X3_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
6550 {8, 3, 3, BI_RGB, 0, EMF_STRETCHDIBITS_8BIT_3X3_NOSIZE, sizeof(EMF_STRETCHDIBITS_8BIT_3X3_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
6551 {8, 3, 3, BI_RGB, 1, EMF_STRETCHDIBITS_8BIT_3X3_SIZED, sizeof(EMF_STRETCHDIBITS_8BIT_3X3_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
6559 {16, 3, 3, BI_BITFIELDS, 0, EMF_STRETCHDIBITS_16BIT_3X3_NOSIZE, sizeof(EMF_STRETCHDIBITS_16BIT_3X3_NOSIZE), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
6560 {16, 3, 3, BI_BITFIELDS, 1, EMF_STRETCHDIBITS_16BIT_3X3_SIZED, sizeof(EMF_STRETCHDIBITS_16BIT_3X3_SIZED), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
6561 {32, 3, 3, BI_BITFIELDS, 0, EMF_STRETCHDIBITS_32BIT_3X3_NOSIZE, sizeof(EMF_STRETCHDIBITS_32BIT_3X3_NOSIZE), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
6562 {32, 3, 3, BI_BITFIELDS, 1, EMF_STRETCHDIBITS_32BIT_3X3_SIZED, sizeof(EMF_STRETCHDIBITS_32BIT_3X3_SIZED), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
6563 {1, 4, 4, BI_RGB, 0, EMF_STRETCHDIBITS_1BIT_4X4_NOSIZE, sizeof(EMF_STRETCHDIBITS_1BIT_4X4_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
6564 {1, 4, 4, BI_RGB, 1, EMF_STRETCHDIBITS_1BIT_4X4_SIZED, sizeof(EMF_STRETCHDIBITS_1BIT_4X4_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
6565 {4, 4, 4, BI_RGB, 0, EMF_STRETCHDIBITS_4BIT_4X4_NOSIZE, sizeof(EMF_STRETCHDIBITS_4BIT_4X4_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
6566 {4, 4, 4, BI_RGB, 1, EMF_STRETCHDIBITS_4BIT_4X4_SIZED, sizeof(EMF_STRETCHDIBITS_4BIT_4X4_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
6567 {8, 4, 4, BI_RGB, 0, EMF_STRETCHDIBITS_8BIT_4X4_NOSIZE, sizeof(EMF_STRETCHDIBITS_8BIT_4X4_NOSIZE), 1, 1, {{0xff, 0xff, 0xff}}},
6568 {8, 4, 4, BI_RGB, 1, EMF_STRETCHDIBITS_8BIT_4X4_SIZED, sizeof(EMF_STRETCHDIBITS_8BIT_4X4_SIZED), 1, 1, {{0xff, 0xff, 0xff}}},
6576 {16, 4, 4, BI_BITFIELDS, 0, EMF_STRETCHDIBITS_16BIT_4X4_NOSIZE, sizeof(EMF_STRETCHDIBITS_16BIT_4X4_NOSIZE), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
6577 {16, 4, 4, BI_BITFIELDS, 1, EMF_STRETCHDIBITS_16BIT_4X4_SIZED, sizeof(EMF_STRETCHDIBITS_16BIT_4X4_SIZED), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
6578 {32, 4, 4, BI_BITFIELDS, 0, EMF_STRETCHDIBITS_32BIT_4X4_NOSIZE, sizeof(EMF_STRETCHDIBITS_32BIT_4X4_NOSIZE), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
6579 {32, 4, 4, BI_BITFIELDS, 1, EMF_STRETCHDIBITS_32BIT_4X4_SIZED, sizeof(EMF_STRETCHDIBITS_32BIT_4X4_SIZED), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
6580 };
6581
6582 hdc = GetDC(0);
6583
6584 for (test_idx = 0; test_idx < ARRAY_SIZE(tests); ++test_idx)
6585 {
6586 winetest_push_context("Test %d", test_idx);
6587
6588 memset(&bmi, 0, sizeof(bmi));
6589 if (tests[test_idx].infomode < 2)
6590 {
6591 bmi.i.bmiHeader.biSize = sizeof(bmi.i.bmiHeader);
6592 bmi.i.bmiHeader.biWidth = bitmap_width;
6593 bmi.i.bmiHeader.biHeight = bitmap_height;
6594 bmi.i.bmiHeader.biBitCount = tests[test_idx].bpp;
6595 bmi.i.bmiHeader.biPlanes = 1;
6596 bmi.i.bmiHeader.biCompression = tests[test_idx].compression;
6597 bmi.i.bmiHeader.biClrUsed = tests[test_idx].used_color_count;
6598 if (tests[test_idx].infomode == 1)
6599 bmi.i.bmiHeader.biSizeImage = (((bitmap_width * tests[test_idx].bpp + 31) >> 3) & ~3) * bitmap_height;
6600 memcpy(bmi.i.bmiColors, tests[test_idx].colors, sizeof(RGBQUAD) * tests[test_idx].color_count);
6601 }
6602 else
6603 {
6604 bmi.c.bmciHeader.bcSize = sizeof(bmi.c.bmciHeader);
6605 bmi.c.bmciHeader.bcWidth = bitmap_width;
6606 bmi.c.bmciHeader.bcHeight = bitmap_height;
6607 bmi.c.bmciHeader.bcPlanes = 1;
6608 bmi.c.bmciHeader.bcBitCount = tests[test_idx].bpp;
6609 for (color_idx = 0; color_idx < tests[test_idx].color_count; color_idx++)
6610 {
6611 bmi.c.bmciColors[color_idx].rgbtBlue = tests[test_idx].colors[color_idx].rgbBlue;
6612 bmi.c.bmciColors[color_idx].rgbtGreen = tests[test_idx].colors[color_idx].rgbGreen;
6613 bmi.c.bmciColors[color_idx].rgbtRed = tests[test_idx].colors[color_idx].rgbRed;
6614 }
6615 }
6616
6617 hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
6618 ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
6619
6620 ret = StretchDIBits(hdc_emf, 0, 0, bitmap_width, bitmap_height, 0, 0,
6621 tests[test_idx].src_width, tests[test_idx].src_height,
6622 dib_bits, &bmi.i, DIB_RGB_COLORS, SRCCOPY);
6623 ok(ret == bitmap_height, "expected StretchDIBits to return %d, got %d (lasterr %lu)\n", bitmap_height, ret, GetLastError());
6624
6625 hemf = CloseEnhMetaFile(hdc_emf);
6626 ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
6627
6628 ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count,
6629 "test_emf_StretchDIBits", FALSE);
6630 if (ret)
6631 {
6632 dump_emf_bits(hemf, "test_emf_StretchDIBits");
6633 dump_emf_records(hemf, "test_emf_StretchDIBits");
6634 }
6635
6636 DeleteEnhMetaFile(hemf);
6637
6639 }
6640
6641 ReleaseDC(0, hdc);
6642}
static const unsigned char EMF_STRETCHDIBITS_16BIT_555_4X4_SIZED[]
Definition: metafile.c:6135
static const unsigned char EMF_STRETCHDIBITS_16BIT_555_3X3_SIZED[]
Definition: metafile.c:5489
static const unsigned char EMF_STRETCHDIBITS_1BIT_4X4_SIZED[]
Definition: metafile.c:5906
static const unsigned char EMF_STRETCHDIBITS_32BIT_888_4X4_NOSIZE[]
Definition: metafile.c:6256
static const unsigned char EMF_STRETCHDIBITS_32BIT_3X3_NOSIZE[]
Definition: metafile.c:5778
static const unsigned char EMF_STRETCHDIBITS_32BIT_888_4X4_SIZED[]
Definition: metafile.c:6299
static const unsigned char EMF_STRETCHDIBITS_16BIT_4X4_NOSIZE[]
Definition: metafile.c:6342
static const unsigned char EMF_STRETCHDIBITS_16BIT_3X3_NOSIZE[]
Definition: metafile.c:5696
static const unsigned char EMF_STRETCHDIBITS_32BIT_4X4_SIZED[]
Definition: metafile.c:6469
static const unsigned char EMF_STRETCHDIBITS_8BIT_3X3_NOSIZE[]
Definition: metafile.c:5374
static const unsigned char EMF_STRETCHDIBITS_24BIT_4X4_SIZED[]
Definition: metafile.c:6215
static const unsigned char EMF_STRETCHDIBITS_32BIT_888_3X3_NOSIZE[]
Definition: metafile.c:5610
static const unsigned char EMF_STRETCHDIBITS_24BIT_4X4_NOSIZE[]
Definition: metafile.c:6174
static const unsigned char EMF_STRETCHDIBITS_4BIT_3X3_SIZED[]
Definition: metafile.c:5336
static const unsigned char EMF_STRETCHDIBITS_8BIT_4X4_SIZED[]
Definition: metafile.c:6058
static const unsigned char EMF_STRETCHDIBITS_24BIT_3X3_SIZED[]
Definition: metafile.c:5569
static const unsigned char EMF_STRETCHDIBITS_32BIT_3X3_SIZED[]
Definition: metafile.c:5823
static const unsigned char EMF_STRETCHDIBITS_16BIT_3X3_SIZED[]
Definition: metafile.c:5737
static const unsigned char EMF_STRETCHDIBITS_4BIT_4X4_SIZED[]
Definition: metafile.c:5982
static const unsigned char EMF_STRETCHDIBITS_16BIT_555_4X4_NOSIZE[]
Definition: metafile.c:6096
static const unsigned char EMF_STRETCHDIBITS_24BIT_3X3_NOSIZE[]
Definition: metafile.c:5528
static const unsigned char EMF_STRETCHDIBITS_32BIT_888_3X3_SIZED[]
Definition: metafile.c:5653
static const unsigned char EMF_STRETCHDIBITS_1BIT_3X3_SIZED[]
Definition: metafile.c:5260
static const unsigned char EMF_STRETCHDIBITS_8BIT_3X3_SIZED[]
Definition: metafile.c:5412
static const unsigned char EMF_STRETCHDIBITS_16BIT_555_3X3_NOSIZE[]
Definition: metafile.c:5450
static const unsigned char EMF_STRETCHDIBITS_8BIT_4X4_NOSIZE[]
Definition: metafile.c:6020
static const unsigned char EMF_STRETCHDIBITS_16BIT_4X4_SIZED[]
Definition: metafile.c:6383
static const unsigned char EMF_STRETCHDIBITS_1BIT_4X4_NOSIZE[]
Definition: metafile.c:5868
static const unsigned char EMF_STRETCHDIBITS_4BIT_3X3_NOSIZE[]
Definition: metafile.c:5298
static const unsigned char EMF_STRETCHDIBITS_1BIT_3X3_NOSIZE[]
Definition: metafile.c:5222
static const unsigned char EMF_STRETCHDIBITS_32BIT_4X4_NOSIZE[]
Definition: metafile.c:6424
static const unsigned char EMF_STRETCHDIBITS_4BIT_4X4_NOSIZE[]
Definition: metafile.c:5944
int WINAPI StretchDIBits(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ const VOID *, _In_ const BITMAPINFO *, _In_ UINT, _In_ DWORD)

Referenced by START_TEST().

◆ test_emf_text_extents()

static void test_emf_text_extents ( void  )
static

Definition at line 10694 of file metafile.c.

10695{
10696 static const XFORM xform = {0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f};
10697 HFONT font, old_font, old_font2;
10698 LOGFONTW logfont = {0};
10699 HENHMETAFILE emf;
10700 SIZE size, size2;
10701 HDC dc, emf_dc;
10702 BOOL ret;
10703
10704 dc = GetDC(0);
10705 emf_dc = CreateEnhMetaFileW(dc, NULL, NULL, NULL);
10706 ok(!!emf_dc, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
10707
10708 logfont.lfWeight = FW_NORMAL;
10709 logfont.lfHeight = 20;
10710 lstrcpyW(logfont.lfFaceName, L"Tahoma");
10711 font = CreateFontIndirectW(&logfont);
10712 ok(!!font, "CreateFontIndirectW failed, error %ld\n", GetLastError());
10713
10714 old_font = SelectObject(dc, font);
10715 old_font2 = SelectObject(emf_dc, font);
10716
10718 ok(ret, "SetGraphicsMode failed, error %ld\n", GetLastError());
10719 ret = SetGraphicsMode(emf_dc, GM_ADVANCED);
10720 ok(ret, "SetGraphicsMode failed, error %ld\n", GetLastError());
10721
10723 ok(ret, "ModifyWorldTransform failed, error %ld\n", GetLastError());
10724 ret = ModifyWorldTransform(emf_dc, &xform, MWT_RIGHTMULTIPLY);
10725 ok(ret, "ModifyWorldTransform failed, error %ld\n", GetLastError());
10726
10727 ret = GetTextExtentPoint32W(dc, L"W", 1, &size);
10728 ok(ret, "GetTextExtentPoint32W failed, error %ld\n", GetLastError());
10729 ret = GetTextExtentPoint32W(emf_dc, L"W", 1, &size2);
10730 ok(ret, "GetTextExtentPoint32W failed, error %ld\n", GetLastError());
10731 ok(size2.cx == size.cx && size2.cy == size.cy, "Expected size %ldx%ld, got %ldx%ld\n",
10732 size.cx, size.cy, size2.cx, size2.cy);
10733
10734 SelectObject(emf_dc, old_font2);
10735 SelectObject(dc, old_font);
10737 emf = CloseEnhMetaFile(emf_dc);
10738 ok(!!emf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
10740 ReleaseDC(0, dc);
10741}
HDC dc
Definition: cylfrac.c:34
#define lstrcpyW
Definition: compat.h:749
#define L(x)
Definition: resources.c:13
Definition: mk_font.cpp:20
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG cy
Definition: kdterminal.h:28
#define FW_NORMAL
Definition: wingdi.h:373
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

Referenced by START_TEST().

◆ test_emf_WorldTransform()

static void test_emf_WorldTransform ( void  )
static

Definition at line 9917 of file metafile.c.

9918{
9919 HDC hdcMetafile, hdc;
9920 HWND hwnd;
9921 HENHMETAFILE hemf;
9922 XFORM xform;
9923 BOOL ret;
9924 RECT rect = { 0, 0, 100, 100 };
9925 int i;
9927 { "normal", FALSE, TRUE },
9928 { "playback and modify", TRUE, TRUE },
9929 { "manual modify", TRUE, FALSE }
9930 };
9931
9932 for(i = 0; i < ARRAY_SIZE(test_data); ++i)
9933 {
9934 hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
9935 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
9936
9937 ret = SetGraphicsMode(hdcMetafile, GM_ADVANCED);
9938 ok(ret == TRUE, "SetGraphicsMode failed\n");
9939
9940 set_rotation_xform(&xform, M_PI / 4.f, 2, 3);
9941 ret = SetWorldTransform(hdcMetafile, &xform); /* EMR_SETWORLDTRANSFORM */
9942 ok(ret == TRUE, "SetWorldTransform failed\n");
9943
9944 ret = ModifyWorldTransform(hdcMetafile, NULL, MWT_IDENTITY); /* EMR_MODIFYWORLDTRANSFORM */
9945 ok(ret == TRUE, "ModifyWorldTransform failed\n");
9946
9947 set_rotation_xform(&xform, M_PI / 2.f, -2, -3);
9948 ret = ModifyWorldTransform(hdcMetafile, &xform, MWT_LEFTMULTIPLY); /* EMR_MODIFYWORLDTRANSFORM */
9949 ok(ret == TRUE, "ModifyWorldTransform failed\n");
9950
9951 set_rotation_xform(&xform, M_PI / 3.f, -2, 3);
9952 ret = ModifyWorldTransform(hdcMetafile, &xform, MWT_LEFTMULTIPLY); /* EMR_MODIFYWORLDTRANSFORM */
9953 ok(ret == TRUE, "ModifyWorldTransform failed\n");
9954
9955 set_rotation_xform(&xform, M_PI, 2, -3);
9956 ret = ModifyWorldTransform(hdcMetafile, &xform, MWT_RIGHTMULTIPLY); /* EMR_MODIFYWORLDTRANSFORM */
9957 ok(ret == TRUE, "ModifyWorldTransform failed\n");
9958
9959 ret = LineTo(hdcMetafile, 1, 1);
9960 ok(ret == TRUE, "LineTo failed\n");
9961
9962 hemf = CloseEnhMetaFile(hdcMetafile);
9963 ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
9964
9965 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
9966 0, 0, 200, 200, 0, 0, 0, NULL);
9967 ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
9968
9969 hdc = GetDC(hwnd);
9970 ok(hdc != 0, "GetDC failed\n");
9971
9973 ok(ret == TRUE, "EnumEnhMetaFile failed: %lu\n", GetLastError());
9974
9975 ReleaseDC(hwnd, hdc);
9977
9978 DeleteEnhMetaFile(hemf);
9979 }
9980}
static INT CALLBACK enum_emf_WorldTransform(HDC hdc, HANDLETABLE *ht, const ENHMETARECORD *emr, INT nobj, LPARAM param)
Definition: metafile.c:9747

Referenced by START_TEST().

◆ test_enhmetafile_file()

static void test_enhmetafile_file ( void  )
static

Definition at line 3749 of file metafile.c.

3750{
3751 char temp_path[MAX_PATH];
3752 char mf_name[MAX_PATH];
3753 char buf[4096];
3754 HENHMETAFILE metafile;
3755 POINT pts[4];
3756 DWORD size;
3757 HANDLE file;
3758 HDC dc;
3759 BOOL ret;
3760
3762 GetTempFileNameA(temp_path, "wmf", 0, mf_name);
3763
3764 dc = CreateEnhMetaFileA(NULL, mf_name, NULL, NULL);
3765 ok(dc != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
3766
3768 OPEN_EXISTING, 0, NULL);
3770 "CreateFile returned: %p %lu\n", file, GetLastError());
3771
3773 OPEN_EXISTING, 0, NULL);
3774 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
3775
3777 ok(!size, "size = %lu\n", size);
3778
3779 pts[0].x = pts[0].y = 10;
3780 pts[1].x = pts[1].y = 20;
3781 pts[2].x = pts[2].y = 15;
3782 pts[3].x = pts[3].y = 25;
3783 ret = PolyBezierTo(dc, pts, 3); /* EMR_POLYBEZIERTO16 */
3784 ok( ret, "PolyBezierTo failed\n" );
3785 ret = PolyBezier(dc, pts, 4); /* EMR_POLYBEZIER16 */
3786 ok( ret, "PolyBezier failed\n" );
3787
3788 pts[0].x = pts[0].y = 32769;
3789 ret = PolyBezier(dc, pts, 4); /* EMR_POLYBEZIER */
3790 ok( ret, "PolyBezier failed\n" );
3791 ret = PolyBezierTo(dc, pts, 3); /* EMR_POLYBEZIERTO */
3792 ok( ret, "PolyBezierTo failed\n" );
3793
3795 ok(!size, "size = %lu\n", size);
3796
3799 ok(size == sizeof(EMF_BEZIER_BITS), "size = %lu\n", size);
3800
3803 OPEN_EXISTING, 0, NULL);
3804 todo_wine
3806 "CreateFile returned: %p %lu\n", file, GetLastError());
3809 OPEN_EXISTING, 0, NULL);
3810 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
3811 ret = ReadFile(file, buf, sizeof(buf), &size, NULL);
3812 ok(ret, "ReadFile failed: %lu\n", GetLastError());
3813 ok(size == sizeof(EMF_BEZIER_BITS), "size = %lu\n", size);
3815
3816 if (compare_emf_bits(metafile, EMF_BEZIER_BITS, sizeof(EMF_BEZIER_BITS), "emf_Bezier", FALSE) != 0)
3817 {
3818 dump_emf_bits(metafile, "emf_Bezier");
3819 dump_emf_records(metafile, "emf_Bezier");
3820 }
3821
3823 ok(ret, "Could not delete emf: %lu\n", GetLastError());
3824
3825 SetLastError(0xdeadbeef);
3827 ok(!ret, "DeleteEnhMetaFile succeeded\n");
3828 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
3829
3830 SetLastError(0xdeadbeef);
3832 ok(!metafile && GetLastError() == ERROR_INVALID_HANDLE, "CloseMetaFile returned %p (%lu)\n",
3834
3835 ret = DeleteFileA(mf_name);
3836 ok(ret, "Could not delete file: %lu\n", GetLastError());
3837
3838 SetLastError(0xdeadbeef);
3839 ret = DeleteEnhMetaFile(ULongToHandle(0xdeadbeef));
3840 ok(!ret, "DeleteEnhMetaFile succeeded\n");
3841 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
3842
3843 SetLastError(0xdeadbeef);
3844 size = GetEnhMetaFileBits(ULongToHandle(0xdeadbeef), 0, NULL);
3845 ok(!size, "GetEnhMetaFileBitsEx returned %lu\n", size);
3846 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
3847}
#define ULongToHandle(h)
Definition: basetsd.h:75
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define todo_wine
Definition: minitest.h:80
static const unsigned char metafile[]
Definition: olepicture.c:138
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:257

Referenced by START_TEST().

◆ test_ExtTextOut()

static void test_ExtTextOut ( void  )
static

Definition at line 174 of file metafile.c.

175{
176 HWND hwnd;
177 HDC hdcDisplay, hdcMetafile;
178 HENHMETAFILE hMetafile;
179 HFONT hFont;
180 static const char text[] = "Simple text to test ExtTextOut on metafiles";
181 INT i, len, dx[256];
182 static const RECT rc = { 0, 0, 100, 100 };
183 BOOL ret;
184
186
187 /* Win9x doesn't play EMFs on invisible windows */
188 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
189 0, 0, 200, 200, 0, 0, 0, NULL);
190 ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
191
192 hdcDisplay = GetDC(hwnd);
193 ok(hdcDisplay != 0, "GetDC error %ld\n", GetLastError());
194
195 SetMapMode(hdcDisplay, MM_TEXT);
196
197 memset(&orig_lf, 0, sizeof(orig_lf));
198
202 orig_lf.lfHeight = 7;
204 lstrcpyA(orig_lf.lfFaceName, "Arial");
206 ok(hFont != 0, "CreateFontIndirectA error %ld\n", GetLastError());
207
208 hFont = SelectObject(hdcDisplay, hFont);
209
210 len = lstrlenA(text);
211 for (i = 0; i < len; i++)
212 {
213 ret = GetCharWidthA(hdcDisplay, text[i], text[i], &dx[i]);
214 ok( ret, "GetCharWidthA error %ld\n", GetLastError());
215 }
216 hFont = SelectObject(hdcDisplay, hFont);
217
218 hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
219 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
220
221 ok(GetDeviceCaps(hdcMetafile, TECHNOLOGY) == DT_RASDISPLAY,
222 "GetDeviceCaps(TECHNOLOGY) has to return DT_RASDISPLAY for a display based EMF\n");
223
224 hFont = SelectObject(hdcMetafile, hFont);
225
226 /* 1. pass NULL lpDx */
227 ret = ExtTextOutA(hdcMetafile, 0, 0, 0, &rc, text, lstrlenA(text), NULL);
228 ok( ret, "ExtTextOutA error %ld\n", GetLastError());
229
230 ret = ExtTextOutA(hdcMetafile, 0, 0, ETO_PDY, &rc, text, len, NULL);
231 ok( !ret, "ExtTextOutA succeeded\n");
232
233 /* 2. pass custom lpDx */
234 ret = ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx);
235 ok( ret, "ExtTextOutA error %ld\n", GetLastError());
236
237 for (i = len - 1; i >= 0; i--)
238 {
239 dx[2 * i] = dx[i];
240 dx[2 * i + 1] = 1;
241 }
242 ret = ExtTextOutA(hdcMetafile, 0, 20, ETO_PDY, &rc, text, len, dx);
243 ok( ret, "ExtTextOutA error %ld\n", GetLastError());
244
245 /* 3. pass NULL lprc */
246 ret = ExtTextOutA(hdcMetafile, 0, 40, 0, NULL, text, lstrlenA(text), NULL);
247 ok( ret, "ExtTextOutA error %ld\n", GetLastError());
248
249 /* 4. test with unmatched BeginPath/EndPath calls */
250 ret = BeginPath(hdcMetafile);
251 ok( ret, "BeginPath error %ld\n", GetLastError());
252 ret = BeginPath(hdcMetafile);
253 ok( ret, "BeginPath error %ld\n", GetLastError());
254 ret = EndPath(hdcMetafile);
255 ok( ret, "BeginPath error %ld\n", GetLastError());
256 ret = ExtTextOutA(hdcMetafile, 0, 60, 0, NULL, text, lstrlenA(text), NULL);
257 ok( ret, "ExtTextOutA error %ld\n", GetLastError());
258
259 hFont = SelectObject(hdcMetafile, hFont);
261 ok( ret, "DeleteObject error %ld\n", GetLastError());
262
263 hMetafile = CloseEnhMetaFile(hdcMetafile);
264 ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
265
266 ok(!GetObjectType(hdcMetafile), "CloseEnhMetaFile has to destroy metafile hdc\n");
267
268 ret = PlayEnhMetaFile(hdcDisplay, hMetafile, &rc);
269 ok( ret, "PlayEnhMetaFile error %ld\n", GetLastError());
270
272 SetBkColor(hdcDisplay, RGB(0xff, 0, 0));
273 SetTextColor(hdcDisplay, RGB(0, 0xff, 0));
274 SetROP2(hdcDisplay, R2_NOT);
275 SetArcDirection(hdcDisplay, AD_CLOCKWISE);
276 SetPolyFillMode(hdcDisplay, WINDING);
277 SetStretchBltMode(hdcDisplay, HALFTONE);
278
279 if(pSetRelAbs) pSetRelAbs(hdcDisplay, RELATIVE);
280 SetBkMode(hdcDisplay, OPAQUE);
281
282 ret = EnumEnhMetaFile(hdcDisplay, hMetafile, eto_emf_enum_proc, dx, &rc);
283 ok( ret, "EnumEnhMetaFile error %ld\n", GetLastError());
284
286 "text align %08x\n", GetTextAlign(hdcDisplay));
287 ok( GetBkColor(hdcDisplay) == RGB(0xff, 0, 0), "bk color %08lx\n", GetBkColor(hdcDisplay));
288 ok( GetTextColor(hdcDisplay) == RGB(0, 0xff, 0), "text color %08lx\n", GetTextColor(hdcDisplay));
289 ok( GetROP2(hdcDisplay) == R2_NOT, "rop2 %d\n", GetROP2(hdcDisplay));
290 ok( GetArcDirection(hdcDisplay) == AD_CLOCKWISE, "arc dir %d\n", GetArcDirection(hdcDisplay));
291 ok( GetPolyFillMode(hdcDisplay) == WINDING, "poly fill %d\n", GetPolyFillMode(hdcDisplay));
292 ok( GetStretchBltMode(hdcDisplay) == HALFTONE, "stretchblt mode %d\n", GetStretchBltMode(hdcDisplay));
293
294 ok(emr_processed, "EnumEnhMetaFile couldn't find EMR_EXTTEXTOUTA or EMR_EXTTEXTOUTW record\n");
295
296 ok(!EnumEnhMetaFile(hdcDisplay, hMetafile, eto_emf_enum_proc, dx, NULL),
297 "A valid hdc has to require a valid rc\n");
298
300 "A null hdc does not require a valid rc\n");
301
302 ret = DeleteEnhMetaFile(hMetafile);
303 ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
304 ret = ReleaseDC(hwnd, hdcDisplay);
305 ok( ret, "ReleaseDC error %ld\n", GetLastError());
307}
#define WINDING
Definition: constants.h:279
const WCHAR * text
Definition: package.c:1794
GLenum GLsizei len
Definition: glext.h:6722
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static int CALLBACK eto_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param)
Definition: metafile.c:63
#define DT_RASDISPLAY
Definition: wingdi.h:708
#define TA_UPDATECP
Definition: wingdi.h:936
int WINAPI SetArcDirection(_In_ HDC, _In_ int)
#define TA_RTLREADING
Definition: wingdi.h:934
#define R2_NOT
Definition: wingdi.h:347
#define TA_BASELINE
Definition: wingdi.h:928
#define HALFTONE
Definition: wingdi.h:955
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917
int WINAPI SetROP2(_In_ HDC, _In_ int)
Definition: dc.c:1114
#define TA_CENTER
Definition: wingdi.h:931
#define AD_CLOCKWISE
Definition: wingdi.h:668
int WINAPI SetStretchBltMode(_In_ HDC, _In_ int)
Definition: dc.c:1373
BOOL WINAPI GetCharWidthA(_In_ HDC hdc, _In_ UINT iFirst, _In_ UINT iLast, _Out_writes_(iLast+1 - iFirst) LPINT lpBuffer)
BOOL WINAPI PlayEnhMetaFile(_In_ HDC, _In_ HENHMETAFILE, _In_ LPCRECT)
#define TECHNOLOGY
Definition: wingdi.h:706
int WINAPI SetPolyFillMode(_In_ HDC, _In_ int)
Definition: dc.c:1174

Referenced by START_TEST().

◆ test_ExtTextOutScale()

static void test_ExtTextOutScale ( void  )
static

Definition at line 336 of file metafile.c.

337{
338 const RECT rc = { 0, 0, 100, 100 };
340 HDC hdcDisplay, hdcMetafile;
341 HENHMETAFILE hMetafile;
342 HWND hwnd;
343 SIZE wndext, vportext;
344 int horzSize, vertSize, horzRes, vertRes;
345 int ret;
346 int i;
347
348 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
349 0, 0, 200, 200, 0, 0, 0, NULL);
350 ok(hwnd != 0, "CreateWindowExA failed\n");
351
352 hdcDisplay = GetDC(hwnd);
353 ok(hdcDisplay != 0, "GetDC failed\n");
354
355 horzSize = GetDeviceCaps(hdcDisplay, HORZSIZE);
356 horzRes = GetDeviceCaps(hdcDisplay, HORZRES);
357 vertSize = GetDeviceCaps(hdcDisplay, VERTSIZE);
358 vertRes = GetDeviceCaps(hdcDisplay, VERTRES);
359 ok(horzSize && horzRes && vertSize && vertRes, "GetDeviceCaps failed\n");
360
361 for (i = 0; i < 16; i++)
362 {
363 test.graphics_mode = i / 8 + 1;
364 test.map_mode = i % 8 + 1;
365
366 ret = SetGraphicsMode(hdcDisplay, test.graphics_mode);
367 ok(ret, "SetGraphicsMode failed\n");
368 ret = SetMapMode(hdcDisplay, test.map_mode);
369 ok(ret, "SetMapMode failed\n");
370
371 if ((test.map_mode == MM_ISOTROPIC) || (test.map_mode == MM_ANISOTROPIC))
372 {
373 ret = SetWindowExtEx(hdcDisplay, 1, 1, NULL);
374 ok(ret, "SetWindowExtEx failed\n");
375 ret = SetViewportExtEx(hdcDisplay, -20, -10, NULL);
376 ok(ret, "SetViewportExtEx failed\n");
377 }
378
379 ret = GetViewportExtEx(hdcDisplay, &vportext);
380 ok(ret, "GetViewportExtEx failed\n");
381 ret = GetWindowExtEx(hdcDisplay, &wndext);
382 ok(ret, "GetWindowExtEx failed\n");
383
384 if (winetest_debug > 1)
385 trace("gm %d, mm %d, wnd %ld,%ld, vp %ld,%ld horz %d,%d vert %d,%d\n",
386 test.graphics_mode, test.map_mode,
387 wndext.cx, wndext.cy, vportext.cx, vportext.cy,
388 horzSize, horzRes, vertSize, vertRes);
389
390 if (test.graphics_mode == GM_COMPATIBLE)
391 {
392 test.ex_scale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) /
393 ((FLOAT)wndext.cx / (FLOAT)vportext.cx);
394 test.ey_scale = 100.0 * ((FLOAT)vertSize / (FLOAT)vertRes) /
395 ((FLOAT)wndext.cy / (FLOAT)vportext.cy);
396 }
397 else
398 {
399 test.ex_scale = 0.0;
400 test.ey_scale = 0.0;
401 }
402
403 hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
404 ok(hdcMetafile != 0, "CreateEnhMetaFileA failed\n");
405
406 ret = SetGraphicsMode(hdcMetafile, test.graphics_mode);
407 ok(ret, "SetGraphicsMode failed\n");
408 ret = SetMapMode(hdcMetafile, test.map_mode);
409 ok(ret, "SetMapMode failed\n");
410
411 if ((test.map_mode == MM_ISOTROPIC) || (test.map_mode == MM_ANISOTROPIC))
412 {
413 ret = SetWindowExtEx(hdcMetafile, 1, 1, NULL);
414 ok(ret, "SetWindowExtEx failed\n");
415 ret = SetViewportExtEx(hdcMetafile, -20, -10, NULL);
416 ok(ret, "SetViewportExtEx failed\n");
417 }
418
419 ret = ExtTextOutW(hdcMetafile, 0, 0, 0, 0, L"a", 1, NULL);
420 ok(ret, "ExtTextOutW failed\n");
421
422 hMetafile = CloseEnhMetaFile(hdcMetafile);
423 ok(hMetafile != 0, "CloseEnhMetaFile failed\n");
424
425 test.processed = 0;
426 ret = EnumEnhMetaFile(hdcDisplay, hMetafile, eto_scale_enum_proc, &test, &rc);
427 ok(ret, "EnumEnhMetaFile failed\n");
428 ok(test.processed, "EnumEnhMetaFile couldn't find EMR_EXTTEXTOUTW record\n");
429
430 ret = DeleteEnhMetaFile(hMetafile);
431 ok(ret, "DeleteEnhMetaFile failed\n");
432 }
433
434 ret = ReleaseDC(hwnd, hdcDisplay);
435 ok(ret, "ReleaseDC failed\n");
437}
static int CALLBACK eto_scale_enum_proc(HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param)
Definition: metafile.c:318
#define GM_COMPATIBLE
Definition: wingdi.h:864
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)

Referenced by START_TEST().

◆ test_gdiis()

static void test_gdiis ( void  )
static

Definition at line 9258 of file metafile.c.

9259{
9260 RECT rect = {0,0,100,100};
9261 HDC hdc, hemfDC, hmfDC;
9262 HENHMETAFILE hemf;
9264
9265 /* resolve all the functions */
9266 hgdi32 = GetModuleHandleA("gdi32.dll");
9267 pGdiIsMetaPrintDC = (void*) GetProcAddress(hgdi32, "GdiIsMetaPrintDC");
9268 pGdiIsMetaFileDC = (void*) GetProcAddress(hgdi32, "GdiIsMetaFileDC");
9269 pGdiIsPlayMetafileDC = (void*) GetProcAddress(hgdi32, "GdiIsPlayMetafileDC");
9270
9271 if(!pGdiIsMetaPrintDC || !pGdiIsMetaFileDC || !pGdiIsPlayMetafileDC)
9272 {
9273 win_skip("Needed GdiIs* functions are not available\n");
9274 return;
9275 }
9276
9277 /* try with nothing */
9278 ok(!pGdiIsMetaPrintDC(NULL), "ismetaprint with NULL parameter\n");
9279 ok(!pGdiIsMetaFileDC(NULL), "ismetafile with NULL parameter\n");
9280 ok(!pGdiIsPlayMetafileDC(NULL), "isplaymetafile with NULL parameter\n");
9281
9282 /* try with a metafile */
9283 hmfDC = CreateMetaFileA(NULL);
9284 ok(!pGdiIsMetaPrintDC(hmfDC), "ismetaprint on metafile\n");
9285 ok(pGdiIsMetaFileDC(hmfDC), "ismetafile on metafile\n");
9286 ok(!pGdiIsPlayMetafileDC(hmfDC), "isplaymetafile on metafile\n");
9288
9289 /* try with an enhanced metafile */
9290 hdc = GetDC(NULL);
9291 hemfDC = CreateEnhMetaFileW(hdc, NULL, &rect, NULL);
9292 ok(hemfDC != NULL, "failed to create emf\n");
9293
9294 ok(!pGdiIsMetaPrintDC(hemfDC), "ismetaprint on emf\n");
9295 ok(pGdiIsMetaFileDC(hemfDC), "ismetafile on emf\n");
9296 ok(!pGdiIsPlayMetafileDC(hemfDC), "isplaymetafile on emf\n");
9297
9298 hemf = CloseEnhMetaFile(hemfDC);
9299 ok(hemf != NULL, "failed to close EMF\n");
9300 DeleteEnhMetaFile(hemf);
9302}
static HMODULE hgdi32
Definition: font.c:50

Referenced by START_TEST().

◆ test_GetWinMetaFileBits()

static void test_GetWinMetaFileBits ( void  )
static

Definition at line 9226 of file metafile.c.

9227{
9228 UINT mode;
9229 RECT frames[] =
9230 {
9231 { 1000, 2000, 3000, 6000},
9232 {-1000, 2000, 3000, 6000},
9233 { 1000, -2000, 3000, 6000},
9234 { 1005, 2005, 3000, 6000},
9235 {-1005, -2005, 3000, 6000},
9236 {-1005, -2010, 3000, 6000},
9237 {-1005, 2010, 3000, 6000},
9238 { 0, 0, 1, 1},
9239 { -1, -1, 1, 1},
9240 { 0, 0, 0, 0}
9241 };
9242
9243 for(mode = MM_MIN; mode <= MM_MAX; mode++)
9244 {
9245 RECT *rc;
9246 for(rc = frames; rc->right - rc->left > 0; rc++)
9247 {
9248 getwinmetafilebits(mode, 1, rc);
9249 getwinmetafilebits(mode, 2, rc);
9250 }
9251 }
9252}
static void getwinmetafilebits(UINT mode, int scale, RECT *rc)
Definition: metafile.c:9048
#define MM_MIN
Definition: wingdi.h:876
#define MM_MAX
Definition: wingdi.h:877

Referenced by START_TEST().

◆ test_metafile_file()

static void test_metafile_file ( void  )
static

Definition at line 3591 of file metafile.c.

3592{
3593 char temp_path[MAX_PATH];
3594 char mf_name[MAX_PATH];
3595 char buf[4096];
3596 HMETAFILE metafile;
3597 POINT oldpoint;
3598 DWORD size;
3599 HANDLE file;
3600 HDC dc;
3601 BOOL ret;
3602
3604 GetTempFileNameA(temp_path, "wmf", 0, mf_name);
3605
3606 dc = CreateMetaFileA(mf_name);
3607 ok(dc != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
3608
3610 OPEN_EXISTING, 0, NULL);
3612 "CreateFile returned: %p %lu\n", file, GetLastError());
3613
3615 OPEN_EXISTING, 0, NULL);
3616 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
3617
3619 ok(!size, "size = %lu\n", size);
3620
3621 ret = MoveToEx(dc, 1, 1, NULL);
3622 ok( ret, "MoveToEx error %ld.\n", GetLastError());
3623 ret = LineTo(dc, 2, 2);
3624 ok( ret, "LineTo error %ld.\n", GetLastError());
3625 ret = MoveToEx(dc, 1, 1, &oldpoint);
3626 ok( ret, "MoveToEx error %ld.\n", GetLastError());
3627 ret = Ellipse(dc, 0, 0, 2, 2);
3628 ok( ret, "Ellipse error %ld.\n", GetLastError());
3629
3630 ret = GetCurrentPositionEx(dc, &oldpoint);
3631 ok(!ret, "GetCurrentPositionEx succeeded\n");
3632
3634 ok(!size, "size = %lu\n", size);
3635
3638 ok(size == sizeof(MF_GRAPHICS_BITS), "size = %lu\n", size);
3639
3642 OPEN_EXISTING, 0, NULL);
3643 todo_wine
3645 "CreateFile returned: %p %lu\n", file, GetLastError());
3648 OPEN_EXISTING, 0, NULL);
3649 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
3650 ret = ReadFile(file, buf, sizeof(buf), &size, NULL);
3651 ok(ret, "ReadFile failed: %lu\n", GetLastError());
3652 ok(size == sizeof(MF_GRAPHICS_BITS), "size = %lu\n", size);
3653 ok(!memcmp(buf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS)), "unexpected file content\n");
3655
3656 if (compare_mf_bits(metafile, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS), "mf_Graphics") != 0)
3657 {
3658 dump_mf_bits(metafile, "mf_Graphics");
3660 }
3661
3663 ok(ret, "Could not delete metafile: %lu\n", GetLastError());
3664
3665 SetLastError(0xdeadbeef);
3667 ok(!ret, "DeleteMetaFile succeeded\n");
3668 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
3669
3670 SetLastError(0xdeadbeef);
3672 ok(!metafile && GetLastError() == ERROR_INVALID_HANDLE, "CloseMetaFile returned %p (%lu)\n",
3674
3675 ret = DeleteFileA(mf_name);
3676 ok(ret, "Could not delete file: %lu\n", GetLastError());
3677
3678 SetLastError(0xdeadbeef);
3679 ret = DeleteMetaFile(ULongToHandle(0xdeadbeef));
3680 ok(!ret, "DeleteMetaFile succeeded\n");
3681 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
3682
3683 SetLastError(0xdeadbeef);
3684 size = GetMetaFileBitsEx(ULongToHandle(0xdeadbeef), 0, NULL);
3685 ok(!size, "GetMetaFileBitsEx returned %lu\n", size);
3686 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
3687}
static const unsigned char MF_GRAPHICS_BITS[]
Definition: metafile.c:1027
BOOL WINAPI GetCurrentPositionEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:241

Referenced by START_TEST().

◆ test_mf_attrs()

static void test_mf_attrs ( void  )
static

Definition at line 3725 of file metafile.c.

3726{
3727 HMETAFILE mf;
3728 UINT attr;
3729 HDC hdc;
3730
3732 ok(hdc != 0, "CreateEnhMetaFile failed\n");
3733
3735 ok(attr == TRUE, "attr = %x\n", attr);
3737 ok(attr == TRUE, "attr = %x\n", attr);
3738
3740 ok(attr == TRUE, "attr = %x\n", attr);
3742 ok(attr == TRUE, "attr = %x\n", attr);
3743
3744 mf = CloseMetaFile(hdc);
3745 ok(mf != 0, "CloseEnhMetaFile failed\n");
3746 DeleteMetaFile(mf);
3747}
HDC WINAPI CreateMetaFileW(_In_opt_ LPCWSTR)

Referenced by START_TEST().

◆ test_mf_Blank()

static void test_mf_Blank ( void  )
static

Definition at line 3556 of file metafile.c.

3557{
3558 HDC hdcMetafile;
3559 HMETAFILE hMetafile;
3560 INT caps;
3561 BOOL ret;
3562 INT type;
3563
3564 hdcMetafile = CreateMetaFileA(NULL);
3565 ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
3566
3567/* Tests on metafile initialization */
3568 caps = GetDeviceCaps (hdcMetafile, TECHNOLOGY);
3569 ok (caps == DT_METAFILE,
3570 "GetDeviceCaps: TECHNOLOGY=%d != DT_METAFILE.\n", caps);
3571
3572 hMetafile = CloseMetaFile(hdcMetafile);
3573 ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
3574 type = GetObjectType(hMetafile);
3575 ok(type == OBJ_METAFILE, "CloseMetaFile created object with type %d\n", type);
3576 type = GetObjectType(hdcMetafile);
3577 ok(type == 0 || broken(type == OBJ_METADC) /* win10 >=1607 */,
3578 "CloseMetaFile has to destroy metafile hdc (%d)\n", type);
3579
3580 if (compare_mf_bits (hMetafile, MF_BLANK_BITS, sizeof(MF_BLANK_BITS),
3581 "mf_blank") != 0)
3582 {
3583 dump_mf_bits(hMetafile, "mf_Blank");
3584 EnumMetaFile(0, hMetafile, mf_enum_proc, 0);
3585 }
3586
3587 ret = DeleteMetaFile(hMetafile);
3588 ok( ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
3589}
#define OBJ_METADC
Definition: objidl.idl:1017
#define DT_METAFILE
Definition: wingdi.h:712

Referenced by START_TEST().

◆ test_mf_blit()

static void test_mf_blit ( void  )
static

Definition at line 4910 of file metafile.c.

4911{
4912 BITMAPINFO bmi = {{ sizeof(bmi) }};
4913 HMETAFILE hmf;
4914 HBITMAP bitmap, old_bitmap;
4915 void *bits;
4916 HDC hdc, dib_hdc;
4917 unsigned int i;
4918 BOOL ret;
4919
4920 static const unsigned char blit_bits[] =
4921 {
4922 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0xdf, 0x00,
4923 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00,
4924 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x1d, 0x06,
4925 0x21, 0x00, 0xf0, 0x00, 0x05, 0x00, 0x04, 0x00,
4926 0x03, 0x00, 0x02, 0x00, 0x33, 0x00, 0x00, 0x00,
4927 0x41, 0x0b, 0x20, 0x00, 0xcc, 0x00, 0x03, 0x00,
4928 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
4929 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x28, 0x00,
4930 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00,
4931 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00,
4932 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
4933 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4934 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b,
4935 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
4936 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
4937 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
4938 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
4939 0x2c, 0x2d, 0x33, 0x00, 0x00, 0x00, 0x41, 0x0b,
4940 0x21, 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00,
4941 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x04, 0x00,
4942 0x02, 0x00, 0x01, 0x00, 0x28, 0x00, 0x00, 0x00,
4943 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
4944 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
4945 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4946 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4947 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0c, 0x0d,
4948 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
4949 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
4950 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
4951 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
4952 0x33, 0x00, 0x00, 0x00, 0x41, 0x0b, 0x20, 0x00,
4953 0xcc, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00,
4954 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00,
4955 0x01, 0x00, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00,
4956 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00,
4957 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00,
4958 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4959 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4960 0x00, 0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
4961 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
4962 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
4963 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
4964 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x31, 0x00,
4965 0x00, 0x00, 0x40, 0x09, 0x20, 0x00, 0xcc, 0x00,
4966 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00,
4967 0x02, 0x00, 0x01, 0x00, 0x28, 0x00, 0x00, 0x00,
4968 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
4969 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
4970 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4971 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4972 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0c, 0x0d,
4973 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
4974 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
4975 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
4976 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
4977 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
4978 };
4979
4981 ok(hdc != 0, "CreateMetaFileA failed\n");
4982
4983 ret = PatBlt(hdc, 2, 3, 4, 5, PATCOPY);
4984 ok(ret, "PatBlt failed\n");
4985
4986 dib_hdc = CreateCompatibleDC(NULL);
4987 ok(!!dib_hdc, "CreateCompatibleDC failed\n");
4988
4989 bmi.bmiHeader.biHeight = 3;
4990 bmi.bmiHeader.biWidth = 4;
4991 bmi.bmiHeader.biBitCount = 24;
4992 bmi.bmiHeader.biPlanes = 1;
4994 bitmap = CreateDIBSection(dib_hdc, &bmi, DIB_RGB_COLORS, &bits, NULL, 0);
4995 ok(!!bitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
4996 for (i = 0; i < bmi.bmiHeader.biHeight * bmi.bmiHeader.biWidth * 3; i++)
4997 ((BYTE *)bits)[i] = i + 10;
4998
4999 old_bitmap = SelectObject(dib_hdc, bitmap);
5000 ok(!!old_bitmap, "SelectObject failed\n");
5001
5002 ret = StretchBlt(hdc, 1, 2, 4, 6, dib_hdc, 0, 0, 2, 3, SRCCOPY);
5003 ok(ret, "StretchBlt failed\n");
5004
5005 /* PATCOPY is recorded as StretchBlt */
5006 ret = StretchBlt(hdc, 1, 2, 4, 6, dib_hdc, 0, 0, 2, 3, PATCOPY);
5007 ok(ret, "StretchBlt failed\n");
5008
5009 /* same src and dst size, recorded as StretchBlt */
5010 ret = StretchBlt(hdc, 1, 2, 2, 3, dib_hdc, 0, 0, 2, 3, SRCCOPY);
5011 ok(ret, "StretchBlt failed\n");
5012
5013 ret = BitBlt(hdc, 1, 2, 2, 3, dib_hdc, 0, 0, SRCCOPY);
5014 ok(ret, "BitBlt failed\n");
5015
5016 DeleteDC(dib_hdc);
5018
5019 hmf = CloseMetaFile(hdc);
5020 ok(hmf != 0, "CloseMetaFile failed\n");
5021
5022 if (compare_mf_bits(hmf, blit_bits, sizeof(blit_bits), "mf_blit"))
5023 {
5024 dump_mf_bits(hmf, "mf_blit");
5025 EnumMetaFile(0, hmf, mf_enum_proc, 0);
5026 }
5027
5028 ret = DeleteMetaFile(hmf);
5029 ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
5030}

Referenced by START_TEST().

◆ test_mf_clipping()

static void test_mf_clipping ( void  )
static

Definition at line 8566 of file metafile.c.

8567{
8568 /* left top right bottom */
8569 static RECT rc_clip = { 0x11, 0x22, 0x33, 0x44 };
8570 HWND hwnd;
8571 HDC hdc;
8572 HMETAFILE hmf;
8573 HRGN hrgn;
8574 INT ret;
8575
8576 SetLastError(0xdeadbeef);
8578 ok(hdc != 0, "CreateMetaFileA error %ld\n", GetLastError());
8579
8580 hrgn = CreateRectRgn(rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
8582 /* Seems like it should be SIMPLEREGION, but windows returns NULLREGION? */
8583 ok(ret == NULLREGION, "expected NULLREGION, got %d\n", ret);
8584
8585 /* Draw a line that starts off left of the clip region and ends inside it */
8586 MoveToEx(hdc, 0x1, 0x30, NULL);
8587 LineTo(hdc, 0x20, 0x30);
8588
8589 SetLastError(0xdeadbeef);
8590 hmf = CloseMetaFile(hdc);
8591 ok(hmf != 0, "CloseMetaFile error %ld\n", GetLastError());
8592
8593 if (compare_mf_bits(hmf, MF_CLIP_BITS, sizeof(MF_CLIP_BITS),
8594 "mf_clipping") != 0)
8595 {
8596 dump_mf_bits(hmf, "mf_clipping");
8597 }
8598
8600
8601 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
8602 0, 0, 200, 200, 0, 0, 0, NULL);
8603 ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
8604
8605 hdc = GetDC(hwnd);
8606
8607 ret = EnumMetaFile(hdc, hmf, clip_mf_enum_proc, (LPARAM)&rc_clip);
8608 ok(ret, "EnumMetaFile error %ld\n", GetLastError());
8609
8610 /* Oddly, windows doesn't seem to use META_SELECTCLIPREGION */
8612 "expected 0 selectclipregion, saw %d\n", clip_mf_enum_proc_seen_selectclipregion);
8614 "expected 1 selectobject, saw %d\n", clip_mf_enum_proc_seen_selectobject);
8615
8616 DeleteMetaFile(hmf);
8617 ReleaseDC(hwnd, hdc);
8619}
LONG_PTR LPARAM
Definition: minwindef.h:175
static const unsigned char MF_CLIP_BITS[]
Definition: metafile.c:8503
static int CALLBACK clip_mf_enum_proc(HDC hdc, HANDLETABLE *handle_table, METARECORD *mr, int n_objs, LPARAM param)
Definition: metafile.c:8552
#define NULLREGION
Definition: wingdi.h:361

Referenced by START_TEST().

◆ test_mf_conversions()

static void test_mf_conversions ( void  )
static

Definition at line 8750 of file metafile.c.

8751{
8752 trace("Testing MF->EMF conversion (MM_ANISOTROPIC)\n");
8753 {
8755 HENHMETAFILE hemf;
8756 METAFILEPICT mfp;
8757 RECT rect = { 0, 0, 100, 100 };
8758 mfp.mm = MM_ANISOTROPIC;
8759 mfp.xExt = 100;
8760 mfp.yExt = 100;
8761 mfp.hMF = NULL;
8762 hemf = create_converted_emf(&mfp);
8763
8765 "emf_LineTo MM_ANISOTROPIC", TRUE) != 0)
8766 {
8767 dump_emf_bits(hemf, "emf_LineTo MM_ANISOTROPIC");
8768 dump_emf_records(hemf, "emf_LineTo MM_ANISOTROPIC");
8769 }
8770
8772
8773 DeleteEnhMetaFile(hemf);
8775 }
8776
8777 trace("Testing MF->EMF conversion (MM_TEXT)\n");
8778 {
8780 HENHMETAFILE hemf;
8781 METAFILEPICT mfp;
8782 RECT rect = { 0, 0, 100, 100 };
8783 mfp.mm = MM_TEXT;
8784 mfp.xExt = 0;
8785 mfp.yExt = 0;
8786 mfp.hMF = NULL;
8787 hemf = create_converted_emf(&mfp);
8788
8790 "emf_LineTo MM_TEXT", TRUE) != 0)
8791 {
8792 dump_emf_bits(hemf, "emf_LineTo MM_TEXT");
8793 dump_emf_records(hemf, "emf_LineTo MM_TEXT");
8794 }
8795
8797
8798 DeleteEnhMetaFile(hemf);
8800 }
8801
8802 trace("Testing MF->EMF conversion (NULL mfp)\n");
8803 {
8805 HENHMETAFILE hemf;
8806 RECT rect = { 0, 0, 100, 100 };
8807 hemf = create_converted_emf(NULL);
8808
8810 "emf_LineTo NULL", TRUE) != 0)
8811 {
8812 dump_emf_bits(hemf, "emf_LineTo NULL");
8813 dump_emf_records(hemf, "emf_LineTo NULL");
8814 }
8815
8817
8818 DeleteEnhMetaFile(hemf);
8820 }
8821}
HDC hdcOffscreen
Definition: magnifier.c:52
static HENHMETAFILE create_converted_emf(const METAFILEPICT *mfp)
Definition: metafile.c:8718
static const unsigned char EMF_LINETO_MM_ANISOTROPIC_BITS[]
Definition: metafile.c:1231
static INT CALLBACK EmfEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData)
Definition: metafile.c:8678
static const unsigned char EMF_LINETO_MM_TEXT_BITS[]
Definition: metafile.c:1273
static const unsigned char EMF_LINETO_BITS[]
Definition: metafile.c:1189
HMETAFILE hMF
Definition: wingdi.h:3054

Referenced by START_TEST().

◆ test_mf_DCBrush()

static void test_mf_DCBrush ( void  )
static

Definition at line 4367 of file metafile.c.

4368{
4369 HDC hdcMetafile;
4370 HMETAFILE hMetafile;
4371 HBRUSH hBrush;
4372 HPEN hPen;
4373 BOOL ret;
4375
4376 if (!pSetDCBrushColor || !pSetDCPenColor)
4377 {
4378 win_skip( "SetDCBrush/PenColor not supported\n" );
4379 return;
4380 }
4381
4382 hdcMetafile = CreateMetaFileA(NULL);
4383 ok( hdcMetafile != 0, "CreateMetaFileA failed\n" );
4384
4385 hBrush = SelectObject(hdcMetafile, GetStockObject(DC_BRUSH));
4386 ok(hBrush != 0, "SelectObject error %ld.\n", GetLastError());
4387
4388 hPen = SelectObject(hdcMetafile, GetStockObject(DC_PEN));
4389 ok(hPen != 0, "SelectObject error %ld.\n", GetLastError());
4390
4391 color = pSetDCBrushColor( hdcMetafile, RGB(0x55,0x55,0x55) );
4392 ok( color == CLR_INVALID, "SetDCBrushColor returned %lx\n", color );
4393
4394 color = pSetDCPenColor( hdcMetafile, RGB(0x33,0x44,0x55) );
4395 ok( color == CLR_INVALID, "SetDCPenColor returned %lx\n", color );
4396
4397 Rectangle( hdcMetafile, 10, 10, 20, 20 );
4398
4399 color = pSetDCBrushColor( hdcMetafile, RGB(0x12,0x34,0x56) );
4400 ok( color == CLR_INVALID, "SetDCBrushColor returned %lx\n", color );
4401
4402 hMetafile = CloseMetaFile(hdcMetafile);
4403 ok( hMetafile != 0, "CloseMetaFile failed\n" );
4404
4405 if (compare_mf_bits(hMetafile, MF_DCBRUSH_BITS, sizeof(MF_DCBRUSH_BITS), "mf_DCBrush") != 0)
4406 {
4407 dump_mf_bits(hMetafile, "mf_DCBrush");
4408 EnumMetaFile(0, hMetafile, mf_enum_proc, 0);
4409 }
4410 ret = DeleteMetaFile(hMetafile);
4411 ok(ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
4412}
static const unsigned char MF_DCBRUSH_BITS[]
Definition: metafile.c:1082

Referenced by START_TEST().

◆ test_mf_ExtTextOut_on_path()

static void test_mf_ExtTextOut_on_path ( void  )
static

Definition at line 8031 of file metafile.c.

8032{
8033 HDC hdcMetafile;
8034 HMETAFILE hMetafile;
8035 BOOL ret;
8036 static const INT dx[4] = { 3, 5, 8, 12 };
8037
8038 hdcMetafile = CreateMetaFileA(NULL);
8039 ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
8040
8041 ret = BeginPath(hdcMetafile);
8042 ok(!ret, "BeginPath on metafile DC should fail\n");
8043
8044 ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
8045 ok(ret, "ExtTextOut error %ld\n", GetLastError());
8046
8047 ret = EndPath(hdcMetafile);
8048 ok(!ret, "EndPath on metafile DC should fail\n");
8049
8050 hMetafile = CloseMetaFile(hdcMetafile);
8051 ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
8052
8054 "mf_TextOut_on_path") != 0)
8055 {
8056 dump_mf_bits(hMetafile, "mf_TextOut_on_path");
8057 EnumMetaFile(0, hMetafile, mf_enum_proc, 0);
8058 }
8059
8060 ret = DeleteMetaFile(hMetafile);
8061 ok(ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
8062}
static const unsigned char MF_TEXTOUT_ON_PATH_BITS[]
Definition: metafile.c:1097

Referenced by START_TEST().

◆ test_mf_FloodFill()

static void test_mf_FloodFill ( void  )
static

Definition at line 4099 of file metafile.c.

4100{
4101 HMETAFILE mf;
4102 HDC hdc;
4103 BOOL ret;
4104
4105 static const unsigned char floodfill_bits[] =
4106 {
4107 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x24, 0x00,
4108 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
4109 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x48, 0x05,
4110 0x00, 0x00, 0x03, 0x04, 0x05, 0x00, 0x02, 0x00,
4111 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x48, 0x05,
4112 0x00, 0x00, 0x08, 0x09, 0x0a, 0x00, 0x07, 0x00,
4113 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x48, 0x05,
4114 0x01, 0x00, 0x12, 0x13, 0x14, 0x00, 0x11, 0x00,
4115 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
4116 };
4117
4119 ok(hdc != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
4120
4121 ret = FloodFill(hdc, 1, 2, RGB(3,4,5));
4122 ok(ret, "FloodFill failed\n");
4123
4124 ret = ExtFloodFill(hdc, 6, 7, RGB(8,9,10), FLOODFILLBORDER);
4125 ok(ret, "FloodFill failed\n");
4126
4127 ret = ExtFloodFill(hdc, 16, 17, RGB(18,19,20), FLOODFILLSURFACE);
4128 ok(ret, "FloodFill failed\n");
4129
4130 mf = CloseMetaFile(hdc);
4131 ok(mf != 0, "CloseMetaFile error %ld\n", GetLastError());
4132
4133 if (compare_mf_bits (mf, floodfill_bits, sizeof(floodfill_bits),
4134 "mf_FloodFill") != 0)
4135 {
4136 dump_mf_bits(mf, "mf_FloodFill");
4137 EnumMetaFile(0, mf, mf_enum_proc, 0);
4138 }
4139
4140 ret = DeleteMetaFile(mf);
4141 ok(ret, "DeleteMetaFile(%p) error %ld\n", mf, GetLastError());
4142}
#define FLOODFILLBORDER
Definition: wingdi.h:644
BOOL WINAPI FloodFill(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
#define FLOODFILLSURFACE
Definition: wingdi.h:645
BOOL WINAPI ExtFloodFill(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF, _In_ UINT)

Referenced by START_TEST().

◆ test_mf_GetPath()

static void test_mf_GetPath ( void  )
static

Definition at line 8636 of file metafile.c.

8637{
8638 HDC hdc;
8639 HMETAFILE hmf;
8640 BOOL ret;
8641 int size;
8642
8643 SetLastError(0xdeadbeef);
8645 ok(hdc != 0, "CreateMetaFileA error %ld\n", GetLastError());
8646
8647 ret = BeginPath(hdc);
8648 ok(!ret, "BeginPath on metafile DC should fail\n");
8649 ret = MoveToEx(hdc, 50, 50, NULL);
8650 ok( ret, "MoveToEx error %ld.\n", GetLastError());
8651 ret = LineTo(hdc, 50, 150);
8652 ok( ret, "LineTo error %ld.\n", GetLastError());
8653 ret = LineTo(hdc, 150, 150);
8654 ok( ret, "LineTo error %ld.\n", GetLastError());
8655 ret = LineTo(hdc, 150, 50);
8656 ok( ret, "LineTo error %ld.\n", GetLastError());
8657 ret = LineTo(hdc, 50, 50);
8658 ok( ret, "LineTo error %ld.\n", GetLastError());
8659 Rectangle(hdc, 10, 10, 20, 20);
8660 EndPath(hdc);
8661
8662 size = GetPath(hdc, NULL, NULL, 0);
8663 ok( size == -1, "GetPath returned %d.\n", size);
8664
8665 hmf = CloseMetaFile(hdc);
8666 ok(hmf != 0, "CloseMetaFile error %ld\n", GetLastError());
8667
8668 if (compare_mf_bits (hmf, MF_PATH_BITS, sizeof(MF_PATH_BITS), "mf_GetPath") != 0)
8669 {
8670 dump_mf_bits(hmf, "mf_GetPath");
8671 EnumMetaFile(0, hmf, mf_enum_proc, 0);
8672 }
8673
8674 ret = DeleteMetaFile(hmf);
8675 ok( ret, "DeleteMetaFile error %ld\n", GetLastError());
8676}
static const unsigned char MF_PATH_BITS[]
Definition: metafile.c:8621

Referenced by START_TEST().

◆ test_mf_Graphics()

static void test_mf_Graphics ( void  )
static

Definition at line 4044 of file metafile.c.

4045{
4046 HDC hdcMetafile;
4047 HMETAFILE hMetafile;
4048 POINT oldpoint;
4049 INT type;
4050 BOOL ret;
4051
4052 static const POINT points[] = { {1, 1}, {2, 2} };
4053 static const BYTE types[] = { PT_MOVETO, PT_LINETO };
4054
4055 hdcMetafile = CreateMetaFileA(NULL);
4056 ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
4057
4058 ret = MoveToEx(hdcMetafile, 1, 1, NULL);
4059 ok( ret, "MoveToEx error %ld.\n", GetLastError());
4060 ret = LineTo(hdcMetafile, 2, 2);
4061 ok( ret, "LineTo error %ld.\n", GetLastError());
4062
4063 oldpoint.x = oldpoint.y = 0xdeadbeef;
4064 ret = MoveToEx(hdcMetafile, 1, 1, &oldpoint);
4065 ok( ret, "MoveToEx error %ld.\n", GetLastError());
4066 ok(oldpoint.x == 0xdeadbeef && oldpoint.y == 0xdeadbeef,
4067 "MoveToEx modified oldpoint\n");
4068
4069 ret = Ellipse(hdcMetafile, 0, 0, 2, 2);
4070 ok( ret, "Ellipse error %ld.\n", GetLastError());
4071
4072 ret = ArcTo(hdcMetafile, 1, 2, 30, 40, 11, 12, 23, 24 );
4073 ok( !ret, "ArcTo succeeded\n" );
4074
4075 SetLastError(0xdeadbeef);
4076 ret = PolyDraw(hdcMetafile, points, types, ARRAY_SIZE(points));
4077 ok(!ret, "PolyDraw succeeded\n");
4078 todo_wine
4079 ok(GetLastError() == 0xdeadbeef, "GetLastError() = %lu\n", GetLastError());
4080
4081 hMetafile = CloseMetaFile(hdcMetafile);
4082 ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
4083 type = GetObjectType(hdcMetafile);
4084 ok(type == 0 || broken(type == OBJ_METADC) /* win10 >=1607 */,
4085 "CloseMetaFile has to destroy metafile hdc (%d)\n", type);
4086
4087 if (compare_mf_bits (hMetafile, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS),
4088 "mf_Graphics") != 0)
4089 {
4090 dump_mf_bits(hMetafile, "mf_Graphics");
4091 EnumMetaFile(0, hMetafile, mf_enum_proc, 0);
4092 }
4093
4094 ret = DeleteMetaFile(hMetafile);
4095 ok( ret, "DeleteMetaFile(%p) error %ld\n",
4096 hMetafile, GetLastError());
4097}
GLsizei const GLfloat * points
Definition: glext.h:8112

Referenced by START_TEST().

◆ test_mf_palette()

static void test_mf_palette ( void  )
static

Definition at line 4764 of file metafile.c.

4765{
4766 char logpalettebuf[sizeof(LOGPALETTE) + sizeof(logpalettedata)];
4767 LOGPALETTE *logpalette = (PLOGPALETTE)logpalettebuf;
4768 HPALETTE hpal, old_pal;
4769 HMETAFILE hmf;
4770 HDC hdc;
4771 BOOL ret;
4772
4773 static const unsigned char palette_bits[] =
4774 {
4775 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x5c, 0x00,
4776 0x00, 0x00, 0x02, 0x00, 0x2d, 0x00, 0x00, 0x00,
4777 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0xf7, 0x00,
4778 0x00, 0x03, 0x08, 0x00, 0x10, 0x20, 0x30, 0x04,
4779 0x20, 0x30, 0x40, 0x04, 0x30, 0x40, 0x50, 0x04,
4780 0x40, 0x50, 0x60, 0x04, 0x50, 0x60, 0x70, 0x04,
4781 0x60, 0x70, 0x80, 0x04, 0x70, 0x80, 0x90, 0x04,
4782 0x80, 0x90, 0xa0, 0x04, 0x04, 0x00, 0x00, 0x00,
4783 0x34, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
4784 0x35, 0x00, 0x2d, 0x00, 0x00, 0x00, 0xf7, 0x00,
4785 0x00, 0x03, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
4786 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
4787 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
4788 0x80, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00,
4789 0xc0, 0xc0, 0xc0, 0x00, 0xc0, 0xdc, 0xc0, 0x00,
4790 0xa6, 0xca, 0xf0, 0x00, 0xff, 0xfb, 0xf0, 0x00,
4791 0xa0, 0xa0, 0xa4, 0x00, 0x80, 0x80, 0x80, 0x00,
4792 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
4793 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
4794 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00,
4795 0xff, 0xff, 0xff, 0x00, 0x04, 0x00, 0x00, 0x00,
4796 0x34, 0x02, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00,
4797 0x35, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
4798 };
4799
4801 ok( hdc != 0, "CreateMetaFileA failed\n" );
4802
4803 /* Initialize the logical palette with a few colours */
4804 logpalette->palVersion = 0x300;
4806 memcpy( logpalette->palPalEntry, logpalettedata, sizeof(logpalettedata) );
4807 hpal = CreatePalette( logpalette );
4808 old_pal = SelectPalette( hdc, hpal, FALSE );
4809 ok(old_pal == ULongToHandle(TRUE), "old_pal=%p\n", old_pal);
4810
4812 ok(ret, "RealizePalette failed\n");
4813
4815 ok(old_pal == ULongToHandle(TRUE), "old_pal=%p\n", old_pal);
4816
4818 ok(ret, "RealizePalette failed\n");
4819
4820 hmf = CloseMetaFile(hdc);
4821 ok( hmf != 0, "CloseMetaFile failed\n" );
4822
4823 if (compare_mf_bits(hmf, palette_bits, sizeof(palette_bits), "mf_palette"))
4824 {
4825 dump_mf_bits(hmf, "mf_palette");
4826 EnumMetaFile(0, hmf, mf_enum_proc, 0);
4827 }
4828
4829 ret = DeleteMetaFile(hmf);
4830 ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
4831}

Referenced by START_TEST().

◆ test_mf_palette_brush()

static void test_mf_palette_brush ( void  )
static

Definition at line 4314 of file metafile.c.

4315{
4316 char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD) + 16 * 16];
4318 WORD *indices = (WORD *)info->bmiColors;
4319 char pal_buffer[sizeof(LOGPALETTE) + 256 * sizeof(PALETTEENTRY)];
4320 LOGPALETTE *pal = (LOGPALETTE *)pal_buffer;
4322 HMETAFILE metafile;
4323 HBRUSH brush;
4324 int i;
4325 HPALETTE palette;
4326
4327 memset( info, 0, sizeof(*info) );
4328 info->bmiHeader.biSize = sizeof(info->bmiHeader);
4329 info->bmiHeader.biWidth = 16;
4330 info->bmiHeader.biHeight = 16;
4331 info->bmiHeader.biPlanes = 1;
4332 info->bmiHeader.biBitCount = 8;
4333 info->bmiHeader.biCompression = BI_RGB;
4334
4335 for (i = 0; i < 256; i++) indices[i] = 255 - i;
4336 for (i = 0; i < 256; i++) ((BYTE *)(indices + 256))[i] = i;
4338 ok( brush != NULL, "CreateDIBPatternBrushPt failed\n" );
4339
4340 pal->palVersion = 0x300;
4341 pal->palNumEntries = 256;
4342 for (i = 0; i < 256; i++)
4343 {
4344 pal->palPalEntry[i].peRed = i * 2;
4345 pal->palPalEntry[i].peGreen = i * 2;
4346 pal->palPalEntry[i].peBlue = i * 2;
4347 pal->palPalEntry[i].peFlags = 0;
4348 }
4349 palette = CreatePalette(pal);
4350
4351 ok(SelectPalette(hdc, palette, 0) != NULL, "SelectPalette failed\n");
4352 ok(SelectObject(hdc, brush) != NULL, "SelectObject failed\n");
4353
4354 DeleteObject(brush);
4356
4359 "mf_Palette_Pattern_Brush") != 0)
4360 {
4361 dump_mf_bits(metafile, "mf_Palette_Pattern_Brush");
4363 }
4365}
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: gl.h:1545
static const unsigned char mf_palette_brush_bits[]
Definition: metafile.c:1549
static HPALETTE palette
Definition: clipboard.c:1457
struct tagPALETTEENTRY PALETTEENTRY
#define DIB_PAL_COLORS
Definition: wingdi.h:366

Referenced by START_TEST().

◆ test_mf_PatternBrush()

static void test_mf_PatternBrush ( void  )
static

Definition at line 4144 of file metafile.c.

4145{
4146 char buffer[sizeof(BITMAPINFOHEADER) + (2 + 32 * 32 / 8) * sizeof(RGBQUAD)];
4148 HDC hdcMetafile;
4149 HMETAFILE hMetafile;
4150 LOGBRUSH *orig_lb;
4151 HBRUSH hBrush, dib_brush;
4152 DWORD *bits;
4153 unsigned int i;
4154 BOOL ret;
4155 INT type;
4156
4157 orig_lb = calloc(1, sizeof(LOGBRUSH));
4158
4159 orig_lb->lbStyle = BS_PATTERN;
4160 orig_lb->lbColor = RGB(0, 0, 0);
4161 orig_lb->lbHatch = (ULONG_PTR)CreateBitmap (8, 8, 1, 1, SAMPLE_PATTERN_BRUSH);
4162 ok((HBITMAP)orig_lb->lbHatch != NULL, "CreateBitmap error %ld.\n", GetLastError());
4163
4164 hBrush = CreateBrushIndirect (orig_lb);
4165 ok(hBrush != 0, "CreateBrushIndirect error %ld\n", GetLastError());
4166
4167 hdcMetafile = CreateMetaFileA(NULL);
4168 ok(hdcMetafile != 0, "CreateMetaFileA error %ld\n", GetLastError());
4169
4170 hBrush = SelectObject(hdcMetafile, hBrush);
4171 ok(hBrush != 0, "SelectObject error %ld.\n", GetLastError());
4172
4173 memset(info, 0, sizeof(buffer));
4174 info->bmiHeader.biSize = sizeof(info->bmiHeader);
4175 info->bmiHeader.biHeight = 32;
4176 info->bmiHeader.biWidth = 32;
4177 info->bmiHeader.biBitCount = 1;
4178 info->bmiHeader.biPlanes = 1;
4179 info->bmiHeader.biCompression = BI_RGB;
4180 bits = (DWORD *)info->bmiColors;
4181 for (i = 0; i < 32 * 32 / 8; i++) bits[i] = i;
4182
4184 ok(dib_brush != NULL, "CreatePatternBrush failed\n");
4185
4186 dib_brush = SelectObject(hdcMetafile, dib_brush);
4187 ok(dib_brush != 0, "SelectObject error %ld.\n", GetLastError());
4188
4189 hMetafile = CloseMetaFile(hdcMetafile);
4190 ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
4191 type = GetObjectType(hdcMetafile);
4192 ok(type == 0 || broken(type == OBJ_METADC) /* win10 >=1607 */,
4193 "CloseMetaFile has to destroy metafile hdc (%d)\n", type);
4194
4196 "mf_Pattern_Brush") != 0)
4197 {
4198 dump_mf_bits(hMetafile, "mf_Pattern_Brush");
4199 EnumMetaFile(0, hMetafile, mf_enum_proc, 0);
4200 }
4201
4202 ret = DeleteMetaFile(hMetafile);
4203 ok( ret, "DeleteMetaFile error %ld\n", GetLastError());
4204 ret = DeleteObject(hBrush);
4205 ok( ret, "DeleteObject(HBRUSH) error %ld\n", GetLastError());
4206 ret = DeleteObject(dib_brush);
4207 ok(ret, "DeleteObject failed\n");
4208 ret = DeleteObject((HBITMAP)orig_lb->lbHatch);
4209 ok( ret, "DeleteObject(HBITMAP) error %ld\n",
4210 GetLastError());
4211 free(orig_lb);
4212}
static const unsigned char MF_PATTERN_BRUSH_BITS[]
Definition: metafile.c:1039

Referenced by START_TEST().

◆ test_mf_SaveDC()

static void test_mf_SaveDC ( void  )
static

Definition at line 855 of file metafile.c.

856{
857 HDC hdcMetafile;
858 HMETAFILE hMetafile;
859 int ret;
860 POINT pt;
861 SIZE size;
862 HFONT hFont,hFont2,hFontOld,hFontCheck;
863
864 hdcMetafile = CreateMetaFileA(NULL);
865 ok(hdcMetafile != 0, "CreateMetaFileA error %ld\n", GetLastError());
866
867 ret = SetMapMode(hdcMetafile, MM_ANISOTROPIC);
868 ok (ret, "SetMapMode should not fail\n");
869
870 /* Need to write something to the emf, otherwise Windows won't play it back */
871 LineTo(hdcMetafile, 150, 150);
872
873 pt.x = pt.y = 5555;
874 SetWindowOrgEx(hdcMetafile, 0, 0, &pt);
875 ok( pt.x == 5555 && pt.y == 5555, "wrong origin %ld,%ld\n", pt.x, pt.y);
876 pt.x = pt.y = 5555;
877 SetViewportOrgEx(hdcMetafile, 0, 0, &pt);
878 ok( pt.x == 5555 && pt.y == 5555, "wrong origin %ld,%ld\n", pt.x, pt.y);
879 size.cx = size.cy = 5555;
880 SetWindowExtEx(hdcMetafile, 110, 110, &size );
881 ok( size.cx == 5555 && size.cy == 5555, "wrong size %ld,%ld\n", size.cx, size.cy );
882 size.cx = size.cy = 5555;
883 SetViewportExtEx(hdcMetafile, 120, 120, &size );
884 ok( size.cx == 5555 && size.cy == 5555, "wrong size %ld,%ld\n", size.cx, size.cy );
885
886 /* Force Win9x to update DC state */
887 SetPixelV(hdcMetafile, 50, 50, 0);
888
889 ret = GetViewportOrgEx(hdcMetafile, &pt);
890 ok(!ret, "GetViewportOrgEx should fail\n");
891 ret = GetViewportExtEx(hdcMetafile, &size);
892 ok(!ret, "GetViewportExtEx should fail\n");
893 ret = SaveDC(hdcMetafile);
894 ok(ret == 1, "ret = %d\n", ret);
895
896 SetWindowOrgEx(hdcMetafile, -1, -1, NULL);
897 SetViewportOrgEx(hdcMetafile, 10, 10, NULL);
898 SetWindowExtEx(hdcMetafile, 150, 150, NULL );
899 SetViewportExtEx(hdcMetafile, 200, 200, NULL );
900
901 /* Force Win9x to update DC state */
902 SetPixelV(hdcMetafile, 50, 50, 0);
903
904 ret = SaveDC(hdcMetafile);
905 ok(ret == 1, "ret = %d\n", ret);
906
907 SetWindowOrgEx(hdcMetafile, -2, -2, NULL);
908 SetViewportOrgEx(hdcMetafile, 20, 20, NULL);
909 SetWindowExtEx(hdcMetafile, 120, 120, NULL );
910 SetViewportExtEx(hdcMetafile, 300, 300, NULL );
911
912 /* Force Win9x to update DC state */
913 SetPixelV(hdcMetafile, 50, 50, 0);
914 SetPolyFillMode( hdcMetafile, ALTERNATE );
915 SetBkColor( hdcMetafile, 0 );
916
917 ret = SaveDC(hdcMetafile);
918 ok(ret == 1, "ret = %d\n", ret);
919
920 SetWindowOrgEx(hdcMetafile, -3, -3, NULL);
921 SetViewportOrgEx(hdcMetafile, 30, 30, NULL);
922 SetWindowExtEx(hdcMetafile, 200, 200, NULL );
923 SetViewportExtEx(hdcMetafile, 400, 400, NULL );
924
925 SetPolyFillMode( hdcMetafile, WINDING );
926 SetBkColor( hdcMetafile, 0x123456 );
927 ok( !GetPolyFillMode( hdcMetafile ), "GetPolyFillMode succeeded\n" );
928 ok( GetBkColor( hdcMetafile ) == CLR_INVALID, "GetBkColor succeeded\n" );
929
930 /* Force Win9x to update DC state */
931 SetPixelV(hdcMetafile, 50, 50, 0);
932
933 ret = RestoreDC(hdcMetafile, -1);
934 ok(ret, "ret = %d\n", ret);
935
936 ret = SaveDC(hdcMetafile);
937 ok(ret == 1, "ret = %d\n", ret);
938
939 ret = RestoreDC(hdcMetafile, 1);
940 ok(ret, "ret = %d\n", ret);
941
942 SetWindowOrgEx(hdcMetafile, -4, -4, NULL);
943 SetViewportOrgEx(hdcMetafile, 40, 40, NULL);
944 SetWindowExtEx(hdcMetafile, 500, 500, NULL );
945 SetViewportExtEx(hdcMetafile, 50, 50, NULL );
946
947 /* Force Win9x to update DC state */
948 SetPixelV(hdcMetafile, 50, 50, 0);
949
950 ret = SaveDC(hdcMetafile);
951 ok(ret == 1, "ret = %d\n", ret);
952
953 ret = SaveDC(hdcMetafile);
954 ok(ret == 1, "ret = %d\n", ret);
955
956 memset(&orig_lf, 0, sizeof(orig_lf));
960 orig_lf.lfHeight = 7;
962 lstrcpyA(orig_lf.lfFaceName, "Arial");
964 ok(hFont != 0, "CreateFontIndirectA error %ld\n", GetLastError());
965
966 hFontOld = SelectObject(hdcMetafile, hFont);
967
968 hFont2 = CreateFontIndirectA(&orig_lf);
969 ok(hFont2 != 0, "CreateFontIndirectA error %ld\n", GetLastError());
970 hFontCheck = SelectObject(hdcMetafile, hFont2);
971 ok(hFontCheck == hFont, "Font not selected\n");
972
973 /* Force Win9x to update DC state */
974 SetPixelV(hdcMetafile, 50, 50, 0);
975
976 ret = RestoreDC(hdcMetafile, 1);
977 ok(ret, "ret = %d\n", ret);
978
979 hFontCheck = SelectObject(hdcMetafile, hFontOld);
980 ok(hFontOld != hFontCheck && hFontCheck == hFont2, "Font incorrectly reverted with DC Restore\n");
981
982 /* restore level is ignored */
983 ret = RestoreDC(hdcMetafile, -20);
984 ok(ret, "ret = %d\n", ret);
985 ret = RestoreDC(hdcMetafile, 20);
986 ok(ret, "ret = %d\n", ret);
987 ret = RestoreDC(hdcMetafile, 0);
988 ok(ret, "ret = %d\n", ret);
989
990 hMetafile = CloseMetaFile(hdcMetafile);
991 ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
992
993 ret = DeleteMetaFile(hMetafile);
994 ok( ret, "DeleteMetaFile error %ld\n", GetLastError());
996 ok( ret, "DeleteObject error %ld\n", GetLastError());
997 ret = DeleteObject(hFont2);
998 ok( ret, "DeleteObject error %ld\n", GetLastError());
999}

Referenced by START_TEST().

◆ test_mf_select()

static void test_mf_select ( void  )
static

Definition at line 4414 of file metafile.c.

4415{
4416 HMETAFILE hmf;
4417 HDC hdc, hdc2;
4418 HGDIOBJ obj;
4419 HPEN pen;
4420 int cnt;
4421 BOOL ret;
4422
4423 static const unsigned char select_bits[] =
4424 {
4425 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x4d, 0x00,
4426 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00,
4427 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x02,
4428 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
4429 0x04, 0x00, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00,
4430 0x07, 0x00, 0x00, 0x00, 0xfc, 0x02, 0x00, 0x00,
4431 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x00,
4432 0x00, 0x00, 0x2d, 0x01, 0x01, 0x00, 0x08, 0x00,
4433 0x00, 0x00, 0xfa, 0x02, 0x00, 0x00, 0x01, 0x00,
4434 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x04, 0x00,
4435 0x00, 0x00, 0x2d, 0x01, 0x02, 0x00, 0x03, 0x00,
4436 0x00, 0x00, 0x1e, 0x00, 0x08, 0x00, 0x00, 0x00,
4437 0xfa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4438 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
4439 0x2d, 0x01, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00,
4440 0x27, 0x01, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
4441 0x2d, 0x01, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00,
4442 0xf0, 0x01, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00,
4443 0x27, 0x01, 0xfb, 0xff, 0x03, 0x00, 0x00, 0x00,
4444 0x00, 0x00
4445 };
4446
4447 static const unsigned char delete_not_selected_bits[] =
4448 {
4449 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x28, 0x00,
4450 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00,
4451 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xfa, 0x02,
4452 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
4453 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2d, 0x01,
4454 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xfa, 0x02,
4455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4456 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2d, 0x01,
4457 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf0, 0x01,
4458 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
4459 };
4460
4461 static const unsigned char delete_selected_bits[] =
4462 {
4463 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x18, 0x00,
4464 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00,
4465 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xfa, 0x02,
4466 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
4467 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2d, 0x01,
4468 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
4469 };
4470
4472 ok(hdc != 0, "CreateMetaFileA failed\n");
4473
4474 obj = SelectObject(hdc, GetStockObject(DC_BRUSH));
4475 ok(obj == GetStockObject(WHITE_BRUSH), "brush is not a stock WHITE_BRUSH: %p\n", obj);
4476
4478 ok(obj == GetStockObject(DC_BRUSH), "brush is not a stock DC_BRUSH: %p\n", obj);
4479
4480 pen = CreatePen(PS_SOLID, 1, RGB(1,1,1));
4481 obj = SelectObject(hdc, pen);
4482 ok(obj == GetStockObject(BLACK_PEN), "pen is not a stock BLACK_PEN: %p\n", obj);
4483
4484 cnt = SaveDC(hdc);
4485 ok(cnt == 1, "cnt = %d\n", cnt);
4486
4488 ok(obj == pen, "unexpected pen: %p\n", obj);
4489
4490 ret = RestoreDC(hdc, -1);
4491 ok(ret, "RestoreDC failed\n");
4492
4494 /* pen is still black after RestoreDC */
4495 ok(obj == GetStockObject(BLACK_PEN), "unexpected pen: %p\n", obj);
4496 ret = DeleteObject(pen);
4497 ok(ret, "DeleteObject failed: %lu\n", GetLastError());
4498
4500 ok(!obj, "GetCurrentObject succeeded\n");
4501
4502 SetLastError(0xdeadbeef);
4505 "SelectObject returned %p (%lu).\n", obj, GetLastError());
4506
4507 ret = RestoreDC(hdc, -5);
4508 ok(ret, "RestoreDC failed\n");
4509
4510 hmf = CloseMetaFile(hdc);
4511 ok(hmf != 0, "CloseMetaFile failed\n");
4512
4513 if (compare_mf_bits(hmf, select_bits, sizeof(select_bits), "mf_select"))
4514 {
4515 dump_mf_bits(hmf, "mf_select");
4516 EnumMetaFile(0, hmf, mf_enum_proc, 0);
4517 }
4518
4519 ret = DeleteMetaFile(hmf);
4520 ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
4521
4522 /* create two metafiles, select the same pen to both of them,
4523 * unselect it from only one and then delete */
4525 ok(hdc != 0, "CreateMetaFileA failed\n");
4527 ok(hdc2 != 0, "CreateMetaFileA failed\n");
4528
4529 pen = CreatePen(PS_SOLID, 1, RGB(1,1,1));
4530 obj = SelectObject(hdc, pen);
4531 ok(obj == GetStockObject(BLACK_PEN), "pen is not a stock BLACK_PEN: %p\n", obj);
4532 obj = SelectObject(hdc2, pen);
4533 ok(obj == GetStockObject(BLACK_PEN), "pen is not a stock BLACK_PEN: %p\n", obj);
4534
4536 ok(obj == pen, "unexpected pen: %p\n", obj);
4537 ret = DeleteObject(pen);
4538 ok(ret, "DeleteObject failed: %lu\n", GetLastError());
4539
4540 hmf = CloseMetaFile(hdc);
4541 ok(hmf != 0, "CloseMetaFile failed\n");
4542 if (compare_mf_bits(hmf, delete_not_selected_bits,
4543 sizeof(delete_not_selected_bits), "mf_delete_not_selected"))
4544 {
4545 dump_mf_bits(hmf, "mf_delete_not_selected");
4546 EnumMetaFile(0, hmf, mf_enum_proc, 0);
4547 }
4548 ret = DeleteMetaFile(hmf);
4549 ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
4550
4551 hmf = CloseMetaFile(hdc2);
4552 ok(hmf != 0, "CloseMetaFile failed\n");
4553 if (compare_mf_bits(hmf, delete_selected_bits,
4554 sizeof(delete_selected_bits), "mf_delete_selected"))
4555 {
4556 dump_mf_bits(hmf, "mf_delete_selected");
4557 EnumMetaFile(0, hmf, mf_enum_proc, 0);
4558 }
4559 ret = DeleteMetaFile(hmf);
4560 ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
4561}
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6

Referenced by START_TEST().

◆ test_mf_SetLayout()

static void test_mf_SetLayout ( void  )
static

Definition at line 10778 of file metafile.c.

10779{
10780 static const DWORD tests[] =
10781 {
10782 LAYOUT_LTR,
10783 LAYOUT_RTL,
10788 };
10789 DWORD layout;
10790 HMETAFILE mf;
10791 int ret, i;
10792 HDC mf_dc;
10793
10794 mf_dc = CreateMetaFileW(NULL);
10795 ok(!!mf_dc, "CreateMetaFileW failed, error %ld\n", GetLastError());
10796
10797 for (i = 0; i < ARRAY_SIZE(tests); ++i)
10798 {
10799 winetest_push_context("Test %d", i);
10800 layout = SetLayout(mf_dc, tests[i]);
10801 ok(layout == LAYOUT_RTL, "Expected %#lx, got %#lx\n", tests[i], layout);
10802 layout = GetLayout(mf_dc);
10803 ok(layout == GDI_ERROR, "Expected %#x, got %#lx\n", GDI_ERROR, layout);
10805 }
10806
10807 mf = CloseMetaFile(mf_dc);
10808 ok(!!mf, "CloseMetaFile failed, error %ld\n", GetLastError());
10809
10810 ret = compare_mf_bits(mf, MF_SETLAYOUT_BITS, sizeof(MF_SETLAYOUT_BITS), "mf_SetLayout");
10811 ok(!ret, "Bits mismatch\n");
10812 if (ret)
10813 {
10814 dump_mf_bits(mf, "mf_SetLayout");
10815 EnumMetaFile(0, mf, mf_enum_proc, 0);
10816 }
10817
10818 DeleteMetaFile(mf);
10819}
DWORD WINAPI GetLayout(_In_ HDC hdc)
Definition: coord.c:750
DWORD WINAPI SetLayout(_In_ HDC hdc, _In_ DWORD dwLayout)
Definition: coord.c:780
#define LAYOUT_LTR
Definition: dc.c:33
static const unsigned char MF_SETLAYOUT_BITS[]
Definition: metafile.c:10743
#define NOMIRRORBITMAP
Definition: wingdi.h:1377
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define GDI_ERROR
Definition: wingdi.h:1309
#define LAYOUT_BITMAPORIENTATIONPRESERVED
Definition: wingdi.h:1375

Referenced by START_TEST().

◆ test_mf_SetPixel()

static void test_mf_SetPixel ( void  )
static

Definition at line 3689 of file metafile.c.

3690{
3691 HMETAFILE mf;
3692 COLORREF c;
3693 BOOL ret;
3694 HDC hdc;
3695
3697 ok(hdc != 0, "CreateEnhMetaFile failed\n");
3698
3699 c = GetPixel(hdc, 5, 5);
3700 ok(c == CLR_INVALID, "c = %lx\n", c);
3701
3702 c = SetPixel(hdc, 5, 5, RGB(1,2,3));
3703 ok(c == 1, "c = %lx\n", c);
3704
3705 c = SetPixel(hdc, 5, 5, RGB(1,2,3));
3706 ok(c == 1, "c = %lx\n", c);
3707
3708 ret = SetPixelV(hdc, 5, 5, RGB(1,2,3));
3709 ok(ret, "ret = %x\n", ret);
3710
3711 c = GetPixel(hdc, 5, 5);
3712 ok(c == CLR_INVALID, "c = %lx\n", c);
3713
3714 ret = Rectangle(hdc, 1, 1, 10, 10);
3715 ok(ret, "Rectangle failed\n");
3716
3717 c = GetPixel(hdc, 5, 5);
3718 ok(c == CLR_INVALID, "c = %lx\n", c);
3719
3720 mf = CloseMetaFile(hdc);
3721 ok(mf != 0, "CloseEnhMetaFile failed\n");
3722 DeleteMetaFile(mf);
3723}

Referenced by START_TEST().

◆ test_PlayMetaFile()

static void test_PlayMetaFile ( void  )
static

Definition at line 5113 of file metafile.c.

5114{
5115 static WORD line_records[] = { META_LINETO, 0 };
5116 struct check_mf_arg records;
5117 HMETAFILE hmeta;
5118 HDC dc, metadc;
5119 BOOL r;
5120
5122 ok(dc != NULL, "CreateCompatibleDC failed\n");
5123
5125 ok(metadc != NULL, "CreateMetaFile failed\n");
5126 r = LineTo(metadc, 10, 10);
5127 ok(r, "LineTo failed\n");
5128 hmeta = CloseMetaFile(metadc);
5129 ok(hmeta != NULL, "CloseMetaFile failed\n");
5130
5131 records.pos = 0;
5132 records.records = line_records;
5134 ok(r, "EnumMetaFile failed\n");
5135
5137 ok(metadc != NULL, "CreateMetaFile failed\n");
5138 r = PlayMetaFile(metadc, hmeta);
5139 ok(r, "PlayMetaFile failed\n");
5140 r = DeleteMetaFile(hmeta);
5141 ok(r, "DeleteMetaFile failed\n");
5142 hmeta = CloseMetaFile(metadc);
5143 ok(hmeta != NULL, "CloseMetaFile failed\n");
5144
5145 records.pos = 0;
5146 records.records = line_records;
5148 ok(r, "EnumMetaFile failed\n");
5149
5150 r = DeleteMetaFile(hmeta);
5151 ok(r, "DeleteMetaFile failed\n");
5152 r = DeleteDC(dc);
5153 ok(r, "DeleteDC failed\n");
5154}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static int WINAPI check_mf_records(HDC hdc, HANDLETABLE *htable, METARECORD *rec, int n, LPARAM ctx)
Definition: metafile.c:5103
Definition: metadc.c:46
#define META_LINETO
Definition: wingdi.h:229
BOOL WINAPI PlayMetaFile(_In_ HDC, _In_ HMETAFILE)

Referenced by START_TEST().

◆ test_SaveDC()

static void test_SaveDC ( void  )
static

Definition at line 646 of file metafile.c.

647{
648 HDC hdcMetafile, hdcDisplay;
649 HENHMETAFILE hMetafile;
650 HWND hwnd;
651 int ret;
652 POINT pt;
653 SIZE size;
654 HFONT hFont,hFont2,hFontOld,hFontCheck;
655 static const RECT rc = { 0, 0, 150, 150 };
656
657 /* Win9x doesn't play EMFs on invisible windows */
658 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
659 0, 0, 200, 200, 0, 0, 0, NULL);
660 ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
661
662 hdcDisplay = GetDC(hwnd);
663 ok(hdcDisplay != 0, "GetDC error %ld\n", GetLastError());
664
665 hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
666 ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
667
668 SetMapMode(hdcMetafile, MM_ANISOTROPIC);
669
670 /* Need to write something to the emf, otherwise Windows won't play it back */
671 LineTo(hdcMetafile, 150, 150);
672
673 SetWindowOrgEx(hdcMetafile, 0, 0, NULL);
674 SetViewportOrgEx(hdcMetafile, 0, 0, NULL);
675 SetWindowExtEx(hdcMetafile, 110, 110, NULL );
676 SetViewportExtEx(hdcMetafile, 120, 120, NULL );
677
678 /* Force Win9x to update DC state */
679 SetPixelV(hdcMetafile, 50, 50, 0);
680
681 ret = GetViewportOrgEx(hdcMetafile, &pt);
682 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
683 ok(pt.x == 0,"Expecting ViewportOrg x of 0, got %li\n",pt.x);
684 ret = GetViewportExtEx(hdcMetafile, &size);
685 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
686 ok(size.cx == 120,"Expecting ViewportExt cx of 120, got %li\n",size.cx);
687 ret = SaveDC(hdcMetafile);
688 ok(ret == 1, "ret = %d\n", ret);
689
690 SetWindowOrgEx(hdcMetafile, -1, -1, NULL);
691 SetViewportOrgEx(hdcMetafile, 10, 10, NULL);
692 SetWindowExtEx(hdcMetafile, 150, 150, NULL );
693 SetViewportExtEx(hdcMetafile, 200, 200, NULL );
694
695 /* Force Win9x to update DC state */
696 SetPixelV(hdcMetafile, 50, 50, 0);
697
698 ret = GetViewportOrgEx(hdcMetafile, &pt);
699 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
700 ok(pt.x == 10,"Expecting ViewportOrg x of 10, got %li\n",pt.x);
701 ret = GetViewportExtEx(hdcMetafile, &size);
702 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
703 ok(size.cx == 200,"Expecting ViewportExt cx of 200, got %li\n",size.cx);
704 ret = SaveDC(hdcMetafile);
705 ok(ret == 2, "ret = %d\n", ret);
706
707 SetWindowOrgEx(hdcMetafile, -2, -2, NULL);
708 SetViewportOrgEx(hdcMetafile, 20, 20, NULL);
709 SetWindowExtEx(hdcMetafile, 120, 120, NULL );
710 SetViewportExtEx(hdcMetafile, 300, 300, NULL );
711 SetPolyFillMode( hdcMetafile, ALTERNATE );
712 SetBkColor( hdcMetafile, 0 );
713
714 /* Force Win9x to update DC state */
715 SetPixelV(hdcMetafile, 50, 50, 0);
716
717 ret = GetViewportOrgEx(hdcMetafile, &pt);
718 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
719 ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %li\n",pt.x);
720 ret = GetViewportExtEx(hdcMetafile, &size);
721 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
722 ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %li\n",size.cx);
723 ret = SaveDC(hdcMetafile);
724 ok(ret == 3, "ret = %d\n", ret);
725
726 SetWindowOrgEx(hdcMetafile, -3, -3, NULL);
727 SetViewportOrgEx(hdcMetafile, 30, 30, NULL);
728 SetWindowExtEx(hdcMetafile, 200, 200, NULL );
729 SetViewportExtEx(hdcMetafile, 400, 400, NULL );
730
731 SetPolyFillMode( hdcMetafile, WINDING );
732 SetBkColor( hdcMetafile, 0x123456 );
733 ok( GetPolyFillMode( hdcMetafile ) == WINDING, "PolyFillMode not restored\n" );
734 ok( GetBkColor( hdcMetafile ) == 0x123456, "Background color not restored\n" );
735
736 /* Force Win9x to update DC state */
737 SetPixelV(hdcMetafile, 50, 50, 0);
738
739 ret = GetViewportOrgEx(hdcMetafile, &pt);
740 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
741 ok(pt.x == 30,"Expecting ViewportOrg x of 30, got %li\n",pt.x);
742 ret = GetViewportExtEx(hdcMetafile, &size);
743 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
744 ok(size.cx == 400,"Expecting ViewportExt cx of 400, got %li\n",size.cx);
745 ret = RestoreDC(hdcMetafile, -1);
746 ok(ret, "ret = %d\n", ret);
747
748 ret = GetViewportOrgEx(hdcMetafile, &pt);
749 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
750 ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %li\n",pt.x);
751 ret = GetViewportExtEx(hdcMetafile, &size);
752 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
753 ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %li\n",size.cx);
754 ok( GetPolyFillMode( hdcMetafile ) == ALTERNATE, "PolyFillMode not restored\n" );
755 ok( GetBkColor( hdcMetafile ) == 0, "Background color not restored\n" );
756 ret = SaveDC(hdcMetafile);
757 ok(ret == 3, "ret = %d\n", ret);
758
759 ret = GetViewportOrgEx(hdcMetafile, &pt);
760 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
761 ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %li\n",pt.x);
762 ret = GetViewportExtEx(hdcMetafile, &size);
763 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
764 ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %li\n",size.cx);
765 ret = RestoreDC(hdcMetafile, 1);
766 ok(ret, "ret = %d\n", ret);
767 ret = GetViewportOrgEx(hdcMetafile, &pt);
768 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
769 ok(pt.x == 0,"Expecting ViewportOrg x of 0, got %li\n",pt.x);
770 ret = GetViewportExtEx(hdcMetafile, &size);
771 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
772 ok(size.cx == 120,"Expecting ViewportExt cx of 120, got %li\n",size.cx);
773
774 SetWindowOrgEx(hdcMetafile, -4, -4, NULL);
775 SetViewportOrgEx(hdcMetafile, 40, 40, NULL);
776 SetWindowExtEx(hdcMetafile, 500, 500, NULL );
777 SetViewportExtEx(hdcMetafile, 50, 50, NULL );
778
779 /* Force Win9x to update DC state */
780 SetPixelV(hdcMetafile, 50, 50, 0);
781
782 ret = GetViewportOrgEx(hdcMetafile, &pt);
783 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
784 ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %li\n",pt.x);
785 ret = GetViewportExtEx(hdcMetafile, &size);
786 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
787 ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %li\n",size.cx);
788 ret = SaveDC(hdcMetafile);
789 ok(ret == 1, "ret = %d\n", ret);
790
791 ret = GetViewportOrgEx(hdcMetafile, &pt);
792 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
793 ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %li\n",pt.x);
794 ret = GetViewportExtEx(hdcMetafile, &size);
795 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
796 ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %li\n",size.cx);
797 ret = SaveDC(hdcMetafile);
798 ok(ret == 2, "ret = %d\n", ret);
799
800 memset(&orig_lf, 0, sizeof(orig_lf));
804 orig_lf.lfHeight = 7;
806 lstrcpyA(orig_lf.lfFaceName, "Arial");
808 ok(hFont != 0, "CreateFontIndirectA error %ld\n", GetLastError());
809
810 hFontOld = SelectObject(hdcMetafile, hFont);
811
812 hFont2 = CreateFontIndirectA(&orig_lf);
813 ok(hFont2 != 0, "CreateFontIndirectA error %ld\n", GetLastError());
814 hFontCheck = SelectObject(hdcMetafile, hFont2);
815 ok(hFontCheck == hFont, "Font not selected\n");
816
817 /* Force Win9x to update DC state */
818 SetPixelV(hdcMetafile, 50, 50, 0);
819
820 ret = RestoreDC(hdcMetafile, 1);
821 ok(ret, "ret = %d\n", ret);
822 ret = GetViewportOrgEx(hdcMetafile, &pt);
823 ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
824 ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %li\n",pt.x);
825 ret = GetViewportExtEx(hdcMetafile, &size);
826 ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
827 ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %li\n",size.cx);
828
829 hFontCheck = SelectObject(hdcMetafile, hFontOld);
830 ok(hFontOld == hFontCheck && hFontCheck != hFont && hFontCheck != hFont2,
831 "Font not reverted with DC Restore\n");
832
833 ret = RestoreDC(hdcMetafile, -20);
834 ok(!ret, "ret = %d\n", ret);
835 ret = RestoreDC(hdcMetafile, 20);
836 ok(!ret, "ret = %d\n", ret);
837
838 hMetafile = CloseEnhMetaFile(hdcMetafile);
839 ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
840
841 ret = EnumEnhMetaFile(hdcDisplay, hMetafile, savedc_emf_enum_proc, 0, &rc);
842 ok( ret == 1, "EnumEnhMetaFile rets %d\n", ret);
843
845 ok( ret, "DeleteObject error %ld\n", GetLastError());
846 ret = DeleteObject(hFont2);
847 ok( ret, "DeleteObject error %ld\n", GetLastError());
848 ret = DeleteEnhMetaFile(hMetafile);
849 ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
850 ret = ReleaseDC(hwnd, hdcDisplay);
851 ok( ret, "ReleaseDC error %ld\n", GetLastError());
853}
static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param)
Definition: metafile.c:475

Referenced by START_TEST().

◆ test_SetEnhMetaFileBits()

static void test_SetEnhMetaFileBits ( void  )
static

Definition at line 9304 of file metafile.c.

9305{
9306 BYTE data[256];
9307 HENHMETAFILE hemf;
9308 ENHMETAHEADER *emh;
9309
9310 memset(data, 0xAA, sizeof(data));
9311 SetLastError(0xdeadbeef);
9312 hemf = SetEnhMetaFileBits(sizeof(data), data);
9313 ok(!hemf, "SetEnhMetaFileBits should fail\n");
9315 "expected ERROR_INVALID_DATA, got %lu\n", GetLastError());
9316
9317 emh = (ENHMETAHEADER *)data;
9318 memset(emh, 0, sizeof(*emh));
9319
9320 emh->iType = EMR_HEADER;
9321 emh->nSize = sizeof(*emh);
9323 /* emh->nVersion = 0x10000; XP doesn't care about version */
9324 emh->nBytes = sizeof(*emh);
9325 /* emh->nRecords = 1; XP doesn't care about records */
9326 emh->nHandles = 1; /* XP refuses to load a EMF if nHandles == 0 */
9327
9328 SetLastError(0xdeadbeef);
9329 hemf = SetEnhMetaFileBits(emh->nBytes, data);
9330 ok(hemf != 0, "SetEnhMetaFileBits error %lu\n", GetLastError());
9331 DeleteEnhMetaFile(hemf);
9332
9333 /* XP refuses to load unaligned EMF */
9334 emh->nBytes++;
9335 SetLastError(0xdeadbeef);
9336 hemf = SetEnhMetaFileBits(emh->nBytes, data);
9337 ok(!hemf, "SetEnhMetaFileBits should fail\n");
9338 ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %lu\n", GetLastError());
9339 DeleteEnhMetaFile(hemf);
9340
9341 emh->dSignature = 0;
9342 emh->nBytes--;
9343 SetLastError(0xdeadbeef);
9344 hemf = SetEnhMetaFileBits(emh->nBytes, data);
9345 ok(!hemf, "SetEnhMetaFileBits should fail\n");
9346 ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %lu\n", GetLastError());
9347 DeleteEnhMetaFile(hemf);
9348}
#define ERROR_INVALID_DATA
Definition: winerror.h:238

Referenced by START_TEST().

◆ test_SetMetaFileBits()

static void test_SetMetaFileBits ( void  )
static

Definition at line 3954 of file metafile.c.

3955{
3956 HMETAFILE hmf;
3957 INT type;
3958 BOOL ret;
3959 BYTE buf[256];
3960 METAHEADER *mh;
3961
3963 ok(hmf != 0, "SetMetaFileBitsEx error %ld\n", GetLastError());
3964 type = GetObjectType(hmf);
3965 ok(type == OBJ_METAFILE, "SetMetaFileBitsEx created object with type %d\n", type);
3966
3967 if (compare_mf_bits(hmf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS), "mf_Graphics") != 0)
3968 {
3969 dump_mf_bits(hmf, "mf_Graphics");
3970 EnumMetaFile(0, hmf, mf_enum_proc, 0);
3971 }
3972
3973 ret = DeleteMetaFile(hmf);
3974 ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
3975
3976 /* NULL data crashes XP SP1 */
3977 /*hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), NULL);*/
3978
3979 /* Now with zero size */
3980 SetLastError(0xdeadbeef);
3982 ok(!hmf, "SetMetaFileBitsEx should fail\n");
3983 ok(GetLastError() == ERROR_INVALID_DATA, "wrong error %ld\n", GetLastError());
3984
3985 /* Now with odd size */
3986 SetLastError(0xdeadbeef);
3988 ok(!hmf, "SetMetaFileBitsEx should fail\n");
3989 ok(GetLastError() == 0xdeadbeef /* XP SP1 */, "wrong error %ld\n", GetLastError());
3990
3991 /* Now with zeroed out header fields */
3992 assert(sizeof(buf) >= sizeof(MF_GRAPHICS_BITS));
3994 mh = (METAHEADER *)buf;
3995 /* corruption of any of the below fields leads to a failure */
3996 mh->mtType = 0;
3997 mh->mtVersion = 0;
3998 mh->mtHeaderSize = 0;
3999 SetLastError(0xdeadbeef);
4000 hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), buf);
4001 ok(!hmf, "SetMetaFileBitsEx should fail\n");
4002 ok(GetLastError() == ERROR_INVALID_DATA, "wrong error %ld\n", GetLastError());
4003
4004 /* Now with corrupted mtSize field */
4006 mh = (METAHEADER *)buf;
4007 /* corruption of mtSize doesn't lead to a failure */
4008 mh->mtSize *= 2;
4009 hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), buf);
4010 ok(hmf != 0, "SetMetaFileBitsEx error %ld\n", GetLastError());
4011
4012 if (compare_mf_bits(hmf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS), "mf_Graphics") != 0)
4013 {
4014 dump_mf_bits(hmf, "mf_Graphics");
4015 EnumMetaFile(0, hmf, mf_enum_proc, 0);
4016 }
4017
4018 ret = DeleteMetaFile(hmf);
4019 ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
4020
4021#ifndef _WIN64 /* Generates access violation on XP x64 and Win2003 x64 */
4022 /* Now with zeroed out mtSize field */
4024 mh = (METAHEADER *)buf;
4025 /* zeroing mtSize doesn't lead to a failure */
4026 mh->mtSize = 0;
4027 hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), buf);
4028 ok(hmf != 0, "SetMetaFileBitsEx error %ld\n", GetLastError());
4029
4030 if (compare_mf_bits(hmf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS), "mf_Graphics") != 0)
4031 {
4032 dump_mf_bits(hmf, "mf_Graphics");
4033 EnumMetaFile(0, hmf, mf_enum_proc, 0);
4034 }
4035
4036 ret = DeleteMetaFile(hmf);
4037 ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
4038#endif
4039}
WORD mtHeaderSize
Definition: wingdi.h:2757
DWORD mtSize
Definition: wingdi.h:2759
WORD mtVersion
Definition: wingdi.h:2758
WORD mtType
Definition: wingdi.h:2756
HMETAFILE WINAPI SetMetaFileBitsEx(_In_ UINT cbBuffer, _In_reads_bytes_(cbBuffer) CONST BYTE *lpData)

Referenced by START_TEST().

◆ test_SetWinMetaFileBits()

static void test_SetWinMetaFileBits ( void  )
static

Definition at line 8893 of file metafile.c.

8894{
8895 HMETAFILE wmf;
8896 HDC wmfDC;
8897 BYTE * buffer;
8899 RECT rect;
8900 UINT res;
8901 RECTL rclBoundsAnisotropic, rclFrameAnisotropic;
8902 RECTL rclBoundsIsotropic, rclFrameIsotropic;
8903 RECTL rclBounds, rclFrame;
8904 HDC dc;
8905 LONG diffx, diffy;
8906
8907 wmfDC = CreateMetaFileA(NULL);
8908 ok(wmfDC != NULL, "CreateMetaFile failed\n");
8909 if (!wmfDC) return;
8910
8911 SetWindowExtEx(wmfDC, 100, 100, NULL);
8912 SetRect(&rect, 0, 0, 50, 50);
8914 wmf = CloseMetaFile(wmfDC);
8915 ok(wmf != NULL, "Metafile creation failed\n");
8916 if (!wmf) return;
8917
8919 ok(buffer_size != 0, "GetMetaFileBitsEx failed\n");
8920 if (buffer_size == 0)
8921 {
8922 DeleteMetaFile(wmf);
8923 return;
8924 }
8925
8927 ok(buffer != NULL, "malloc failed\n");
8928 if (!buffer)
8929 {
8930 DeleteMetaFile(wmf);
8931 return;
8932 }
8933
8935 ok(res == buffer_size, "GetMetaFileBitsEx failed\n");
8936 DeleteMetaFile(wmf);
8937 if (res != buffer_size)
8938 {
8939 free(buffer);
8940 return;
8941 }
8942
8943 /* Get the reference bounds and frame */
8944 getConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ANISOTROPIC, 0, 0, &rclBoundsAnisotropic, &rclFrameAnisotropic);
8945 getConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ISOTROPIC, 0, 0, &rclBoundsIsotropic, &rclFrameIsotropic);
8946
8947 ok(rclBoundsAnisotropic.left == 0 && rclBoundsAnisotropic.top == 0 &&
8948 rclBoundsIsotropic.left == 0 && rclBoundsIsotropic.top == 0,
8949 "SetWinMetaFileBits: Reference bounds: Left and top bound must be zero\n");
8950
8951 ok(rclBoundsAnisotropic.right >= rclBoundsIsotropic.right, "SetWinMetaFileBits: Reference bounds: Invalid right bound\n");
8952 ok(rclBoundsAnisotropic.bottom >= rclBoundsIsotropic.bottom, "SetWinMetaFileBits: Reference bounds: Invalid bottom bound\n");
8953 diffx = rclBoundsIsotropic.right - rclBoundsIsotropic.bottom;
8954 if (diffx < 0) diffx = -diffx;
8955 ok(diffx <= 1, "SetWinMetaFileBits (MM_ISOTROPIC): Reference bounds are not isotropic\n");
8956
8958
8959 /* Allow 1 mm difference (rounding errors) */
8960 diffx = rclBoundsAnisotropic.right - GetDeviceCaps(dc, HORZRES) / 2;
8961 diffy = rclBoundsAnisotropic.bottom - GetDeviceCaps(dc, VERTRES) / 2;
8962 if (diffx < 0) diffx = -diffx;
8963 if (diffy < 0) diffy = -diffy;
8964 todo_wine
8965 {
8966 ok(diffx <= 1 && diffy <= 1,
8967 "SetWinMetaFileBits (MM_ANISOTROPIC): Reference bounds: The whole device surface must be used (%dx%d), but got (%ldx%ld)\n",
8968 GetDeviceCaps(dc, HORZRES) / 2, GetDeviceCaps(dc, VERTRES) / 2, rclBoundsAnisotropic.right, rclBoundsAnisotropic.bottom);
8969 }
8970
8971 /* Allow 1 mm difference (rounding errors) */
8972 diffx = rclFrameAnisotropic.right / 100 - GetDeviceCaps(dc, HORZSIZE) / 2;
8973 diffy = rclFrameAnisotropic.bottom / 100 - GetDeviceCaps(dc, VERTSIZE) / 2;
8974 if (diffx < 0) diffx = -diffx;
8975 if (diffy < 0) diffy = -diffy;
8976 todo_wine
8977 {
8978 ok(diffx <= 1 && diffy <= 1,
8979 "SetWinMetaFileBits (MM_ANISOTROPIC): Reference frame: The whole device surface must be used (%dx%d), but got (%ldx%ld)\n",
8980 GetDeviceCaps(dc, HORZSIZE) / 2, GetDeviceCaps(dc, VERTSIZE) / 2, rclFrameAnisotropic.right / 100, rclFrameAnisotropic.bottom / 100);
8981 }
8982 DeleteDC(dc);
8983
8984 /* If the METAFILEPICT pointer is NULL, the MM_ANISOTROPIC mapping mode and the whole device surface are used */
8985 checkConvertedFrameAndBounds(buffer_size, buffer, TRUE, 0, 0, 0, &rclBoundsAnisotropic, &rclFrameAnisotropic);
8986
8987 /* If xExt or yExt is zero or negative, the whole device surface is used */
8988 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ANISOTROPIC, 10000, 0, &rclBoundsAnisotropic, &rclFrameAnisotropic);
8989 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ISOTROPIC, 10000, 0, &rclBoundsIsotropic, &rclFrameIsotropic);
8990 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ANISOTROPIC, 0, 10000, &rclBoundsAnisotropic, &rclFrameAnisotropic);
8991 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ISOTROPIC, 0, 10000, &rclBoundsIsotropic, &rclFrameIsotropic);
8992 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ANISOTROPIC, -10000, 0, &rclBoundsAnisotropic, &rclFrameAnisotropic);
8993 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ISOTROPIC, -10000, 0, &rclBoundsIsotropic, &rclFrameIsotropic);
8994 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ANISOTROPIC, 0, -10000, &rclBoundsAnisotropic, &rclFrameAnisotropic);
8995 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ISOTROPIC, 0, -10000, &rclBoundsIsotropic, &rclFrameIsotropic);
8996 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ANISOTROPIC, -10000, 10000, &rclBoundsAnisotropic, &rclFrameAnisotropic);
8997 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ISOTROPIC, -10000, 10000, &rclBoundsIsotropic, &rclFrameIsotropic);
8998 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ANISOTROPIC, 10000, -10000, &rclBoundsAnisotropic, &rclFrameAnisotropic);
8999 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ISOTROPIC, 10000, -10000, &rclBoundsIsotropic, &rclFrameIsotropic);
9000
9001 /* MSDN says that negative xExt and yExt values specify a ratio.
9002 Check that this is wrong and the whole device surface is used */
9003 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ANISOTROPIC, -1000, -100, &rclBoundsAnisotropic, &rclFrameAnisotropic);
9004 checkConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ISOTROPIC, -1000, -100, &rclBoundsIsotropic, &rclFrameIsotropic);
9005
9006 /* Ordinary conversions */
9007
9008 if (getConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ANISOTROPIC, 30000, 20000, &rclBounds, &rclFrame))
9009 {
9010 ok(rclFrame.left == 0 && rclFrame.top == 0 && rclFrame.right == 30000 && rclFrame.bottom == 20000,
9011 "SetWinMetaFileBits (MM_ANISOTROPIC): rclFrame contains invalid values\n");
9012 ok(rclBounds.left == 0 && rclBounds.top == 0 && rclBounds.right > rclBounds.bottom,
9013 "SetWinMetaFileBits (MM_ANISOTROPIC): rclBounds contains invalid values\n");
9014 }
9015
9016 if (getConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_ISOTROPIC, 30000, 20000, &rclBounds, &rclFrame))
9017 {
9018 ok(rclFrame.left == 0 && rclFrame.top == 0 && rclFrame.right == 30000 && rclFrame.bottom == 20000,
9019 "SetWinMetaFileBits (MM_ISOTROPIC): rclFrame contains invalid values\n");
9020 ok(rclBounds.left == 0 && rclBounds.top == 0,
9021 "SetWinMetaFileBits (MM_ISOTROPIC): rclBounds contains invalid values\n");
9022
9023 /* Wine has a rounding error */
9024 diffx = rclBounds.right - rclBounds.bottom;
9025 if (diffx < 0) diffx = -diffx;
9026 ok(diffx <= 1, "SetWinMetaFileBits (MM_ISOTROPIC): rclBounds is not isotropic\n");
9027 }
9028
9029 if (getConvertedFrameAndBounds(buffer_size, buffer, FALSE, MM_HIMETRIC, 30000, 20000, &rclBounds, &rclFrame))
9030 {
9031 ok(rclFrame.right - rclFrame.left != 30000 && rclFrame.bottom - rclFrame.top != 20000,
9032 "SetWinMetaFileBits: xExt and yExt must be ignored for mapping modes other than MM_ANISOTROPIC and MM_ISOTROPIC\n");
9033 }
9034
9035 free(buffer);
9036}
static void checkConvertedFrameAndBounds(UINT buffer_size, BYTE *buffer, BOOL mfpIsNull, LONG mm, LONG xExt, LONG yExt, RECTL *rclBoundsExpected, RECTL *rclFrameExpected)
Definition: metafile.c:8854
long LONG
Definition: pedump.c:60
#define BLACK_BRUSH
Definition: wingdi.h:896
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)

Referenced by START_TEST().

◆ translate()

static void translate ( POINT pt,
UINT  count,
const XFORM xform 
)
static

Definition at line 8268 of file metafile.c.

8269{
8270 while (count--)
8271 {
8272 FLOAT x = (FLOAT)pt->x;
8273 FLOAT y = (FLOAT)pt->y;
8274 pt->x = (LONG)floor( x * xform->eM11 + y * xform->eM21 + xform->eDx + 0.5 );
8275 pt->y = (LONG)floor( x * xform->eM12 + y * xform->eM22 + xform->eDy + 0.5 );
8276 pt++;
8277 }
8278}
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by clip_emf_enum_proc(), GdipTranslateMatrix(), II_select_table(), OSK_SetKeys(), and set_msi_assembly_prop().

◆ xform_eq()

static BOOL xform_eq ( const XFORM a,
const XFORM b 
)
static

Definition at line 9737 of file metafile.c.

9738{
9739 return fabs(a->eM11 - b->eM11) < 0.001f &&
9740 fabs(a->eM12 - b->eM12) < 0.001f &&
9741 fabs(a->eM21 - b->eM21) < 0.001f &&
9742 fabs(a->eM22 - b->eM22) < 0.001f &&
9743 fabs(a->eDx - b->eDx) < 0.001f &&
9744 fabs(a->eDy - b->eDy) < 0.001f;
9745}
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by enum_emf_WorldTransform().

Variable Documentation

◆ clip_mf_enum_proc_seen_selectclipregion

int clip_mf_enum_proc_seen_selectclipregion
static

Definition at line 8549 of file metafile.c.

Referenced by clip_mf_enum_proc(), and test_mf_clipping().

◆ clip_mf_enum_proc_seen_selectobject

int clip_mf_enum_proc_seen_selectobject
static

Definition at line 8550 of file metafile.c.

Referenced by clip_mf_enum_proc(), and test_mf_clipping().

◆ COLORREF

Definition at line 40 of file metafile.c.

◆ DWORD

Definition at line 38 of file metafile.c.

◆ EMF_ALPHABLEND_16BIT

const unsigned char EMF_ALPHABLEND_16BIT[]
static

Definition at line 10278 of file metafile.c.

Referenced by test_emf_AlphaBlend().

◆ EMF_ALPHABLEND_16BIT_555

const unsigned char EMF_ALPHABLEND_16BIT_555[]
static

Definition at line 10335 of file metafile.c.

Referenced by test_emf_AlphaBlend().

◆ EMF_ALPHABLEND_1BIT

const unsigned char EMF_ALPHABLEND_1BIT[]
static

Definition at line 9982 of file metafile.c.

Referenced by test_emf_AlphaBlend().

◆ EMF_ALPHABLEND_24BIT

const unsigned char EMF_ALPHABLEND_24BIT[]
static

Definition at line 10392 of file metafile.c.

Referenced by test_emf_AlphaBlend().

◆ EMF_ALPHABLEND_32BIT

const unsigned char EMF_ALPHABLEND_32BIT[]
static

Definition at line 10510 of file metafile.c.

Referenced by test_emf_AlphaBlend().

◆ EMF_ALPHABLEND_32BIT_888

const unsigned char EMF_ALPHABLEND_32BIT_888[]
static

Definition at line 10449 of file metafile.c.

Referenced by test_emf_AlphaBlend().

◆ EMF_ALPHABLEND_4BIT

const unsigned char EMF_ALPHABLEND_4BIT[]
static

Definition at line 10036 of file metafile.c.

Referenced by test_emf_AlphaBlend().

◆ EMF_ALPHABLEND_8BIT

const unsigned char EMF_ALPHABLEND_8BIT[]
static

Definition at line 10097 of file metafile.c.

Referenced by test_emf_AlphaBlend().

◆ EMF_BEZIER_BITS

const unsigned char EMF_BEZIER_BITS[]
static

Definition at line 1350 of file metafile.c.

Referenced by test_emf_polybezier(), and test_enhmetafile_file().

◆ EMF_BITBLT_16BIT_4X4

const unsigned char EMF_BITBLT_16BIT_4X4[]
static

Definition at line 3280 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_BITBLT_16BIT_555_4X4

const unsigned char EMF_BITBLT_16BIT_555_4X4[]
static

Definition at line 3146 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_BITBLT_1BIT_4X4

const unsigned char EMF_BITBLT_1BIT_4X4[]
static

Definition at line 2889 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_BITBLT_24BIT_4X4

const unsigned char EMF_BITBLT_24BIT_4X4[]
static

Definition at line 3189 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_BITBLT_32BIT_4X4

const unsigned char EMF_BITBLT_32BIT_4X4[]
static

Definition at line 3323 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_BITBLT_32BIT_888_4X4

const unsigned char EMF_BITBLT_32BIT_888_4X4[]
static

Definition at line 3233 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_BITBLT_4BIT_4X4

const unsigned char EMF_BITBLT_4BIT_4X4[]
static

Definition at line 2930 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_BITBLT_8BIT_4X4

const unsigned char EMF_BITBLT_8BIT_4X4[]
static

Definition at line 2978 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ emf_blit_bits

const unsigned char emf_blit_bits[]
static

Definition at line 1790 of file metafile.c.

Referenced by test_emf_blit().

◆ EMF_CLIPPING

const unsigned char EMF_CLIPPING[]
static

Definition at line 8231 of file metafile.c.

Referenced by test_emf_clipping().

◆ EMF_DCBRUSH_BITS

const unsigned char EMF_DCBRUSH_BITS[]
static

Definition at line 1305 of file metafile.c.

Referenced by test_emf_DCBrush().

◆ EMF_EMPTY_BITS

const unsigned char EMF_EMPTY_BITS[]
static
Initial value:
=
{
0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xdd, 0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff,
0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x90, 0x06, 0x00, 0x00, 0xba, 0x03, 0x00, 0x00,
0x4e, 0x02, 0x00, 0x00, 0x4a, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x09, 0x00,
0x10, 0x09, 0x05, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
}

Definition at line 8064 of file metafile.c.

Referenced by test_emf_ExtTextOut_on_path().

◆ EMF_EMPTY_PATH_BITS

const unsigned char EMF_EMPTY_PATH_BITS[]
static
Initial value:
=
{
0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xd8, 0xff, 0xff, 0xff, 0xd8, 0xff, 0xff, 0xff,
0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
0xc8, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x03, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00,
0x40, 0x01, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x04, 0x00,
0x80, 0xa9, 0x03, 0x00, 0x3b, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
}

Definition at line 9489 of file metafile.c.

Referenced by test_emf_paths().

◆ EMF_GRADIENTFILL_BITS

const unsigned char EMF_GRADIENTFILL_BITS[]
static

Definition at line 1448 of file metafile.c.

Referenced by test_emf_GradientFill().

◆ EMF_LINETO_BITS

const unsigned char EMF_LINETO_BITS[]
static

Definition at line 1189 of file metafile.c.

Referenced by test_mf_conversions().

◆ EMF_LINETO_MM_ANISOTROPIC_BITS

const unsigned char EMF_LINETO_MM_ANISOTROPIC_BITS[]
static

Definition at line 1231 of file metafile.c.

Referenced by test_mf_conversions().

◆ EMF_LINETO_MM_TEXT_BITS

const unsigned char EMF_LINETO_MM_TEXT_BITS[]
static

Definition at line 1273 of file metafile.c.

Referenced by test_mf_conversions().

◆ emf_mask_blit_bits

const unsigned char emf_mask_blit_bits[]
static

Definition at line 1926 of file metafile.c.

Referenced by test_emf_mask_blit().

◆ EMF_PATH_BITS

const unsigned char EMF_PATH_BITS[]
static

Definition at line 9389 of file metafile.c.

Referenced by test_emf_paths().

◆ emf_pattern_brush_bits

const unsigned char emf_pattern_brush_bits[]
static

Definition at line 1486 of file metafile.c.

Referenced by test_emf_pattern_brush().

◆ EMF_POLYPOLYLINE_BITS

const unsigned char EMF_POLYPOLYLINE_BITS[]
static

Definition at line 1395 of file metafile.c.

Referenced by test_emf_PolyPolyline().

◆ EMF_SETDIBITSTODEVICE_16BIT_3X3_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_16BIT_3X3_NOSIZE[]
static

Definition at line 7102 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_16BIT_3X3_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_16BIT_3X3_SIZED[]
static

Definition at line 7141 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_16BIT_4X4_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_16BIT_4X4_NOSIZE[]
static

Definition at line 7732 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_16BIT_4X4_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_16BIT_4X4_SIZED[]
static

Definition at line 7772 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_16BIT_555_3X3_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_3X3_NOSIZE[]
static

Definition at line 6866 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_16BIT_555_3X3_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_3X3_SIZED[]
static

Definition at line 6904 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_16BIT_555_4X4_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_4X4_NOSIZE[]
static

Definition at line 7486 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_16BIT_555_4X4_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_16BIT_555_4X4_SIZED[]
static

Definition at line 7525 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_1BIT_3X3_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_1BIT_3X3_NOSIZE[]
static

Definition at line 6644 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_1BIT_3X3_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_1BIT_3X3_SIZED[]
static

Definition at line 6681 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_1BIT_4X4_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_1BIT_4X4_NOSIZE[]
static

Definition at line 7264 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_1BIT_4X4_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_1BIT_4X4_SIZED[]
static

Definition at line 7301 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_24BIT_3X3_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_24BIT_3X3_NOSIZE[]
static

Definition at line 6942 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_24BIT_3X3_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_24BIT_3X3_SIZED[]
static

Definition at line 6981 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_24BIT_4X4_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_24BIT_4X4_NOSIZE[]
static

Definition at line 7564 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_24BIT_4X4_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_24BIT_4X4_SIZED[]
static

Definition at line 7605 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_32BIT_3X3_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_32BIT_3X3_NOSIZE[]
static

Definition at line 7180 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_32BIT_3X3_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_32BIT_3X3_SIZED[]
static

Definition at line 7222 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_32BIT_4X4_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_32BIT_4X4_NOSIZE[]
static

Definition at line 7812 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_32BIT_4X4_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_32BIT_4X4_SIZED[]
static

Definition at line 7856 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_32BIT_888_3X3_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_3X3_NOSIZE[]
static

Definition at line 7020 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_32BIT_888_3X3_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_3X3_SIZED[]
static

Definition at line 7061 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_32BIT_888_4X4_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_4X4_NOSIZE[]
static

Definition at line 7646 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_32BIT_888_4X4_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_32BIT_888_4X4_SIZED[]
static

Definition at line 7689 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_4BIT_3X3_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_4BIT_3X3_NOSIZE[]
static

Definition at line 6718 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_4BIT_3X3_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_4BIT_3X3_SIZED[]
static

Definition at line 6755 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_4BIT_4X4_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_4BIT_4X4_NOSIZE[]
static

Definition at line 7338 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_4BIT_4X4_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_4BIT_4X4_SIZED[]
static

Definition at line 7375 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_8BIT_3X3_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_8BIT_3X3_NOSIZE[]
static

Definition at line 6792 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_8BIT_3X3_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_8BIT_3X3_SIZED[]
static

Definition at line 6829 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_8BIT_4X4_NOSIZE

const unsigned char EMF_SETDIBITSTODEVICE_8BIT_4X4_NOSIZE[]
static

Definition at line 7412 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_SETDIBITSTODEVICE_8BIT_4X4_SIZED

const unsigned char EMF_SETDIBITSTODEVICE_8BIT_4X4_SIZED[]
static

Definition at line 7449 of file metafile.c.

Referenced by test_emf_SetDIBitsToDevice().

◆ EMF_STRETCHBLT_16BIT_3X3

const unsigned char EMF_STRETCHBLT_16BIT_3X3[]
static

Definition at line 2797 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_STRETCHBLT_16BIT_555_3X3

const unsigned char EMF_STRETCHBLT_16BIT_555_3X3[]
static

Definition at line 2660 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_STRETCHBLT_1BIT_3X3

const unsigned char EMF_STRETCHBLT_1BIT_3X3[]
static

Definition at line 2400 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_STRETCHBLT_24BIT_3X3

const unsigned char EMF_STRETCHBLT_24BIT_3X3[]
static

Definition at line 2704 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_STRETCHBLT_32BIT_3X3

const unsigned char EMF_STRETCHBLT_32BIT_3X3[]
static

Definition at line 2841 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_STRETCHBLT_32BIT_888_3X3

const unsigned char EMF_STRETCHBLT_32BIT_888_3X3[]
static

Definition at line 2749 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_STRETCHBLT_4BIT_3X3

const unsigned char EMF_STRETCHBLT_4BIT_3X3[]
static

Definition at line 2442 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_STRETCHBLT_8BIT_3X3

const unsigned char EMF_STRETCHBLT_8BIT_3X3[]
static

Definition at line 2491 of file metafile.c.

Referenced by test_emf_BitBlt().

◆ EMF_STRETCHDIBITS_16BIT_3X3_NOSIZE

const unsigned char EMF_STRETCHDIBITS_16BIT_3X3_NOSIZE[]
static

Definition at line 5696 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_16BIT_3X3_SIZED

const unsigned char EMF_STRETCHDIBITS_16BIT_3X3_SIZED[]
static

Definition at line 5737 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_16BIT_4X4_NOSIZE

const unsigned char EMF_STRETCHDIBITS_16BIT_4X4_NOSIZE[]
static

Definition at line 6342 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_16BIT_4X4_SIZED

const unsigned char EMF_STRETCHDIBITS_16BIT_4X4_SIZED[]
static

Definition at line 6383 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_16BIT_555_3X3_NOSIZE

const unsigned char EMF_STRETCHDIBITS_16BIT_555_3X3_NOSIZE[]
static

Definition at line 5450 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_16BIT_555_3X3_SIZED

const unsigned char EMF_STRETCHDIBITS_16BIT_555_3X3_SIZED[]
static

Definition at line 5489 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_16BIT_555_4X4_NOSIZE

const unsigned char EMF_STRETCHDIBITS_16BIT_555_4X4_NOSIZE[]
static

Definition at line 6096 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_16BIT_555_4X4_SIZED

const unsigned char EMF_STRETCHDIBITS_16BIT_555_4X4_SIZED[]
static

Definition at line 6135 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_1BIT_3X3_NOSIZE

const unsigned char EMF_STRETCHDIBITS_1BIT_3X3_NOSIZE[]
static

Definition at line 5222 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_1BIT_3X3_SIZED

const unsigned char EMF_STRETCHDIBITS_1BIT_3X3_SIZED[]
static

Definition at line 5260 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_1BIT_4X4_NOSIZE

const unsigned char EMF_STRETCHDIBITS_1BIT_4X4_NOSIZE[]
static

Definition at line 5868 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_1BIT_4X4_SIZED

const unsigned char EMF_STRETCHDIBITS_1BIT_4X4_SIZED[]
static

Definition at line 5906 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_24BIT_3X3_NOSIZE

const unsigned char EMF_STRETCHDIBITS_24BIT_3X3_NOSIZE[]
static

Definition at line 5528 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_24BIT_3X3_SIZED

const unsigned char EMF_STRETCHDIBITS_24BIT_3X3_SIZED[]
static

Definition at line 5569 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_24BIT_4X4_NOSIZE

const unsigned char EMF_STRETCHDIBITS_24BIT_4X4_NOSIZE[]
static

Definition at line 6174 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_24BIT_4X4_SIZED

const unsigned char EMF_STRETCHDIBITS_24BIT_4X4_SIZED[]
static

Definition at line 6215 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_32BIT_3X3_NOSIZE

const unsigned char EMF_STRETCHDIBITS_32BIT_3X3_NOSIZE[]
static

Definition at line 5778 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_32BIT_3X3_SIZED

const unsigned char EMF_STRETCHDIBITS_32BIT_3X3_SIZED[]
static

Definition at line 5823 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_32BIT_4X4_NOSIZE

const unsigned char EMF_STRETCHDIBITS_32BIT_4X4_NOSIZE[]
static

Definition at line 6424 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_32BIT_4X4_SIZED

const unsigned char EMF_STRETCHDIBITS_32BIT_4X4_SIZED[]
static

Definition at line 6469 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_32BIT_888_3X3_NOSIZE

const unsigned char EMF_STRETCHDIBITS_32BIT_888_3X3_NOSIZE[]
static

Definition at line 5610 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_32BIT_888_3X3_SIZED

const unsigned char EMF_STRETCHDIBITS_32BIT_888_3X3_SIZED[]
static

Definition at line 5653 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_32BIT_888_4X4_NOSIZE

const unsigned char EMF_STRETCHDIBITS_32BIT_888_4X4_NOSIZE[]
static

Definition at line 6256 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_32BIT_888_4X4_SIZED

const unsigned char EMF_STRETCHDIBITS_32BIT_888_4X4_SIZED[]
static

Definition at line 6299 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_4BIT_3X3_NOSIZE

const unsigned char EMF_STRETCHDIBITS_4BIT_3X3_NOSIZE[]
static

Definition at line 5298 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_4BIT_3X3_SIZED

const unsigned char EMF_STRETCHDIBITS_4BIT_3X3_SIZED[]
static

Definition at line 5336 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_4BIT_4X4_NOSIZE

const unsigned char EMF_STRETCHDIBITS_4BIT_4X4_NOSIZE[]
static

Definition at line 5944 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_4BIT_4X4_SIZED

const unsigned char EMF_STRETCHDIBITS_4BIT_4X4_SIZED[]
static

Definition at line 5982 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_8BIT_3X3_NOSIZE

const unsigned char EMF_STRETCHDIBITS_8BIT_3X3_NOSIZE[]
static

Definition at line 5374 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_8BIT_3X3_SIZED

const unsigned char EMF_STRETCHDIBITS_8BIT_3X3_SIZED[]
static

Definition at line 5412 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_8BIT_4X4_NOSIZE

const unsigned char EMF_STRETCHDIBITS_8BIT_4X4_NOSIZE[]
static

Definition at line 6020 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_STRETCHDIBITS_8BIT_4X4_SIZED

const unsigned char EMF_STRETCHDIBITS_8BIT_4X4_SIZED[]
static

Definition at line 6058 of file metafile.c.

Referenced by test_emf_StretchDIBits().

◆ EMF_TEXTOUT_ON_PATH_BITS

const unsigned char EMF_TEXTOUT_ON_PATH_BITS[]
static

Definition at line 1108 of file metafile.c.

Referenced by test_emf_ExtTextOut_on_path().

◆ EMF_TEXTOUT_OUTLINE_ON_PATH_BITS

const unsigned char EMF_TEXTOUT_OUTLINE_ON_PATH_BITS[]
static

Definition at line 1143 of file metafile.c.

Referenced by test_emf_ExtTextOut_on_path().

◆ emr_processed

BOOL emr_processed = FALSE
static

Definition at line 32 of file metafile.c.

Referenced by eto_emf_enum_proc(), and test_ExtTextOut().

◆ INT

INT

Definition at line 39 of file metafile.c.

Referenced by EmfEnumProc().

◆ logpalettedata

const PALETTEENTRY logpalettedata[8]
static
Initial value:
= {
{ 0x10, 0x20, 0x30, PC_NOCOLLAPSE },
{ 0x20, 0x30, 0x40, PC_NOCOLLAPSE },
{ 0x30, 0x40, 0x50, PC_NOCOLLAPSE },
{ 0x40, 0x50, 0x60, PC_NOCOLLAPSE },
{ 0x50, 0x60, 0x70, PC_NOCOLLAPSE },
{ 0x60, 0x70, 0x80, PC_NOCOLLAPSE },
{ 0x70, 0x80, 0x90, PC_NOCOLLAPSE },
{ 0x80, 0x90, 0xA0, PC_NOCOLLAPSE },
}
#define PC_NOCOLLAPSE
Definition: wingdi.h:881

Definition at line 4753 of file metafile.c.

Referenced by test_emf_palette(), and test_mf_palette().

◆ MF_BLANK_BITS

const unsigned char MF_BLANK_BITS[]
static
Initial value:
= {
0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x0c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
}

Definition at line 1021 of file metafile.c.

Referenced by test_CopyMetaFile(), and test_mf_Blank().

◆ MF_CLIP_BITS

const unsigned char MF_CLIP_BITS[]
static

Definition at line 8503 of file metafile.c.

Referenced by test_mf_clipping().

◆ MF_DCBRUSH_BITS

const unsigned char MF_DCBRUSH_BITS[]
static
Initial value:
=
{
0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x2a, 0x00,
0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x02,
0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0xfa, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x2d, 0x01, 0x01, 0x00,
0x07, 0x00, 0x00, 0x00, 0x1b, 0x04, 0x14, 0x00,
0x14, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00
}

Definition at line 1082 of file metafile.c.

Referenced by test_mf_DCBrush().

◆ MF_GRAPHICS_BITS

const unsigned char MF_GRAPHICS_BITS[]
static
Initial value:
= {
0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x22, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x02,
0x01, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00,
0x13, 0x02, 0x02, 0x00, 0x02, 0x00, 0x05, 0x00,
0x00, 0x00, 0x14, 0x02, 0x01, 0x00, 0x01, 0x00,
0x07, 0x00, 0x00, 0x00, 0x18, 0x04, 0x02, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00
}

Definition at line 1027 of file metafile.c.

Referenced by test_metafile_file(), test_mf_Graphics(), and test_SetMetaFileBits().

◆ MF_LINETO_BITS

const unsigned char MF_LINETO_BITS[]
static
Initial value:
= {
0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x11, 0x00,
0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x13, 0x02,
0x0f, 0x00, 0x37, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00
}

Definition at line 1181 of file metafile.c.

Referenced by create_converted_emf().

◆ mf_palette_brush_bits

const unsigned char mf_palette_brush_bits[]
static

Definition at line 1549 of file metafile.c.

Referenced by test_mf_palette_brush().

◆ MF_PATH_BITS

const unsigned char MF_PATH_BITS[]
static
Initial value:
=
{
0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x2c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x02,
0x32, 0x00, 0x32, 0x00, 0x05, 0x00, 0x00, 0x00,
0x13, 0x02, 0x96, 0x00, 0x32, 0x00, 0x05, 0x00,
0x00, 0x00, 0x13, 0x02, 0x96, 0x00, 0x96, 0x00,
0x05, 0x00, 0x00, 0x00, 0x13, 0x02, 0x32, 0x00,
0x96, 0x00, 0x05, 0x00, 0x00, 0x00, 0x13, 0x02,
0x32, 0x00, 0x32, 0x00, 0x07, 0x00, 0x00, 0x00,
0x1b, 0x04, 0x14, 0x00, 0x14, 0x00, 0x0a, 0x00,
0x0a, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
}

Definition at line 8621 of file metafile.c.

Referenced by test_mf_GetPath().

◆ MF_PATTERN_BRUSH_BITS

const unsigned char MF_PATTERN_BRUSH_BITS[]
static

Definition at line 1039 of file metafile.c.

Referenced by test_mf_PatternBrush().

◆ MF_SETLAYOUT_BITS

const unsigned char MF_SETLAYOUT_BITS[]
static
Initial value:
=
{
0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x2a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x49, 0x01,
0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x49, 0x01, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x49, 0x01, 0x08, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00,
0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x49, 0x01,
0x09, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x49, 0x01, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00
}

Definition at line 10743 of file metafile.c.

Referenced by test_mf_SetLayout().

◆ MF_TEXTOUT_ON_PATH_BITS

const unsigned char MF_TEXTOUT_ON_PATH_BITS[]
static
Initial value:
=
{
0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x19, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x32, 0x0a,
0x16, 0x00, 0x0b, 0x00, 0x04, 0x00, 0x00, 0x00,
0x54, 0x65, 0x73, 0x74, 0x03, 0x00, 0x05, 0x00,
0x08, 0x00, 0x0c, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00
}

Definition at line 1097 of file metafile.c.

Referenced by test_mf_ExtTextOut_on_path().

◆ orig_lf

LOGFONTA orig_lf
static

Definition at line 31 of file metafile.c.

Referenced by eto_emf_enum_proc(), test_ExtTextOut(), test_mf_SaveDC(), and test_SaveDC().

◆ SAMPLE_PATTERN_BRUSH

const unsigned char SAMPLE_PATTERN_BRUSH[]
static
Initial value:
= {
0x01, 0x00, 0x02, 0x00,
0x03, 0x00, 0x04, 0x00,
0x05, 0x00, 0x06, 0x00,
0x07, 0x00, 0x08, 0x00
}

Definition at line 1010 of file metafile.c.

Referenced by test_emf_pattern_brush(), and test_mf_PatternBrush().