ReactOS  0.4.14-dev-49-gfb4591c
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  emf_WorldTransform_test_data
 

Macros

#define M_PI   3.14159265358979323846
 
#define LINE_X   55.0f
 
#define LINE_Y   15.0f
 
#define GDI_GET_PROC(func)
 
#define MF_BUFSIZE   1024
 
#define BMP_DIM   4
 

Functions

static INT (WINAPI *pGetRelAbs)(HDC
 
static COLORREF (WINAPI *pSetDCBrushColor)(HDC
 
static void init_function_pointers (void)
 
static DWORD rgn_rect_count (HRGN hrgn)
 
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_CopyMetaFile (void)
 
static void test_SetMetaFileBits (void)
 
static void test_mf_Graphics (void)
 
static void test_mf_PatternBrush (void)
 
static void test_mf_DCBrush (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)
 
 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_BITBLT []
 
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_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 []
 

Macro Definition Documentation

◆ BMP_DIM

#define BMP_DIM   4

◆ 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); \
GLenum func
Definition: glext.h:6028
#define GetProcAddress(x, y)
Definition: compat.h:410
GLfloat GLfloat p
Definition: glext.h:8902

Definition at line 47 of file metafile.c.

◆ LINE_X

#define LINE_X   55.0f

Definition at line 39 of file metafile.c.

◆ LINE_Y

#define LINE_Y   15.0f

Definition at line 40 of file metafile.c.

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 32 of file metafile.c.

◆ MF_BUFSIZE

#define MF_BUFSIZE   1024

Definition at line 1017 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 438 of file metafile.c.

441 {
442  BOOL ret;
443  XFORM xform;
444  POINT vp_org, win_org;
445  SIZE vp_size, win_size;
446  FLOAT xscale, yscale, edx, edy;
447 
448  SetLastError(0xdeadbeef);
449  ret = GetWorldTransform(hdc, &xform);
450  if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) goto win9x_here;
451  ok(ret, "GetWorldTransform error %u\n", GetLastError());
452 
453  trace("%d: eM11 %f, eM22 %f, eDx %f, eDy %f\n", restore_no, xform.eM11, xform.eM22, xform.eDx, xform.eDy);
454 
455  ok(xform.eM12 == 0.0, "%d: expected eM12 0.0, got %f\n", restore_no, xform.eM12);
456  ok(xform.eM21 == 0.0, "%d: expected eM21 0.0, got %f\n", restore_no, xform.eM21);
457 
458  xscale = (FLOAT)vp_ext_x / (FLOAT)wnd_ext_x;
459  trace("x scale %f\n", xscale);
460  ok(fabs(xscale - xform.eM11) < 0.01, "%d: vp_ext_x %d, wnd_ext_cx %d, eM11 %f\n",
461  restore_no, vp_ext_x, wnd_ext_x, xform.eM11);
462 
463  yscale = (FLOAT)vp_ext_y / (FLOAT)wnd_ext_y;
464  trace("y scale %f\n", yscale);
465  ok(fabs(yscale - xform.eM22) < 0.01, "%d: vp_ext_y %d, wnd_ext_y %d, eM22 %f\n",
466  restore_no, vp_ext_y, wnd_ext_y, xform.eM22);
467 
468  edx = (FLOAT)vp_org_x - xform.eM11 * (FLOAT)wnd_org_x;
469  ok(fabs(edx - xform.eDx) < 0.01, "%d: edx %f != eDx %f\n", restore_no, edx, xform.eDx);
470  edy = (FLOAT)vp_org_y - xform.eM22 * (FLOAT)wnd_org_y;
471  ok(fabs(edy - xform.eDy) < 0.01, "%d: edy %f != eDy %f\n", restore_no, edy, xform.eDy);
472 
473  return;
474 
475 win9x_here:
476 
477  GetWindowOrgEx(hdc, &win_org);
478  GetViewportOrgEx(hdc, &vp_org);
479  GetWindowExtEx(hdc, &win_size);
480  GetViewportExtEx(hdc, &vp_size);
481 
482  ok(wnd_org_x == win_org.x, "%d: wnd_org_x: %d != %d\n", restore_no, wnd_org_x, win_org.x);
483  ok(wnd_org_y == win_org.y, "%d: wnd_org_y: %d != %d\n", restore_no, wnd_org_y, win_org.y);
484 
485  ok(vp_org_x == vp_org.x, "%d: vport_org_x: %d != %d\n", restore_no, vp_org_x, vp_org.x);
486  ok(vp_org_y == vp_org.y, "%d: vport_org_y: %d != %d\n", restore_no, vp_org_y, vp_org.y);
487 
488  ok(wnd_ext_x == win_size.cx, "%d: wnd_ext_x: %d != %d\n", restore_no, wnd_ext_x, win_size.cx);
489  ok(wnd_ext_y == win_size.cy, "%d: wnd_ext_y: %d != %d\n", restore_no, wnd_ext_y, win_size.cy);
490 
491  ok(vp_ext_x == vp_size.cx, "%d: vport_ext_x: %d != %d\n", restore_no, vp_ext_x, vp_size.cx);
492  ok(vp_ext_y == vp_size.cy, "%d: vport_ext_y: %d != %d\n", restore_no, vp_ext_y, vp_size.cy);
493 }
long y
Definition: polytest.cpp:48
#define FLOAT
Definition: i386-dis.c:516
long x
Definition: polytest.cpp:48
BOOL WINAPI GetWindowOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:439
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
FLOAT eDx
Definition: wingdi.h:1720
FLOAT eM21
Definition: wingdi.h:1718
FLOAT eM12
Definition: wingdi.h:1717
LONG cx
Definition: windef.h:319
BOOL WINAPI GetWorldTransform(_In_ HDC, _Out_ LPXFORM)
Definition: coord.c:278
#define trace
Definition: atltest.h:70
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:351
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:411
BOOL WINAPI GetViewportOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:383
#define SetLastError(x)
Definition: compat.h:409
int ret
FLOAT eM11
Definition: wingdi.h:1716
HDC hdc
Definition: main.c:9
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define ok(value,...)
Definition: atltest.h:57
FLOAT eM22
Definition: wingdi.h:1719
FLOAT eDy
Definition: wingdi.h:1721
float FLOAT
Definition: typedefs.h:67
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx
Definition: synth_sse3d.h:85
LONG cy
Definition: windef.h:320

Referenced by savedc_emf_enum_proc().

◆ 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 3176 of file metafile.c.

3179 {
3180  RECTL rclBounds, rclFrame;
3181 
3182  if (getConvertedFrameAndBounds(buffer_size, buffer, mfpIsNull, mm, xExt, yExt, &rclBounds, &rclFrame))
3183  {
3184  const char * msg;
3185  char buf[64];
3186 
3187  if (mfpIsNull)
3188  {
3189  msg = "mfp == NULL";
3190  }
3191  else
3192  {
3193  const char * mm_str;
3194  switch (mm)
3195  {
3196  case MM_ANISOTROPIC: mm_str = "MM_ANISOTROPIC"; break;
3197  case MM_ISOTROPIC: mm_str = "MM_ISOTROPIC"; break;
3198  default: mm_str = "Unexpected";
3199  }
3200  sprintf(buf, "mm=%s, xExt=%d, yExt=%d", mm_str, xExt, yExt);
3201  msg = buf;
3202  }
3203 
3204  ok(rclBounds.left == rclBoundsExpected->left, "rclBounds.left: Expected %d, got %d (%s)\n", rclBoundsExpected->left, rclBounds.left, msg);
3205  ok(rclBounds.top == rclBoundsExpected->top, "rclBounds.top: Expected %d, got %d (%s)\n", rclBoundsExpected->top, rclBounds.top, msg);
3206  ok(rclBounds.right == rclBoundsExpected->right, "rclBounds.right: Expected %d, got %d (%s)\n", rclBoundsExpected->right, rclBounds.right, msg);
3207  ok(rclBounds.bottom == rclBoundsExpected->bottom, "rclBounds.bottom: Expected %d, got %d (%s)\n", rclBoundsExpected->bottom, rclBounds.bottom, msg);
3208  ok(rclFrame.left == rclFrameExpected->left, "rclFrame.left: Expected %d, got %d (%s)\n", rclFrameExpected->left, rclFrame.left, msg);
3209  ok(rclFrame.top == rclFrameExpected->top, "rclFrame.top: Expected %d, got %d (%s)\n", rclFrameExpected->top, rclFrame.top, msg);
3210  ok(rclFrame.right == rclFrameExpected->right, "rclFrame.right: Expected %d, got %d (%s)\n", rclFrameExpected->right, rclFrame.right, msg);
3211  ok(rclFrame.bottom == rclFrameExpected->bottom, "rclFrame.bottom: Expected %d, got %d (%s)\n", rclFrameExpected->bottom, rclFrame.bottom, msg);
3212  }
3213 }
#define MM_ISOTROPIC
Definition: wingdi.h:869
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
long bottom
Definition: polytest.cpp:53
static BOOL getConvertedFrameAndBounds(UINT buffer_size, BYTE *buffer, BOOL mfpIsNull, LONG mm, LONG xExt, LONG yExt, RECTL *rclBounds, RECTL *rclFrame)
Definition: metafile.c:3145
GLuint buffer
Definition: glext.h:5915
#define sprintf(buf, format,...)
Definition: sprintf.c:55
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:927
long left
Definition: polytest.cpp:53
#define MM_ANISOTROPIC
Definition: wingdi.h:866
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54

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 2607 of file metafile.c.

2609 {
2610  if (emr->iType == EMR_EXTSELECTCLIPRGN)
2611  {
2612  const EMREXTSELECTCLIPRGN *clip = (const EMREXTSELECTCLIPRGN *)emr;
2613  union _rgn
2614  {
2615  RGNDATA data;
2616  char buf[sizeof(RGNDATAHEADER) + sizeof(RECT)];
2617  };
2618  const union _rgn *rgn1;
2619  union _rgn rgn2;
2620  RECT rect, rc_transformed;
2621  const RECT *rc = (const RECT *)param;
2622  HRGN hrgn;
2623  XFORM xform;
2624  INT ret;
2625  BOOL is_win9x;
2626 
2627  trace("EMR_EXTSELECTCLIPRGN: cbRgnData %#x, iMode %u\n",
2628  clip->cbRgnData, clip->iMode);
2629 
2630  ok(clip->iMode == RGN_COPY, "expected RGN_COPY, got %u\n", clip->iMode);
2631  ok(clip->cbRgnData >= sizeof(RGNDATAHEADER) + sizeof(RECT),
2632  "too small data block: %u bytes\n", clip->cbRgnData);
2633  if (clip->cbRgnData < sizeof(RGNDATAHEADER) + sizeof(RECT))
2634  return 0;
2635 
2636  rgn1 = (const union _rgn *)clip->RgnData;
2637 
2638  trace("size %u, type %u, count %u, rgn size %u, bound %s\n",
2639  rgn1->data.rdh.dwSize, rgn1->data.rdh.iType,
2640  rgn1->data.rdh.nCount, rgn1->data.rdh.nRgnSize,
2641  wine_dbgstr_rect(&rgn1->data.rdh.rcBound));
2642 
2643  ok(EqualRect(&rgn1->data.rdh.rcBound, rc), "rects don't match\n");
2644 
2645  rect = *(const RECT *)rgn1->data.Buffer;
2646  trace("rect %s\n", wine_dbgstr_rect(&rect));
2647  ok(EqualRect(&rect, rc), "rects don't match\n");
2648 
2649  ok(rgn1->data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %u\n", rgn1->data.rdh.dwSize);
2650  ok(rgn1->data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn1->data.rdh.iType);
2651  ok(rgn1->data.rdh.nCount == 1, "expected 1, got %u\n", rgn1->data.rdh.nCount);
2652  ok(rgn1->data.rdh.nRgnSize == sizeof(RECT) ||
2653  broken(rgn1->data.rdh.nRgnSize == 168), /* NT4 */
2654  "expected sizeof(RECT), got %u\n", rgn1->data.rdh.nRgnSize);
2655 
2656  hrgn = CreateRectRgn(0, 0, 0, 0);
2657 
2658  memset(&xform, 0, sizeof(xform));
2659  SetLastError(0xdeadbeef);
2660  ret = GetWorldTransform(hdc, &xform);
2662  if (!is_win9x)
2663  ok(ret, "GetWorldTransform error %u\n", GetLastError());
2664 
2665  trace("xform.eM11 %f, xform.eM22 %f\n", xform.eM11, xform.eM22);
2666 
2667  ret = GetClipRgn(hdc, hrgn);
2668  ok(ret == 0, "GetClipRgn returned %d, expected 0\n", ret);
2669 
2670  PlayEnhMetaFileRecord(hdc, handle_table, emr, n_objs);
2671 
2672  ret = GetClipRgn(hdc, hrgn);
2673  ok(ret == 1, "GetClipRgn returned %d, expected 1\n", ret);
2674 
2675  /* Win9x returns empty clipping region */
2676  if (is_win9x) return 1;
2677 
2678  ret = GetRegionData(hrgn, 0, NULL);
2679  ok(ret == sizeof(rgn2.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
2680 
2681  ret = GetRegionData(hrgn, sizeof(rgn2), &rgn2.data);
2682  ok(ret == sizeof(rgn2), "expected sizeof(rgn2), got %u\n", ret);
2683 
2684  trace("size %u, type %u, count %u, rgn size %u, bound %s\n", rgn2.data.rdh.dwSize,
2685  rgn2.data.rdh.iType, rgn2.data.rdh.nCount, rgn2.data.rdh.nRgnSize,
2686  wine_dbgstr_rect(&rgn2.data.rdh.rcBound));
2687 
2688  rect = rgn2.data.rdh.rcBound;
2689  rc_transformed = *rc;
2690  translate((POINT *)&rc_transformed, 2, &xform);
2691  trace("transformed %s\n", wine_dbgstr_rect(&rc_transformed));
2692  ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n");
2693 
2694  rect = *(const RECT *)rgn2.data.Buffer;
2695  trace("rect %s\n", wine_dbgstr_rect(&rect));
2696  rc_transformed = *rc;
2697  translate((POINT *)&rc_transformed, 2, &xform);
2698  trace("transformed %s\n", wine_dbgstr_rect(&rc_transformed));
2699  ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n");
2700 
2701  ok(rgn2.data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %u\n", rgn2.data.rdh.dwSize);
2702  ok(rgn2.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn2.data.rdh.iType);
2703  ok(rgn2.data.rdh.nCount == 1, "expected 1, got %u\n", rgn2.data.rdh.nCount);
2704  ok(rgn2.data.rdh.nRgnSize == sizeof(RECT) ||
2705  broken(rgn2.data.rdh.nRgnSize == 168), /* NT4 */
2706  "expected sizeof(RECT), got %u\n", rgn2.data.rdh.nRgnSize);
2707 
2708  DeleteObject(hrgn);
2709  }
2710  return 1;
2711 }
static BOOL is_equal_rect(const RECT *rc1, const RECT *rc2)
Definition: metafile.c:2599
struct _RGNDATAHEADER RGNDATAHEADER
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
static BOOL is_win9x
Definition: diskspace.c:33
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI PlayEnhMetaFileRecord(_In_ HDC hdc, _In_reads_(cht) LPHANDLETABLE pht, _In_ CONST ENHMETARECORD *pmr, _In_ UINT cht)
smooth NULL
Definition: ftsmooth.c:416
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI GetWorldTransform(_In_ HDC, _Out_ LPXFORM)
Definition: coord.c:278
static void translate(POINT *pt, UINT count, const XFORM *xform)
Definition: metafile.c:2586
#define trace
Definition: atltest.h:70
#define RDH_RECTANGLES
Definition: wingdi.h:668
GLfloat param
Definition: glext.h:5796
const char * wine_dbgstr_rect(const RECT *rect)
#define SetLastError(x)
Definition: compat.h:409
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
FLOAT eM11
Definition: wingdi.h:1716
HDC hdc
Definition: main.c:9
static HRGN hrgn
Definition: win.c:55
#define broken(x)
Definition: _sntprintf.h:21
#define RGN_COPY
Definition: wingdi.h:356
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define ok(value,...)
Definition: atltest.h:57
FLOAT eM22
Definition: wingdi.h:1719
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define memset(x, y, z)
Definition: compat.h:39
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
#define EMR_EXTSELECTCLIPRGN
Definition: wingdi.h:148

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 2875 of file metafile.c.

2877 {
2878  switch (mr->rdFunction) {
2879  case META_SELECTCLIPREGION:
2881  break;
2882  case META_SELECTOBJECT:
2884  break;
2885  }
2886  return 1;
2887 }
WORD rdFunction
Definition: wingdi.h:2341
static int clip_mf_enum_proc_seen_selectobject
Definition: metafile.c:2873
#define META_SELECTOBJECT
Definition: wingdi.h:254
#define META_SELECTCLIPREGION
Definition: wingdi.h:253
static int clip_mf_enum_proc_seen_selectclipregion
Definition: metafile.c:2872

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 1862 of file metafile.c.

1865 {
1866  unsigned char buf[MF_BUFSIZE];
1867  UINT mfsize, offset1, offset2, diff_nt4, diff_9x;
1868  const ENHMETAHEADER *emh1, *emh2;
1869 
1870  mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf);
1871  ok (mfsize > 0, "%s: GetEnhMetaFileBits error %d\n", desc, GetLastError());
1872 
1873  /* ENHMETAHEADER size could differ, depending on platform */
1874  diff_nt4 = sizeof(SIZEL);
1875  diff_9x = sizeof(SIZEL) + 3 * sizeof(DWORD);
1876 
1877  if (mfsize < MF_BUFSIZE)
1878  {
1879  ok(mfsize == bsize ||
1880  broken(mfsize == bsize - diff_nt4) || /* NT4 */
1881  broken(mfsize == bsize - diff_9x), /* Win9x/WinME */
1882  "%s: mfsize=%d, bsize=%d\n", desc, mfsize, bsize);
1883  }
1884  else
1885  ok(bsize >= MF_BUFSIZE, "%s: mfsize > bufsize (%d bytes), bsize=%d\n",
1886  desc, mfsize, bsize);
1887 
1888  /* basic things must match */
1889  emh1 = (const ENHMETAHEADER *)bits;
1890  emh2 = (const ENHMETAHEADER *)buf;
1891  ok(emh1->iType == EMR_HEADER, "expected EMR_HEADER, got %u\n", emh1->iType);
1892  ok(emh1->nSize == sizeof(ENHMETAHEADER), "expected sizeof(ENHMETAHEADER), got %u\n", emh1->nSize);
1893  ok(emh2->nBytes == mfsize, "expected emh->nBytes %u, got %u\n", mfsize, emh2->nBytes);
1894  ok(emh1->dSignature == ENHMETA_SIGNATURE, "expected ENHMETA_SIGNATURE, got %u\n", emh1->dSignature);
1895 
1896  ok(emh1->iType == emh2->iType, "expected EMR_HEADER, got %u\n", emh2->iType);
1897  ok(emh1->nSize == emh2->nSize ||
1898  broken(emh1->nSize - diff_nt4 == emh2->nSize) ||
1899  broken(emh1->nSize - diff_9x == emh2->nSize),
1900  "expected nSize %u, got %u\n", emh1->nSize, emh2->nSize);
1901  ok(emh1->rclBounds.left == emh2->rclBounds.left, "%s: expected rclBounds.left = %d, got %d\n",
1902  desc, emh1->rclBounds.left, emh2->rclBounds.left);
1903  ok(emh1->rclBounds.top == emh2->rclBounds.top, "%s: expected rclBounds.top = %d, got %d\n",
1904  desc, emh1->rclBounds.top, emh2->rclBounds.top);
1905  ok(emh1->rclBounds.right == emh2->rclBounds.right, "%s: expected rclBounds.right = %d, got %d\n",
1906  desc, emh1->rclBounds.right, emh2->rclBounds.right);
1907  ok(emh1->rclBounds.bottom == emh2->rclBounds.bottom, "%s: expected rclBounds.bottom = %d, got %d\n",
1908  desc, emh1->rclBounds.bottom, emh2->rclBounds.bottom);
1909  ok(emh1->dSignature == emh2->dSignature, "expected dSignature %u, got %u\n", emh1->dSignature, emh2->dSignature);
1910  ok(emh1->nBytes == emh2->nBytes ||
1911  broken(emh1->nBytes - diff_nt4 == emh2->nBytes) ||
1912  broken(emh1->nBytes - diff_9x == emh2->nBytes),
1913  "expected nBytes %u, got %u\n", emh1->nBytes, emh2->nBytes);
1914  ok(emh1->nRecords == emh2->nRecords, "expected nRecords %u, got %u\n", emh1->nRecords, emh2->nRecords);
1915 
1916  offset1 = emh1->nSize;
1917  offset2 = emh2->nSize; /* Needed for Win9x/WinME/NT4 */
1918  while (offset1 < emh1->nBytes)
1919  {
1920  const ENHMETARECORD *emr1 = (const ENHMETARECORD *)(bits + offset1);
1921  const ENHMETARECORD *emr2 = (const ENHMETARECORD *)(buf + offset2);
1922 
1923  trace("%s: EMF record %u, size %u/record %u, size %u\n",
1924  desc, emr1->iType, emr1->nSize, emr2->iType, emr2->nSize);
1925 
1926  if (!match_emf_record(emr1, emr2, desc, ignore_scaling)) return -1;
1927 
1928  /* We have already bailed out if iType or nSize don't match */
1929  offset1 += emr1->nSize;
1930  offset2 += emr2->nSize;
1931  }
1932  return 0;
1933 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
long bottom
Definition: polytest.cpp:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
long right
Definition: polytest.cpp:53
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
long top
Definition: polytest.cpp:53
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
long left
Definition: polytest.cpp:53
DWORD dSignature
Definition: wingdi.h:2319
#define trace
Definition: atltest.h:70
SIZE SIZEL
Definition: windef.h:323
#define MF_BUFSIZE
Definition: metafile.c:1017
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EMR_HEADER
Definition: wingdi.h:75
DWORD nRecords
Definition: wingdi.h:2322
#define ENHMETA_SIGNATURE
Definition: wingdi.h:204
#define broken(x)
Definition: _sntprintf.h:21
RECTL rclBounds
Definition: wingdi.h:2317
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
static BOOL match_emf_record(const ENHMETARECORD *emr1, const ENHMETARECORD *emr2, const char *desc, BOOL ignore_scaling)
Definition: metafile.c:1754

Referenced by test_emf_BitBlt(), test_emf_clipping(), test_emf_DCBrush(), test_emf_ExtTextOut_on_path(), test_emf_GradientFill(), test_emf_paths(), test_emf_polybezier(), test_emf_PolyPolyline(), 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 1599 of file metafile.c.

1601 {
1602  unsigned char buf[MF_BUFSIZE];
1603  UINT mfsize, i;
1604  int diff;
1605 
1606  mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf);
1607  ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc);
1608  if (mfsize < MF_BUFSIZE)
1609  ok (mfsize == bsize, "%s: mfsize=%d, bsize=%d.\n",
1610  desc, mfsize, bsize);
1611  else
1612  ok (bsize >= MF_BUFSIZE, "%s: mfsize > bufsize (%d bytes), bsize=%d.\n",
1613  desc, mfsize, bsize);
1614  if (mfsize != bsize)
1615  return -1;
1616 
1617  diff = 0;
1618  for (i=0; i<bsize; i++)
1619  {
1620  if (buf[i] != bits[i])
1621  diff++;
1622  }
1623  ok (diff == 0, "%s: mfsize=%d, bsize=%d, diff=%d\n",
1624  desc, mfsize, bsize, diff);
1625 
1626  return diff;
1627 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
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
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
UINT WINAPI GetMetaFileBitsEx(HMETAFILE hmf, UINT nSize, LPVOID buf)
Definition: metafile.c:1091
#define MF_BUFSIZE
Definition: metafile.c:1017
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50

Referenced by create_converted_emf(), test_CopyMetaFile(), test_mf_Blank(), test_mf_clipping(), test_mf_DCBrush(), test_mf_ExtTextOut_on_path(), test_mf_GetPath(), test_mf_Graphics(), test_mf_PatternBrush(), 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 1629 of file metafile.c.

1630 {
1631  unsigned char buf[MF_BUFSIZE];
1632  DWORD mfsize, rd_size, i;
1633  int diff;
1634  HANDLE hfile;
1635  BOOL ret;
1636 
1638  assert(hfile != INVALID_HANDLE_VALUE);
1639 
1640  mfsize = GetFileSize(hfile, NULL);
1641  assert(mfsize <= MF_BUFSIZE);
1642 
1643  ret = ReadFile(hfile, buf, sizeof(buf), &rd_size, NULL);
1644  ok( ret && rd_size == mfsize, "ReadFile: error %d\n", GetLastError());
1645 
1646  CloseHandle(hfile);
1647 
1648  ok(mfsize == bsize, "%s: mfsize=%d, bsize=%d.\n", desc, mfsize, bsize);
1649 
1650  if (mfsize != bsize)
1651  return -1;
1652 
1653  diff = 0;
1654  for (i=0; i<bsize; i++)
1655  {
1656  if (buf[i] != bits[i])
1657  diff++;
1658  }
1659  ok(diff == 0, "%s: mfsize=%d, bsize=%d, diff=%d\n",
1660  desc, mfsize, bsize, diff);
1661 
1662  return diff;
1663 }
#define CloseHandle
Definition: compat.h:398
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define FILE_SHARE_READ
Definition: compat.h:125
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
unsigned int BOOL
Definition: ntddk_ex.h:94
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define MF_BUFSIZE
Definition: metafile.c:1017
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
int ret
#define GENERIC_READ
Definition: compat.h:124
#define ok(value,...)
Definition: atltest.h:57
Definition: name.c:36
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123

Referenced by test_CopyMetaFile().

◆ create_converted_emf()

static HENHMETAFILE create_converted_emf ( const METAFILEPICT mfp)
static

Definition at line 3040 of file metafile.c.

3041 {
3042  HDC hdcMf;
3043  HMETAFILE hmf;
3044  HENHMETAFILE hemf;
3045  BOOL ret;
3046  UINT size;
3047  LPBYTE pBits;
3048 
3049  hdcMf = CreateMetaFileA(NULL);
3050  ok(hdcMf != NULL, "CreateMetaFile failed with error %d\n", GetLastError());
3051  ret = LineTo(hdcMf, (INT)LINE_X, (INT)LINE_Y);
3052  ok(ret, "LineTo failed with error %d\n", GetLastError());
3053  hmf = CloseMetaFile(hdcMf);
3054  ok(hmf != NULL, "CloseMetaFile failed with error %d\n", GetLastError());
3055 
3056  if (compare_mf_bits (hmf, MF_LINETO_BITS, sizeof(MF_LINETO_BITS), "mf_LineTo") != 0)
3057  {
3058  dump_mf_bits(hmf, "mf_LineTo");
3059  EnumMetaFile(0, hmf, mf_enum_proc, 0);
3060  }
3061 
3062  size = GetMetaFileBitsEx(hmf, 0, NULL);
3063  ok(size, "GetMetaFileBitsEx failed with error %d\n", GetLastError());
3064  pBits = HeapAlloc(GetProcessHeap(), 0, size);
3065  GetMetaFileBitsEx(hmf, size, pBits);
3066  DeleteMetaFile(hmf);
3067  hemf = SetWinMetaFileBits(size, pBits, NULL, mfp);
3068  HeapFree(GetProcessHeap(), 0, pBits);
3069  return hemf;
3070 }
static int compare_mf_bits(const HMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc)
Definition: metafile.c:1599
static const unsigned char MF_LINETO_BITS[]
Definition: metafile.c:1167
BOOL WINAPI DeleteMetaFile(HMETAFILE hmf)
Definition: metafile.c:139
#define LINE_Y
Definition: metafile.c:40
HDC WINAPI CreateMetaFileA(_In_opt_ LPCSTR)
static HDC
Definition: imagelist.c:92
BOOL WINAPI EnumMetaFile(HDC hdc, HMETAFILE hmf, MFENUMPROC lpEnumFunc, LPARAM lpData)
Definition: metafile.c:464
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
int32_t INT
Definition: typedefs.h:56
HENHMETAFILE WINAPI SetWinMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *lpMeta16Data, _In_opt_ HDC hdcRef, _In_opt_ const METAFILEPICT *lpMFP)
#define LINE_X
Definition: metafile.c:39
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static void dump_mf_bits(const HMETAFILE mf, const char *desc)
Definition: metafile.c:1568
static INT CALLBACK mf_enum_proc(HDC hdc, HANDLETABLE *ht, METARECORD *mr, INT nobj, LPARAM param)
Definition: metafile.c:1556
UINT WINAPI GetMetaFileBitsEx(HMETAFILE hmf, UINT nSize, LPVOID buf)
Definition: metafile.c:1091
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_mf_conversions().

◆ dump_emf_bits()

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

Definition at line 1668 of file metafile.c.

1669 {
1670  BYTE buf[MF_BUFSIZE];
1671  UINT mfsize, i;
1672 
1673  if (!winetest_debug) return;
1674 
1675  mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf);
1676  ok (mfsize > 0, "%s: GetEnhMetaFileBits failed\n", desc);
1677 
1678  printf("EMF %s has bits:\n{\n ", desc);
1679  for (i = 0; i < mfsize; i++)
1680  {
1681  printf ("0x%02x", buf[i]);
1682  if (i == mfsize-1)
1683  printf ("\n");
1684  else if (i % 8 == 7)
1685  printf (",\n ");
1686  else
1687  printf (", ");
1688  }
1689  printf ("};\n");
1690 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int winetest_debug
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
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
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define MF_BUFSIZE
Definition: metafile.c:1017
unsigned char BYTE
Definition: mem.h:68
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define printf
Definition: config.h:203

Referenced by test_emf_BitBlt(), test_emf_clipping(), test_emf_DCBrush(), test_emf_ExtTextOut_on_path(), test_emf_GradientFill(), test_emf_paths(), test_emf_polybezier(), test_emf_PolyPolyline(), and test_mf_conversions().

◆ dump_emf_record()

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

Definition at line 1716 of file metafile.c.

1717 {
1718  const BYTE *buf;
1719  DWORD i;
1720 
1721  if (!winetest_debug) return;
1722 
1723  printf ("%s: EMF record %u has bits:\n{\n", desc, emr->iType);
1724  buf = (const BYTE *)emr;
1725  for (i = 0; i < emr->nSize; i++)
1726  {
1727  printf ("0x%02x", buf[i]);
1728  if (i == emr->nSize - 1)
1729  printf ("\n");
1730  else if (i % 8 == 7)
1731  printf (",\n");
1732  else
1733  printf (", ");
1734  }
1735  printf ("};\n");
1736 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int winetest_debug
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
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68
#define printf
Definition: config.h:203

Referenced by match_emf_record().

◆ dump_emf_records()

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

Definition at line 1692 of file metafile.c.

1693 {
1694  BYTE *emf;
1695  BYTE buf[MF_BUFSIZE];
1696  UINT mfsize, offset;
1697 
1698  if (!winetest_debug) return;
1699 
1700  mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf);
1701  ok (mfsize > 0, "%s: GetEnhMetaFileBits error %d\n", desc, GetLastError());
1702 
1703  printf("EMF %s has records:\n", desc);
1704 
1705  emf = buf;
1706  offset = 0;
1707  while(offset < mfsize)
1708  {
1709  EMR *emr = (EMR *)(emf + offset);
1710  printf("emr->iType %d, emr->nSize %u\n", emr->iType, emr->nSize);
1711  /*trace("emr->iType 0x%04lx, emr->nSize 0x%04lx\n", emr->iType, emr->nSize);*/
1712  offset += emr->nSize;
1713  }
1714 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLintptr offset
Definition: glext.h:5920
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int winetest_debug
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define MF_BUFSIZE
Definition: metafile.c:1017
DWORD nSize
Definition: wingdi.h:1686
unsigned char BYTE
Definition: mem.h:68
DWORD iType
Definition: wingdi.h:1685
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define printf
Definition: config.h:203

Referenced by test_emf_BitBlt(), test_emf_clipping(), test_emf_DCBrush(), test_emf_ExtTextOut_on_path(), test_emf_GradientFill(), test_emf_paths(), test_emf_polybezier(), test_emf_PolyPolyline(), and test_mf_conversions().

◆ dump_EMREXTTEXTOUT()

static void dump_EMREXTTEXTOUT ( const EMREXTTEXTOUTW eto)
static

Definition at line 1738 of file metafile.c.

1739 {
1740  trace("rclBounds %d,%d - %d,%d\n", eto->rclBounds.left, eto->rclBounds.top,
1741  eto->rclBounds.right, eto->rclBounds.bottom);
1742  trace("iGraphicsMode %u\n", eto->iGraphicsMode);
1743  trace("exScale: %f\n", eto->exScale);
1744  trace("eyScale: %f\n", eto->eyScale);
1745  trace("emrtext.ptlReference %d,%d\n", eto->emrtext.ptlReference.x, eto->emrtext.ptlReference.y);
1746  trace("emrtext.nChars %u\n", eto->emrtext.nChars);
1747  trace("emrtext.offString %#x\n", eto->emrtext.offString);
1748  trace("emrtext.fOptions %#x\n", eto->emrtext.fOptions);
1749  trace("emrtext.rcl %d,%d - %d,%d\n", eto->emrtext.rcl.left, eto->emrtext.rcl.top,
1750  eto->emrtext.rcl.right, eto->emrtext.rcl.bottom);
1751  trace("emrtext.offDx %#x\n", eto->emrtext.offDx);
1752 }
POINTL ptlReference
Definition: wingdi.h:1967
DWORD iGraphicsMode
Definition: wingdi.h:1977
long bottom
Definition: polytest.cpp:53
LONG y
Definition: windef.h:315
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
RECTL rcl
Definition: wingdi.h:1971
long left
Definition: polytest.cpp:53
DWORD offDx
Definition: wingdi.h:1972
#define trace
Definition: atltest.h:70
LONG x
Definition: windef.h:314
DWORD nChars
Definition: wingdi.h:1968
DWORD fOptions
Definition: wingdi.h:1970
DWORD offString
Definition: wingdi.h:1969
EMRTEXT emrtext
Definition: wingdi.h:1980

Referenced by match_emf_record().

◆ dump_mf_bits()

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

Definition at line 1568 of file metafile.c.

1569 {
1570  BYTE buf[MF_BUFSIZE];
1571  UINT mfsize, i;
1572 
1573  if (!winetest_debug) return;
1574 
1575  mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf);
1576  ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc);
1577 
1578  printf ("MetaFile %s has bits:\n{\n ", desc);
1579  for (i=0; i<mfsize; i++)
1580  {
1581  printf ("0x%02x", buf[i]);
1582  if (i == mfsize-1)
1583  printf ("\n");
1584  else if (i % 8 == 7)
1585  printf (",\n ");
1586  else
1587  printf (", ");
1588  }
1589  printf ("};\n");
1590 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int winetest_debug
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
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
UINT WINAPI GetMetaFileBitsEx(HMETAFILE hmf, UINT nSize, LPVOID buf)
Definition: metafile.c:1091
#define MF_BUFSIZE
Definition: metafile.c:1017
unsigned char BYTE
Definition: mem.h:68
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define printf
Definition: config.h:203

Referenced by create_converted_emf(), test_CopyMetaFile(), test_mf_Blank(), test_mf_clipping(), test_mf_DCBrush(), test_mf_ExtTextOut_on_path(), test_mf_GetPath(), test_mf_Graphics(), test_mf_PatternBrush(), and test_SetMetaFileBits().

◆ EmfEnumProc()

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

Definition at line 3001 of file metafile.c.

3002 {
3003  LPMETAFILEPICT lpMFP = (LPMETAFILEPICT)lpData;
3004  POINT mapping[2] = { { 0, 0 }, { 10, 10 } };
3005  /* When using MM_TEXT Win9x does not update the mapping mode
3006  * until a record is played which actually outputs something */
3007  PlayEnhMetaFileRecord(hdc, lpHTable, lpEMFR, nObj);
3008  LPtoDP(hdc, mapping, 2);
3009  trace("EMF record: iType %d, nSize %d, (%d,%d)-(%d,%d)\n",
3010  lpEMFR->iType, lpEMFR->nSize,
3011  mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y);
3012 
3013  if (lpEMFR->iType == EMR_LINETO)
3014  {
3015  INT x0, y0, x1, y1;
3016  if (!lpMFP || lpMFP->mm == MM_TEXT)
3017  {
3018  x0 = 0;
3019  y0 = 0;
3020  x1 = (INT)floor(10 * 100.0 / LINE_X + 0.5);
3021  y1 = (INT)floor(10 * 100.0 / LINE_Y + 0.5);
3022  }
3023  else
3024  {
3025  ok(lpMFP->mm == MM_ANISOTROPIC, "mm=%d\n", lpMFP->mm);
3026 
3031  }
3032  ok(mapping[0].x == x0 && mapping[0].y == y0 && mapping[1].x == x1 && mapping[1].y == y1,
3033  "(%d,%d)->(%d,%d), expected (%d,%d)->(%d,%d)\n",
3034  mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y,
3035  x0, y0, x1, y1);
3036  }
3037  return TRUE;
3038 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define HORZRES
Definition: wingdi.h:715
#define TRUE
Definition: types.h:120
GLint x0
Definition: linetemp.h:95
#define LINE_Y
Definition: metafile.c:40
BOOL WINAPI LPtoDP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
#define EMR_LINETO
Definition: wingdi.h:128
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
static INT
Definition: metafile.c:43
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:56
#define LINE_X
Definition: metafile.c:39
BOOL WINAPI PlayEnhMetaFileRecord(_In_ HDC hdc, _In_reads_(cht) LPHANDLETABLE pht, _In_ CONST ENHMETARECORD *pmr, _In_ UINT cht)
#define trace
Definition: atltest.h:70
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
HDC hdc
Definition: main.c:9
#define MM_ANISOTROPIC
Definition: wingdi.h:866
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define HORZSIZE
Definition: wingdi.h:713
#define VERTSIZE
Definition: wingdi.h:714
#define ok(value,...)
Definition: atltest.h:57
GLint y0
Definition: linetemp.h:96
#define VERTRES
Definition: wingdi.h:716
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define MM_TEXT
Definition: wingdi.h:872
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
struct tagMETAFILEPICT * LPMETAFILEPICT
#define MulDiv(x, y, z)
Definition: gdifloat.h:86

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 4069 of file metafile.c.

4071 {
4072  XFORM xform = {0};
4074  BOOL ret;
4075 
4076  switch(emr->iType)
4077  {
4078  case EMR_SETWORLDTRANSFORM:
4079  {
4080  const EMRSETWORLDTRANSFORM *lpXfrm = (const EMRSETWORLDTRANSFORM *)emr;
4081 
4082  /* get scale factors with an identity world transform */
4083  GetWorldTransform(hdc, &test_data->scale);
4084 
4085  /* play back record */
4086  ret = PlayEnhMetaFileRecord(hdc, ht, emr, nobj);
4087  ok(ret == TRUE, "%s: PlayEnhMetaFileRecord failed\n", test_data->name);
4088 
4089  test_data->stored = lpXfrm->xform;
4090  CombineTransform(&test_data->expected, &test_data->stored, &test_data->scale);
4091 
4092  /* verify it is updated immediately */
4093  ret = GetWorldTransform(hdc, &xform);
4094  ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
4095  ok(xform_eq(&xform, &test_data->expected),
4096  "%s: After SWT playback, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
4097  test_data->name,
4098  xform.eM11, xform.eM12,
4099  xform.eM21, xform.eM22,
4100  xform.eDx, xform.eDy,
4101  test_data->expected.eM11, test_data->expected.eM12,
4102  test_data->expected.eM21, test_data->expected.eM22,
4103  test_data->expected.eDx, test_data->expected.eDy);
4104 
4105  break;
4106  }
4107 
4109  {
4110  const EMRMODIFYWORLDTRANSFORM *lpXfrm = (const EMRMODIFYWORLDTRANSFORM *)emr;
4111 
4112  /* transform persists across calls */
4113  ret = GetWorldTransform(hdc, &xform);
4114  ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
4115  ok(xform_eq(&xform, &test_data->expected),
4116  "%s: On MWT entry, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
4117  test_data->name,
4118  xform.eM11, xform.eM12,
4119  xform.eM21, xform.eM22,
4120  xform.eDx, xform.eDy,
4121  test_data->expected.eM11, test_data->expected.eM12,
4122  test_data->expected.eM21, test_data->expected.eM22,
4123  test_data->expected.eDx, test_data->expected.eDy);
4124 
4125  if(test_data->do_playback)
4126  {
4127  /* play back record */
4128  ret = PlayEnhMetaFileRecord(hdc, ht, emr, nobj);
4129  ok(ret == TRUE, "%s: PlayEnhMetaFileRecord failed\n", test_data->name);
4130 
4131  if(lpXfrm->iMode == MWT_LEFTMULTIPLY)
4132  {
4133  /* left multiply does not discard direct modifications */
4134  CombineTransform(&test_data->expected, &lpXfrm->xform, &test_data->expected);
4135 
4136  /* and updates the stored matrix separately */
4137  CombineTransform(&test_data->stored, &lpXfrm->xform, &test_data->stored);
4138 
4139  }
4140  else if(lpXfrm->iMode == MWT_RIGHTMULTIPLY)
4141  {
4142  /* but right multiply does discard */
4143  CombineTransform(&test_data->stored, &test_data->stored, &lpXfrm->xform);
4144 
4145  CombineTransform(&test_data->expected, &test_data->stored, &test_data->scale);
4146  }
4147 
4148  /* verify it is updated immediately */
4149  ret = GetWorldTransform(hdc, &xform);
4150  ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
4151  ok(xform_eq(&xform, &test_data->expected),
4152  "%s: After MWT playback, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
4153  test_data->name,
4154  xform.eM11, xform.eM12,
4155  xform.eM21, xform.eM22,
4156  xform.eDx, xform.eDy,
4157  test_data->expected.eM11, test_data->expected.eM12,
4158  test_data->expected.eM21, test_data->expected.eM22,
4159  test_data->expected.eDx, test_data->expected.eDy);
4160  }
4161 
4162  if(test_data->do_modify)
4163  {
4164  /* modify directly */
4165  set_rotation_xform(&xform, M_PI / 4.f, 1, -1);
4167  ok(ret == TRUE, "%s: ModifyWorldTransform failed\n", test_data->name);
4168 
4169  /* the modified transform persists across callback calls */
4170  CombineTransform(&test_data->expected, &xform, &test_data->expected);
4171 
4172  ret = GetWorldTransform(hdc, &xform);
4173  ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
4174  ok(xform_eq(&xform, &test_data->expected),
4175  "%s: After ModifyWT, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
4176  test_data->name,
4177  xform.eM11, xform.eM12,
4178  xform.eM21, xform.eM22,
4179  xform.eDx, xform.eDy,
4180  test_data->expected.eM11, test_data->expected.eM12,
4181  test_data->expected.eM21, test_data->expected.eM22,
4182  test_data->expected.eDx, test_data->expected.eDy);
4183  }
4184 
4185  break;
4186  }
4187 
4188  case EMR_LINETO:
4189  ret = GetWorldTransform(hdc, &xform);
4190  ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
4191  ok(xform_eq(&xform, &test_data->expected),
4192  "%s: Before LINETO playback, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
4193  test_data->name,
4194  xform.eM11, xform.eM12,
4195  xform.eM21, xform.eM22,
4196  xform.eDx, xform.eDy,
4197  test_data->expected.eM11, test_data->expected.eM12,
4198  test_data->expected.eM21, test_data->expected.eM22,
4199  test_data->expected.eDx, test_data->expected.eDy);
4200 
4201  ret = PlayEnhMetaFileRecord(hdc, ht, emr, nobj);
4202  ok(ret == TRUE, "%s: PlayEnhMetaFileRecord failed\n", test_data->name);
4203 
4204  /* transform doesn't change during LINETO playback */
4205  ret = GetWorldTransform(hdc, &xform);
4206  ok(ret == TRUE, "%s: GetWorldTransform failed\n", test_data->name);
4207  ok(xform_eq(&xform, &test_data->expected),
4208  "%s: After LINETO playback, got wrong world transform: %f, %f; %f %f; %f %f; expected: %f, %f; %f %f; %f %f\n",
4209  test_data->name,
4210  xform.eM11, xform.eM12,
4211  xform.eM21, xform.eM22,
4212  xform.eDx, xform.eDy,
4213  test_data->expected.eM11, test_data->expected.eM12,
4214  test_data->expected.eM21, test_data->expected.eM22,
4215  test_data->expected.eDx, test_data->expected.eDy);
4216 
4217  break;
4218 
4219  default:
4220  PlayEnhMetaFileRecord(hdc, ht, emr, nobj);
4221  break;
4222  }
4223 
4224  return 1;
4225 }
#define TRUE
Definition: types.h:120
#define EMR_LINETO
Definition: wingdi.h:128
#define MWT_LEFTMULTIPLY
Definition: wingdi.h:944
static void set_rotation_xform(XFORM *out, float rad, int dx, int dy)
Definition: metafile.c:4037
#define M_PI
Definition: metafile.c:32
unsigned int BOOL
Definition: ntddk_ex.h:94
FLOAT eDx
Definition: wingdi.h:1720
BOOL WINAPI PlayEnhMetaFileRecord(_In_ HDC hdc, _In_reads_(cht) LPHANDLETABLE pht, _In_ CONST ENHMETARECORD *pmr, _In_ UINT cht)
FLOAT eM21
Definition: wingdi.h:1718
FLOAT eM12
Definition: wingdi.h:1717
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
GLfloat f
Definition: glext.h:7540
BOOL WINAPI GetWorldTransform(_In_ HDC, _Out_ LPXFORM)
Definition: coord.c:278
BOOL WINAPI ModifyWorldTransform(_In_ HDC, _In_opt_ const XFORM *, _In_ DWORD)
GLfloat param
Definition: glext.h:5796
int ret
FLOAT eM11
Definition: wingdi.h:1716
HDC hdc
Definition: main.c:9
static BOOL xform_eq(const XFORM *a, const XFORM *b)
Definition: metafile.c:4059
#define ok(value,...)
Definition: atltest.h:57
static const struct newhuff ht[]
Definition: huffman.h:296
FLOAT eM22
Definition: wingdi.h:1719
FLOAT eDy
Definition: wingdi.h:1721
#define EMR_SETWORLDTRANSFORM
Definition: wingdi.h:109
#define MWT_RIGHTMULTIPLY
Definition: wingdi.h:945

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 81 of file metafile.c.

83 {
84  static int n_record;
85  DWORD i;
86  const INT *dx;
87  INT *orig_dx = (INT *)param;
88  LOGFONTA device_lf;
89  INT ret;
90 
91  if(!hdc) return 1;
92 
93  PlayEnhMetaFileRecord(hdc, handle_table, emr, n_objs);
94 
95  switch (emr->iType)
96  {
97  case EMR_HEADER:
98  ok(GetTextAlign(hdc) == 0, "text align %08x\n", GetTextAlign(hdc));
99  ok(GetBkColor(hdc) == RGB(0xff, 0xff, 0xff), "bk color %08x\n", GetBkColor(hdc));
100  ok(GetTextColor(hdc) == RGB(0x0, 0x0, 0x0), "text color %08x\n", GetTextColor(hdc));
101  ok(GetROP2(hdc) == R2_COPYPEN, "rop %d\n", GetROP2(hdc));
103  ok(GetPolyFillMode(hdc) == ALTERNATE, "poly fill %d\n", GetPolyFillMode(hdc));
104  ok(GetStretchBltMode(hdc) == BLACKONWHITE, "stretchblt mode %d\n", GetStretchBltMode(hdc));
105 
106  /* GetBkMode, GetRelAbs do not get reset to the default value */
107  ok(GetBkMode(hdc) == OPAQUE, "bk mode %d\n", GetBkMode(hdc));
108  if(pSetRelAbs && pGetRelAbs)
109  ok(pGetRelAbs(hdc, 0) == RELATIVE, "relabs %d\n", pGetRelAbs(hdc, 0));
110 
111  n_record = 0;
112  break;
113 
114  case EMR_EXTTEXTOUTA:
115  {
116  const EMREXTTEXTOUTA *emr_ExtTextOutA = (const EMREXTTEXTOUTA *)emr;
117  dx = (const INT *)((const char *)emr + emr_ExtTextOutA->emrtext.offDx);
118 
119  ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
120  ok( ret == sizeof(device_lf), "GetObjectA error %d\n", GetLastError());
121 
122  /* compare up to lfOutPrecision, other values are not interesting,
123  * and in fact sometimes arbitrary adapted by Win9x.
124  */
125  ok(!memcmp(&orig_lf, &device_lf, FIELD_OFFSET(LOGFONTA, lfOutPrecision)), "fonts don't match\n");
126  ok(!lstrcmpA(orig_lf.lfFaceName, device_lf.lfFaceName), "font names don't match\n");
127 
128  for(i = 0; i < emr_ExtTextOutA->emrtext.nChars; i++)
129  {
130  ok(orig_dx[i] == dx[i], "pass %d: dx[%d] (%d) didn't match %d\n",
131  n_record, i, dx[i], orig_dx[i]);
132  }
133  n_record++;
135  break;
136  }
137 
138  case EMR_EXTTEXTOUTW:
139  {
140  const EMREXTTEXTOUTW *emr_ExtTextOutW = (const EMREXTTEXTOUTW *)emr;
141  dx = (const INT *)((const char *)emr + emr_ExtTextOutW->emrtext.offDx);
142 
143  SetLastError(0xdeadbeef);
144  ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
145  ok( ret == sizeof(device_lf) ||
146  broken(ret == (sizeof(device_lf) - LF_FACESIZE + strlen(device_lf.lfFaceName) + 1)), /* NT4 */
147  "GetObjectA error %d\n", GetLastError());
148 
149  /* compare up to lfOutPrecision, other values are not interesting,
150  * and in fact sometimes arbitrary adapted by Win9x.
151  */
152  ok(!memcmp(&orig_lf, &device_lf, FIELD_OFFSET(LOGFONTA, lfOutPrecision)), "fonts don't match\n");
153  ok(!lstrcmpA(orig_lf.lfFaceName, device_lf.lfFaceName), "font names don't match\n");
154 
155  ok(!emr_ExtTextOutW->rclBounds.left, "emr_ExtTextOutW->rclBounds.left = %d\n",
156  emr_ExtTextOutW->rclBounds.left);
157  ok(emr_ExtTextOutW->rclBounds.right != -1, "emr_ExtTextOutW->rclBounds.right = %d\n",
158  emr_ExtTextOutW->rclBounds.right);
159  ok(emr_ExtTextOutW->rclBounds.bottom != -1, "emr_ExtTextOutW->rclBounds.bottom = %d\n",
160  emr_ExtTextOutW->rclBounds.bottom);
161 
162  for(i = 0; i < emr_ExtTextOutW->emrtext.nChars; i++)
163  {
164  ok(orig_dx[i] == dx[i], "pass %d: dx[%d] (%d) didn't match %d\n",
165  n_record, i, dx[i], orig_dx[i]);
166  }
167  n_record++;
169  break;
170  }
171 
172  default:
173  break;
174  }
175 
176  return 1;
177 }
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
static LOGFONTA orig_lf
Definition: metafile.c:35
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:954
#define TRUE
Definition: types.h:120
#define LF_FACESIZE
Definition: dimm.idl:39
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLint x0
Definition: linetemp.h:95
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
long bottom
Definition: polytest.cpp:53
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int WINAPI GetStretchBltMode(_In_ HDC)
#define R2_COPYPEN
Definition: wingdi.h:338
#define RELATIVE(wait)
Definition: nfs41_driver.c:113
int32_t INT
Definition: typedefs.h:56
#define AD_COUNTERCLOCKWISE
Definition: wingdi.h:666
UINT WINAPI GetTextAlign(_In_ HDC)
Definition: text.c:808
long right
Definition: polytest.cpp:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ALTERNATE
Definition: constants.h:278
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:831
BOOL WINAPI PlayEnhMetaFileRecord(_In_ HDC hdc, _In_reads_(cht) LPHANDLETABLE pht, _In_ CONST ENHMETARECORD *pmr, _In_ UINT cht)
static BOOL emr_processed
Definition: metafile.c:36
#define EMR_EXTTEXTOUTW
Definition: wingdi.h:157
long left
Definition: polytest.cpp:53
DWORD offDx
Definition: wingdi.h:1972
int WINAPI GetBkMode(_In_ HDC)
GLfloat param
Definition: glext.h:5796
#define RGB(r, g, b)
Definition: wingdi.h:2935
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define OBJ_FONT
Definition: objidl.idl:1414
int WINAPI GetPolyFillMode(_In_ HDC)
int ret
#define OPAQUE
Definition: wingdi.h:948
HDC hdc
Definition: main.c:9
#define EMR_HEADER
Definition: wingdi.h:75
#define broken(x)
Definition: _sntprintf.h:21
int WINAPI GetROP2(_In_ HDC)
Definition: dc.c:1062
DWORD nChars
Definition: wingdi.h:1968
#define EMR_EXTTEXTOUTA
Definition: wingdi.h:156
#define ok(value,...)
Definition: atltest.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
int WINAPI GetArcDirection(_In_ HDC)
Definition: dc.c:369
GLint dx
Definition: linetemp.h:97
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:439
#define BLACKONWHITE
Definition: wingdi.h:951
EMRTEXT emrtext
Definition: wingdi.h:1980

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 316 of file metafile.c.

318 {
320 
321  if (emr->iType == EMR_EXTTEXTOUTW)
322  {
323  const EMREXTTEXTOUTW *pExtTextOutW = (const EMREXTTEXTOUTW *)emr;
324  ok(fabs(test->ex_scale - pExtTextOutW->exScale) < 0.001,
325  "Got exScale %f, expected %f\n", pExtTextOutW->exScale, test->ex_scale);
326  ok(fabs(test->ey_scale - pExtTextOutW->eyScale) < 0.001,
327  "Got eyScale %f, expected %f\n", pExtTextOutW->eyScale, test->ey_scale);
328  test->processed = TRUE;
329  }
330 
331  return 1;
332 }
#define TRUE
Definition: types.h:120
#define test
Definition: rosglue.h:37
#define EMR_EXTTEXTOUTW
Definition: wingdi.h:157
GLfloat param
Definition: glext.h:5796
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define ok(value,...)
Definition: atltest.h:57

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 3145 of file metafile.c.

3148 {
3149  METAFILEPICT mfp;
3150  METAFILEPICT * mfpPtr = NULL;
3151  HENHMETAFILE emf;
3153  UINT res;
3154 
3155  if (!mfpIsNull)
3156  {
3157  mfp.mm = mm;
3158  mfp.xExt = xExt;
3159  mfp.yExt = yExt;
3160  mfpPtr = &mfp;
3161  }
3162 
3163  emf = SetWinMetaFileBits(buffer_size, buffer, NULL, mfpPtr);
3164  ok(emf != NULL, "SetWinMetaFileBits failed\n");
3165  if (!emf) return FALSE;
3166  res = GetEnhMetaFileHeader(emf, sizeof(header), &header);
3167  ok(res != 0, "GetEnhMetaHeader failed\n");
3168  DeleteEnhMetaFile(emf);
3169  if (!res) return FALSE;
3170 
3171  *rclBounds = header.rclBounds;
3172  *rclFrame = header.rclFrame;
3173  return TRUE;
3174 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
HENHMETAFILE WINAPI SetWinMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *lpMeta16Data, _In_opt_ HDC hdcRef, _In_opt_ const METAFILEPICT *lpMFP)
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:927
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
UINT WINAPI GetEnhMetaFileHeader(_In_ HENHMETAFILE hemf, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPENHMETAHEADER lpEnhMetaHeader)
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
GLuint res
Definition: glext.h:9613
struct CFHEADER header
Definition: fdi.c:109

Referenced by checkConvertedFrameAndBounds(), and test_SetWinMetaFileBits().

◆ getwinmetafilebits()

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

Definition at line 3370 of file metafile.c.

3371 {
3372  HENHMETAFILE emf, emf2;
3373  HDC display_dc, emf_dc;
3374  ENHMETAHEADER *enh_header, *enh2_header;
3375  UINT size, emf_size, i, emf2_size;
3376  WORD check = 0;
3377  DWORD rec_num = 0;
3378  METAHEADER *mh = NULL;
3379  METARECORD *rec;
3380  INT horz_res, vert_res, horz_size, vert_size;
3381  INT curve_caps, line_caps, poly_caps;
3382  METAFILEPICT mfp;
3383 
3384  display_dc = GetDC(NULL);
3385  ok(display_dc != NULL, "display_dc is NULL\n");
3386 
3387  horz_res = GetDeviceCaps(display_dc, HORZRES);
3388  vert_res = GetDeviceCaps(display_dc, VERTRES);
3389  horz_size = GetDeviceCaps(display_dc, HORZSIZE);
3390  vert_size = GetDeviceCaps(display_dc, VERTSIZE);
3391 
3392  emf_dc = CreateEnhMetaFileA(display_dc, NULL, rc, NULL);
3393  ok(emf_dc != NULL, "emf_dc is NULL\n");
3394 
3395  curve_caps = GetDeviceCaps(emf_dc, CURVECAPS);
3396  ok(curve_caps == 511, "expect 511 got %d\n", curve_caps);
3397 
3398  line_caps = GetDeviceCaps(emf_dc, LINECAPS);
3399  ok(line_caps == 254, "expect 254 got %d\n", line_caps);
3400 
3401  poly_caps = GetDeviceCaps(emf_dc, POLYGONALCAPS);
3402  ok(poly_caps == 255, "expect 511 got %d\n", poly_caps);
3403 
3404  for(i = 0; i < 3000; i++) /* This is enough to take emf_size > 0xffff */
3405  Rectangle(emf_dc, 0, 0, 1000, 20);
3406  emf = CloseEnhMetaFile(emf_dc);
3407  ok(emf != NULL, "emf is NULL\n");
3408 
3409  emf_size = GetEnhMetaFileBits(emf, 0, NULL);
3410  enh_header = HeapAlloc(GetProcessHeap(), 0, emf_size);
3411  emf_size = GetEnhMetaFileBits(emf, emf_size, (BYTE*)enh_header);
3412  DeleteEnhMetaFile(emf);
3413  /* multiply szlDevice.cx by scale, when scale != 1 the recording and playback dcs
3414  have different resolutions */
3415  enh_header->szlDevice.cx *= scale;
3416  emf = SetEnhMetaFileBits(emf_size, (BYTE*)enh_header);
3417  ok(emf != NULL, "emf is NULL\n");
3418  ok(EqualRect((RECT*)&enh_header->rclFrame, rc), "Frame rectangles differ\n");
3419 
3421  ok(size ||
3422  broken(size == 0), /* some versions of winxp fail for some reason */
3423  "GetWinMetaFileBits returns 0\n");
3424  if(!size) goto end;
3425  mh = HeapAlloc(GetProcessHeap(), 0, size);
3426  GetWinMetaFileBits(emf, size, (BYTE*)mh, mode, display_dc);
3427 
3428  for(i = 0; i < size / 2; i++) check += ((WORD*)mh)[i];
3429  ok(check == 0, "check %04x\n", check);
3430 
3431  rec = (METARECORD*)(mh + 1);
3432 
3433  while(rec->rdSize && rec->rdFunction)
3434  {
3435  const DWORD chunk_size = 0x2000;
3436  DWORD mfcomment_chunks = (emf_size + chunk_size - 1) / chunk_size;
3437 
3438  if(rec_num < mfcomment_chunks)
3439  {
3440  DWORD this_chunk_size = chunk_size;
3441 
3442  if(rec_num == mfcomment_chunks - 1)
3443  this_chunk_size = emf_size - rec_num * chunk_size;
3444 
3445  ok(rec->rdSize == (this_chunk_size + 44) / 2, "%04x: got %04x expected %04x\n", rec_num, rec->rdSize, (this_chunk_size + 44) / 2);
3446  ok(rec->rdFunction == META_ESCAPE, "%04x: got %04x\n", rec_num, rec->rdFunction);
3447  if(rec->rdSize < (this_chunk_size + 44) / 2) break;
3448  ok(rec->rdParm[0] == MFCOMMENT, "got %04x\n", rec->rdParm[0]);
3449  ok(rec->rdParm[1] == this_chunk_size + 34, "got %04x %x\n", rec->rdParm[1], emf_size + 34);
3450  ok(rec->rdParm[2] == 0x4d57, "got %04x\n", rec->rdParm[2]); /* WMFC */
3451  ok(rec->rdParm[3] == 0x4346, "got %04x\n", rec->rdParm[3]); /* " */
3452  ok(rec->rdParm[4] == 1, "got %04x\n", rec->rdParm[4]);
3453  ok(rec->rdParm[5] == 0, "got %04x\n", rec->rdParm[5]);
3454  ok(rec->rdParm[6] == 0, "got %04x\n", rec->rdParm[6]);
3455  ok(rec->rdParm[7] == 1, "got %04x\n", rec->rdParm[7]);
3456  /* parm[8] is the checksum, tested above */
3457  if(rec_num > 0) ok(rec->rdParm[8] == 0, "got %04x\n", rec->rdParm[8]);
3458  ok(rec->rdParm[9] == 0, "got %04x\n", rec->rdParm[9]);
3459  ok(rec->rdParm[10] == 0, "got %04x\n", rec->rdParm[10]);
3460  ok(rec->rdParm[11] == mfcomment_chunks, "got %04x\n", rec->rdParm[11]); /* num chunks */
3461  ok(rec->rdParm[12] == 0, "got %04x\n", rec->rdParm[12]);
3462  ok(rec->rdParm[13] == this_chunk_size, "got %04x expected %04x\n", rec->rdParm[13], this_chunk_size);
3463  ok(rec->rdParm[14] == 0, "got %04x\n", rec->rdParm[14]);
3464  ok(*(DWORD*)(rec->rdParm + 15) == emf_size - this_chunk_size - rec_num * chunk_size, "got %08x\n", *(DWORD*)(rec->rdParm + 15)); /* DWORD size remaining after current chunk */
3465  ok(*(DWORD*)(rec->rdParm + 17) == emf_size, "got %08x emf_size %08x\n", *(DWORD*)(rec->rdParm + 17), emf_size);
3466  ok(!memcmp(rec->rdParm + 19, (char*)enh_header + rec_num * chunk_size, this_chunk_size), "bits mismatch\n");
3467  }
3468 
3469  else if(rec_num == mfcomment_chunks)
3470  {
3471  ok(rec->rdFunction == META_SETMAPMODE, "got %04x\n", rec->rdFunction);
3472  ok(rec->rdParm[0] == mode, "got %04x\n", rec->rdParm[0]);
3473  }
3474  else if(rec_num == mfcomment_chunks + 1)
3475  {
3476  POINT pt;
3477  ok(rec->rdFunction == META_SETWINDOWORG, "got %04x\n", rec->rdFunction);
3478  switch(mode)
3479  {
3480  case MM_TEXT:
3481  case MM_ISOTROPIC:
3482  case MM_ANISOTROPIC:
3483  pt.y = MulDiv(rc->top, vert_res, vert_size * 100) + 1;
3484  pt.x = MulDiv(rc->left, horz_res, horz_size * 100);
3485  break;
3486  case MM_LOMETRIC:
3487  pt.y = MulDiv(-rc->top, 1, 10) + 1;
3488  pt.x = MulDiv( rc->left, 1, 10);
3489  break;
3490  case MM_HIMETRIC:
3491  pt.y = -rc->top + 1;
3492  pt.x = (rc->left >= 0) ? rc->left : rc->left + 1; /* strange but true */
3493  break;
3494  case MM_LOENGLISH:
3495  pt.y = MulDiv(-rc->top, 10, 254) + 1;
3496  pt.x = MulDiv( rc->left, 10, 254);
3497  break;
3498  case MM_HIENGLISH:
3499  pt.y = MulDiv(-rc->top, 100, 254) + 1;
3500  pt.x = MulDiv( rc->left, 100, 254);
3501  break;
3502  case MM_TWIPS:
3503  pt.y = MulDiv(-rc->top, 72 * 20, 2540) + 1;
3504  pt.x = MulDiv( rc->left, 72 * 20, 2540);
3505  break;
3506  default:
3507  pt.x = pt.y = 0;
3508  }
3509  ok(near_match((short)rec->rdParm[0], pt.y), "got %d expect %d\n", (short)rec->rdParm[0], pt.y);
3510  ok(near_match((short)rec->rdParm[1], pt.x), "got %d expect %d\n", (short)rec->rdParm[1], pt.x);
3511  }
3512  if(rec_num == mfcomment_chunks + 2)
3513  {
3514  ok(rec->rdFunction == META_SETWINDOWEXT, "got %04x\n", rec->rdFunction);
3515  ok(near_match((short)rec->rdParm[0], MulDiv(rc->bottom - rc->top, vert_res, vert_size * 100)),
3516  "got %d\n", (short)rec->rdParm[0]);
3517  ok(near_match((short)rec->rdParm[1], MulDiv(rc->right - rc->left, horz_res, horz_size * 100)),
3518  "got %d\n", (short)rec->rdParm[1]);
3519  }
3520 
3521  rec_num++;
3522  rec = (METARECORD*)((WORD*)rec + rec->rdSize);
3523  }
3524 
3525  /* Show that we get the original back when we do the reverse conversion.
3526  mfp is ignored in this case. */
3527  mfp.mm = MM_ISOTROPIC;
3528  mfp.xExt = 0xcafe;
3529  mfp.yExt = 0xbeef;
3530  emf2 = SetWinMetaFileBits( size, (BYTE*)mh, NULL, &mfp );
3531  ok( !!emf2, "got NULL\n" );
3532  emf2_size = GetEnhMetaFileBits( emf2, 0, NULL );
3533  enh2_header = HeapAlloc( GetProcessHeap(), 0, emf2_size );
3534  emf2_size = GetEnhMetaFileBits( emf2, emf2_size, (BYTE*)enh2_header );
3535  ok( emf_size == emf2_size, "%d %d\n", emf_size, emf2_size );
3536  ok( !memcmp( enh_header, enh2_header, emf_size ), "mismatch\n" );
3537  HeapFree( GetProcessHeap(), 0, enh2_header );
3538  DeleteEnhMetaFile( emf2 );
3539 
3540 end:
3541  HeapFree(GetProcessHeap(), 0, mh);
3542  HeapFree(GetProcessHeap(), 0, enh_header);
3543  DeleteEnhMetaFile(emf);
3544 
3546 }
#define MM_ISOTROPIC
Definition: wingdi.h:869
#define HORZRES
Definition: wingdi.h:715
SIZEL szlDevice
Definition: wingdi.h:2328
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HDC WINAPI GetDC(_In_opt_ HWND)
#define pt(x, y)
Definition: drawing.c:79
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HENHMETAFILE WINAPI SetEnhMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *pb)
WORD rdFunction
Definition: wingdi.h:2341
#define POLYGONALCAPS
Definition: wingdi.h:778
GLuint GLuint end
Definition: gl.h:1545
LONG left
Definition: windef.h:291
#define MFCOMMENT
Definition: wingdi.h:1007
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
DWORD rdSize
Definition: wingdi.h:2340
HENHMETAFILE WINAPI SetWinMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *lpMeta16Data, _In_opt_ HDC hdcRef, _In_opt_ const METAFILEPICT *lpMFP)
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
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
static HDC display_dc
Definition: main.c:34
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
LONG cx
Definition: windef.h:319
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
#define META_SETWINDOWORG
Definition: wingdi.h:220
GLsizeiptr size
Definition: glext.h:5919
RECTL rclFrame
Definition: wingdi.h:2318
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define META_ESCAPE
Definition: wingdi.h:247
unsigned short WORD
Definition: ntddk_ex.h:93
#define MM_LOMETRIC
Definition: wingdi.h:871
unsigned long DWORD
Definition: ntddk_ex.h:95
void check(CONTEXT *pContext)
Definition: NtContinue.c:61
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
#define MM_LOENGLISH
Definition: wingdi.h:870
#define MM_ANISOTROPIC
Definition: wingdi.h:866
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define MM_TWIPS
Definition: wingdi.h:873
unsigned char BYTE
Definition: mem.h:68
GLenum mode
Definition: glext.h:6217
WORD rdParm[1]
Definition: wingdi.h:2342
#define broken(x)
Definition: _sntprintf.h:21
#define HORZSIZE
Definition: wingdi.h:713
#define VERTSIZE
Definition: wingdi.h:714
#define META_SETMAPMODE
Definition: wingdi.h:212
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define LINECAPS
Definition: wingdi.h:769
UINT WINAPI GetWinMetaFileBits(HENHMETAFILE hemf, UINT cbBuffer, LPBYTE lpbBuffer, INT map_mode, HDC hdcRef)
Definition: metafile.c:1259
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define VERTRES
Definition: wingdi.h:716
#define MM_HIMETRIC
Definition: wingdi.h:868
#define MM_TEXT
Definition: wingdi.h:872
static BOOL near_match(int x, int y)
Definition: metafile.c:3360
LONG bottom
Definition: windef.h:294
#define CURVECAPS
Definition: wingdi.h:758
#define META_SETWINDOWEXT
Definition: wingdi.h:221
#define MM_HIENGLISH
Definition: wingdi.h:867
#define HeapFree(x, y, z)
Definition: compat.h:394
#define MulDiv(x, y, z)
Definition: gdifloat.h:86

Referenced by test_GetWinMetaFileBits().

◆ init_function_pointers()

static void init_function_pointers ( void  )
static

Definition at line 52 of file metafile.c.

53 {
54  HMODULE hGDI;
55 
56  pGetRelAbs = NULL;
57  pSetRelAbs = NULL;
58 
59  hGDI = GetModuleHandleA("gdi32.dll");
60  assert(hGDI);
65 }
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetRelAbs(_In_ HDC hdc, _In_ DWORD dwIgnore)
Definition: dc.c:709
COLORREF WINAPI SetDCBrushColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:881
smooth NULL
Definition: ftsmooth.c:416
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define GDI_GET_PROC(func)
Definition: metafile.c:47
INT WINAPI SetRelAbs(HDC, INT)
Definition: dc.c:722
COLORREF WINAPI SetDCPenColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:917

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 2599 of file metafile.c.

2600 {
2601  return abs(rc1->left - rc2->left) <= 1 &&
2602  abs(rc1->top - rc2->top) <= 1 &&
2603  abs(rc1->right - rc2->right) <= 1 &&
2604  abs(rc1->bottom - rc2->bottom) <= 1;
2605 }
#define abs(i)
Definition: fconv.c:206
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
LONG bottom
Definition: windef.h:294
static const WCHAR rc2[]
Definition: oid.c:1216

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 1754 of file metafile.c.

1756 {
1757  int diff;
1758 
1759  ok(emr1->iType == emr2->iType, "%s: emr->iType %u != %u\n",
1760  desc, emr1->iType, emr2->iType);
1761 
1762  ok(emr1->nSize == emr2->nSize, "%s: emr->nSize %u != %u\n",
1763  desc, emr1->nSize, emr2->nSize);
1764 
1765  /* iType and nSize mismatches are fatal */
1766  if (emr1->iType != emr2->iType || emr1->nSize != emr2->nSize) return FALSE;
1767 
1768  /* contents of EMR_GDICOMMENT are not interesting */
1769  if (emr1->iType == EMR_GDICOMMENT) return TRUE;
1770 
1771  /* different Windows versions setup DC scaling differently when
1772  * converting an old style metafile to an EMF.
1773  */
1774  if (ignore_scaling && (emr1->iType == EMR_SETWINDOWEXTEX ||
1775  emr1->iType == EMR_SETVIEWPORTEXTEX))
1776  return TRUE;
1777 
1778  if (emr1->iType == EMR_EXTTEXTOUTW || emr1->iType == EMR_EXTTEXTOUTA)
1779  {
1780  EMREXTTEXTOUTW *eto1, *eto2;
1781 
1782  eto1 = HeapAlloc(GetProcessHeap(), 0, emr1->nSize);
1783  memcpy(eto1, emr1, emr1->nSize);
1784  eto2 = HeapAlloc(GetProcessHeap(), 0, emr2->nSize);
1785  memcpy(eto2, emr2, emr2->nSize);
1786 
1787  /* different Windows versions setup DC scaling differently */
1788  eto1->exScale = eto1->eyScale = 0.0;
1789  eto2->exScale = eto2->eyScale = 0.0;
1790 
1791  diff = memcmp(eto1, eto2, emr1->nSize);
1792  if (diff)
1793  {
1794  dump_EMREXTTEXTOUT(eto1);
1795  dump_EMREXTTEXTOUT(eto2);
1796  }
1797  HeapFree(GetProcessHeap(), 0, eto1);
1798  HeapFree(GetProcessHeap(), 0, eto2);
1799  }
1800  else if (emr1->iType == EMR_EXTSELECTCLIPRGN && !lstrcmpA(desc, "emf_clipping"))
1801  {
1802  /* We have to take care of NT4 differences here */
1803  diff = memcmp(emr1, emr2, emr1->nSize);
1804  if (diff)
1805  {
1806  ENHMETARECORD *emr_nt4;
1807 
1808  emr_nt4 = HeapAlloc(GetProcessHeap(), 0, emr2->nSize);
1809  memcpy(emr_nt4, emr2, emr2->nSize);
1810  /* Correct the nRgnSize field */
1811  emr_nt4->dParm[5] = sizeof(RECT);
1812 
1813  diff = memcmp(emr1, emr_nt4, emr1->nSize);
1814  if (!diff)
1815  win_skip("Catered for NT4 differences\n");
1816 
1817  HeapFree(GetProcessHeap(), 0, emr_nt4);
1818  }
1819  }
1820  else if (emr1->iType == EMR_POLYBEZIERTO16 || emr1->iType == EMR_POLYBEZIER16)
1821  {
1822  EMRPOLYBEZIER16 *eto1, *eto2;
1823 
1824  eto1 = (EMRPOLYBEZIER16*)emr1;
1825  eto2 = (EMRPOLYBEZIER16*)emr2;
1826 
1827  diff = eto1->cpts != eto2->cpts;
1828  if(!diff)
1829  diff = memcmp(eto1->apts, eto2->apts, eto1->cpts * sizeof(POINTS));
1830  }
1831  else if (emr1->iType == EMR_POLYBEZIERTO || emr1->iType == EMR_POLYBEZIER)
1832  {
1833  EMRPOLYBEZIER *eto1, *eto2;
1834 
1835  eto1 = (EMRPOLYBEZIER*)emr1;
1836  eto2 = (EMRPOLYBEZIER*)emr2;
1837 
1838  diff = eto1->cptl != eto2->cptl;
1839  if(!diff)
1840  diff = memcmp(eto1->aptl, eto2->aptl, eto1->cptl * sizeof(POINTL));
1841  }
1842  else
1843  diff = memcmp(emr1, emr2, emr1->nSize);
1844 
1845  ok(diff == 0, "%s: contents of record %u don't match\n", desc, emr1->iType);
1846 
1847  if (diff)
1848  {
1849  dump_emf_record(emr1, "expected bits");
1850  dump_emf_record(emr2, "actual bits");
1851  }
1852 
1853  return diff == 0; /* report all non-fatal record mismatches */
1854 }
#define EMR_POLYBEZIERTO16
Definition: wingdi.h:161
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
DWORD cptl
Definition: wingdi.h:2105
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
static void dump_EMREXTTEXTOUT(const EMREXTTEXTOUTW *eto)
Definition: metafile.c:1738
DWORD dParm[1]
Definition: wingdi.h:2347
struct tagRECT RECT
static void dump_emf_record(const ENHMETARECORD *emr, const char *desc)
Definition: metafile.c:1716
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define EMR_EXTTEXTOUTW
Definition: wingdi.h:157
#define EMR_GDICOMMENT
Definition: wingdi.h:143
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define EMR_POLYBEZIER16
Definition: wingdi.h:158
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define EMR_POLYBEZIER
Definition: wingdi.h:76
#define EMR_SETWINDOWEXTEX
Definition: wingdi.h:83
#define EMR_EXTTEXTOUTA
Definition: wingdi.h:156
POINTL aptl[1]
Definition: wingdi.h:2106
#define ok(value,...)
Definition: atltest.h:57
#define EMR_SETVIEWPORTEXTEX
Definition: wingdi.h:85
POINTS apts[1]
Definition: wingdi.h:2112
#define win_skip
Definition: test.h:141
#define HeapFree(x, y, z)
Definition: compat.h:394
#define EMR_EXTSELECTCLIPRGN
Definition: wingdi.h:148
#define EMR_POLYBEZIERTO
Definition: wingdi.h:79

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

Definition at line 1556 of file metafile.c.

1558 {
1559  trace("hdc %p, mr->rdFunction %04x, mr->rdSize %u, param %p\n",
1560  hdc, mr->rdFunction, mr->rdSize, (void *)param);
1561  return TRUE;
1562 }
#define TRUE
Definition: types.h:120
WORD rdFunction
Definition: wingdi.h:2341
DWORD rdSize
Definition: wingdi.h:2340
#define trace
Definition: atltest.h:70
GLfloat param
Definition: glext.h:5796
HDC hdc
Definition: main.c:9

Referenced by create_converted_emf(), test_CopyMetaFile(), test_mf_Blank(), test_mf_DCBrush(), test_mf_ExtTextOut_on_path(), test_mf_GetPath(), test_mf_Graphics(), test_mf_PatternBrush(), and test_SetMetaFileBits().

◆ near_match()

static BOOL near_match ( int  x,
int  y 
)
static

Definition at line 3360 of file metafile.c.

3361 {
3362  int epsilon = min(abs(x), abs(y));
3363 
3364  epsilon = max(epsilon/100, 2);
3365 
3366  if(x < y - epsilon || x > y + epsilon) return FALSE;
3367  return TRUE;
3368 }
#define abs(i)
Definition: fconv.c:206
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define min(a, b)
Definition: monoChain.cc:55
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by getwinmetafilebits().

◆ rgn_rect_count()

static DWORD rgn_rect_count ( HRGN  hrgn)
static

Definition at line 67 of file metafile.c.

68 {
69  DWORD size;
70  RGNDATA *data;
71 
72  if (!hrgn) return 0;
73  if (!(size = GetRegionData(hrgn, 0, NULL))) return 0;
74  if (!(data = HeapAlloc(GetProcessHeap(), 0, size))) return 0;
76  size = data->rdh.nCount;
78  return size;
79 }
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static HRGN hrgn
Definition: win.c:55
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_emf_clipping().

◆ 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 495 of file metafile.c.

497 {
498  BOOL ret;
499  XFORM xform;
500  POINT pt;
501  SIZE size;
502  static int save_state;
503  static int restore_no;
504  static int select_no;
505 
506  trace("hdc %p, emr->iType %d, emr->nSize %d, param %p\n",
507  hdc, emr->iType, emr->nSize, (void *)param);
508 
509  SetLastError(0xdeadbeef);
510  ret = GetWorldTransform(hdc, &xform);
512  {
513  ret = GetWindowOrgEx(hdc, &pt);
514  ok(ret, "GetWindowOrgEx error %u\n", GetLastError());
515  trace("window org (%d,%d)\n", pt.x, pt.y);
516  ret = GetViewportOrgEx(hdc, &pt);
517  ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
518  trace("vport org (%d,%d)\n", pt.x, pt.y);
519  ret = GetWindowExtEx(hdc, &size);
520  ok(ret, "GetWindowExtEx error %u\n", GetLastError());
521  trace("window ext (%d,%d)\n", size.cx, size.cy);
523  ok(ret, "GetViewportExtEx error %u\n", GetLastError());
524  trace("vport ext (%d,%d)\n", size.cx, size.cy);
525  }
526  else
527  {
528  ok(ret, "GetWorldTransform error %u\n", GetLastError());
529  trace("eM11 %f, eM22 %f, eDx %f, eDy %f\n", xform.eM11, xform.eM22, xform.eDx, xform.eDy);
530  }
531 
532  PlayEnhMetaFileRecord(hdc, handle_table, emr, n_objs);
533 
534  switch (emr->iType)
535  {
536  case EMR_HEADER:
537  {
538  static RECT exp_bounds = { 0, 0, 150, 150 };
539  RECT bounds;
540  const ENHMETAHEADER *emf = (const ENHMETAHEADER *)emr;
541 
542  trace("bounds %d,%d-%d,%d, frame %d,%d-%d,%d\n",
543  emf->rclBounds.left, emf->rclBounds.top, emf->rclBounds.right, emf->rclBounds.bottom,
544  emf->rclFrame.left, emf->rclFrame.top, emf->rclFrame.right, emf->rclFrame.bottom);
545  trace("mm %d x %d, device %d x %d\n", emf->szlMillimeters.cx, emf->szlMillimeters.cy,
546  emf->szlDevice.cx, emf->szlDevice.cy);
547 
548  SetRect(&bounds, emf->rclBounds.left, emf->rclBounds.top, emf->rclBounds.right, emf->rclBounds.bottom);
549  ok(EqualRect(&bounds, &exp_bounds), "wrong bounds\n");
550 
551  save_state = 0;
552  restore_no = 0;
553  select_no = 0;
554  check_dc_state(hdc, restore_no, 0, 0, 1, 1, 0, 0, 1, 1);
555  break;
556  }
557 
558  case EMR_LINETO:
559  {
560  const EMRLINETO *line = (const EMRLINETO *)emr;
561  trace("EMR_LINETO %d,%d\n", line->ptl.x, line->ptl.x);
562  break;
563  }
564  case EMR_SETWINDOWORGEX:
565  {
566  const EMRSETWINDOWORGEX *org = (const EMRSETWINDOWORGEX *)emr;
567  trace("EMR_SETWINDOWORGEX: %d,%d\n", org->ptlOrigin.x, org->ptlOrigin.y);
568  break;
569  }
570  case EMR_SETWINDOWEXTEX:
571  {
572  const EMRSETWINDOWEXTEX *ext = (const EMRSETWINDOWEXTEX *)emr;
573  trace("EMR_SETWINDOWEXTEX: %d,%d\n", ext->szlExtent.cx, ext->szlExtent.cy);
574  break;
575  }
577  {
578  const EMRSETVIEWPORTORGEX *org = (const EMRSETVIEWPORTORGEX *)emr;
579  trace("EMR_SETVIEWPORTORGEX: %d,%d\n", org->ptlOrigin.x, org->ptlOrigin.y);
580  break;
581  }
583  {
584  const EMRSETVIEWPORTEXTEX *ext = (const EMRSETVIEWPORTEXTEX *)emr;
585  trace("EMR_SETVIEWPORTEXTEX: %d,%d\n", ext->szlExtent.cx, ext->szlExtent.cy);
586  break;
587  }
588  case EMR_SAVEDC:
589  save_state++;
590  trace("EMR_SAVEDC\n");
591  break;
592 
593  case EMR_RESTOREDC:
594  {
595  const EMRRESTOREDC *restoredc = (const EMRRESTOREDC *)emr;
596  trace("EMR_RESTOREDC: %d\n", restoredc->iRelative);
597 
598  switch(++restore_no)
599  {
600  case 1:
601  ok(restoredc->iRelative == -1, "first restore %d\n", restoredc->iRelative);
602  check_dc_state(hdc, restore_no, -2, -2, 8192, 8192, 20, 20, 20479, 20478);
603  break;
604  case 2:
605  ok(restoredc->iRelative == -3, "second restore %d\n", restoredc->iRelative);
606  check_dc_state(hdc, restore_no, 0, 0, 16384, 16384, 0, 0, 17873, 17872);
607  break;
608  case 3:
609  ok(restoredc->iRelative == -2, "third restore %d\n", restoredc->iRelative);
610  check_dc_state(hdc, restore_no, -4, -4, 32767, 32767, 40, 40, 3276, 3276);
611  break;
612  }
613  ok(restore_no <= 3, "restore_no %d\n", restore_no);
614  save_state += restoredc->iRelative;
615  break;
616  }
617  case EMR_SELECTOBJECT:
618  {
619  const EMRSELECTOBJECT *selectobj = (const EMRSELECTOBJECT*)emr;
620  trace("EMR_SELECTOBJECT: %x\n",selectobj->ihObject);
621  select_no ++;
622  break;
623  }
624  case EMR_EOF:
625  ok(save_state == 0, "EOF save_state %d\n", save_state);
626  ok(select_no == 3, "Too many/few selects %i\n",select_no);
627  break;
628  }
629 
630  SetLastError(0xdeadbeef);
631  ret = GetWorldTransform(hdc, &xform);
633  {
634  ret = GetWindowOrgEx(hdc, &pt);
635  ok(ret, "GetWindowOrgEx error %u\n", GetLastError());
636  trace("window org (%d,%d)\n", pt.x, pt.y);
637  ret = GetViewportOrgEx(hdc, &pt);
638  ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
639  trace("vport org (%d,%d)\n", pt.x, pt.y);
640  ret = GetWindowExtEx(hdc, &size);
641  ok(ret, "GetWindowExtEx error %u\n", GetLastError());
642  trace("window ext (%d,%d)\n", size.cx, size.cy);
644  ok(ret, "GetViewportExtEx error %u\n", GetLastError());
645  trace("vport ext (%d,%d)\n", size.cx, size.cy);
646  }
647  else
648  {
649  ok(ret, "GetWorldTransform error %u\n", GetLastError());
650  trace("eM11 %f, eM22 %f, eDx %f, eDy %f\n", xform.eM11, xform.eM22, xform.eDx, xform.eDy);
651  }
652 
653  return 1;
654 }
SIZEL szlDevice
Definition: wingdi.h:2328
BOOL WINAPI GetWindowOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:439
#define pt(x, y)
Definition: drawing.c:79
SIZEL szlMillimeters
Definition: wingdi.h:2329
#define EMR_LINETO
Definition: wingdi.h:128
long bottom
Definition: polytest.cpp:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define EMR_SELECTOBJECT
Definition: wingdi.h:111
#define EMR_SETVIEWPORTORGEX
Definition: wingdi.h:86
long right
Definition: polytest.cpp:53
#define EMR_EOF
Definition: wingdi.h:88
static char org[]
Definition: encode.c:7456
unsigned int BOOL
Definition: ntddk_ex.h:94
FLOAT eDx
Definition: wingdi.h:1720
long top
Definition: polytest.cpp:53
#define EMR_RESTOREDC
Definition: wingdi.h:108
BOOL WINAPI PlayEnhMetaFileRecord(_In_ HDC hdc, _In_reads_(cht) LPHANDLETABLE pht, _In_ CONST ENHMETARECORD *pmr, _In_ UINT cht)
char ext[3]
Definition: mkdosfs.c:358
LONG cx
Definition: windef.h:319
Definition: parser.c:48
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:438
long left
Definition: polytest.cpp:53
BOOL WINAPI GetWorldTransform(_In_ HDC, _Out_ LPXFORM)
Definition: coord.c:278
GLsizeiptr size
Definition: glext.h:5919
RECTL rclFrame
Definition: wingdi.h:2318
#define trace
Definition: atltest.h:70
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:351
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:411
GLfloat param
Definition: glext.h:5796
BOOL WINAPI GetViewportOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:383
#define SetLastError(x)
Definition: compat.h:409
int ret
FLOAT eM11
Definition: wingdi.h:1716
HDC hdc
Definition: main.c:9
#define EMR_HEADER
Definition: wingdi.h:75
#define EMR_SETWINDOWEXTEX
Definition: wingdi.h:83
RECTL rclBounds
Definition: wingdi.h:2317
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define ok(value,...)
Definition: atltest.h:57
FLOAT eM22
Definition: wingdi.h:1719
FLOAT eDy
Definition: wingdi.h:1721
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define EMR_SETVIEWPORTEXTEX
Definition: wingdi.h:85
LONG iRelative
Definition: wingdi.h:2146
#define EMR_SETWINDOWORGEX
Definition: wingdi.h:84
LONG cy
Definition: windef.h:320
#define EMR_SAVEDC
Definition: wingdi.h:107

Referenced by test_SaveDC().

◆ set_rotation_xform()

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

Definition at line 4037 of file metafile.c.

4038 {
4039  out->eM11 = cosf(rad);
4040  out->eM12 = -1.f * sinf(rad);
4041  out->eM21 = sinf(rad);
4042  out->eM22 = cosf(rad);
4043  out->eDx = dx;
4044  out->eDy = dy;
4045 }
GLint dy
Definition: linetemp.h:97
#define cosf
Definition: cosf.c:6
static FILE * out
Definition: regtests2xml.c:44
GLint dx
Definition: linetemp.h:97
#define sinf
Definition: sinf.c:6

Referenced by enum_emf_WorldTransform(), and test_emf_WorldTransform().

◆ START_TEST()

START_TEST ( metafile  )

Definition at line 4289 of file metafile.c.

4290 {
4292 
4293  /* For enhanced metafiles (enhmfdrv) */
4294  test_ExtTextOut();
4296  test_SaveDC();
4297  test_emf_BitBlt();
4298  test_emf_DCBrush();
4302  test_emf_paths();
4306 
4307  /* For win-format metafiles (mfdrv) */
4308  test_mf_SaveDC();
4309  test_mf_Blank();
4310  test_mf_Graphics();
4312  test_mf_DCBrush();
4316  test_mf_clipping();
4317  test_mf_GetPath();
4318 
4319  /* For metafile conversions */
4323 
4324  test_gdiis();
4326 }
static void test_mf_SaveDC(void)
Definition: metafile.c:865
static void test_ExtTextOutScale(void)
Definition: metafile.c:334
static void test_mf_clipping(void)
Definition: metafile.c:2889
static void test_mf_DCBrush(void)
Definition: metafile.c:2342
static void test_emf_DCBrush(void)
Definition: metafile.c:2014
static void test_mf_Graphics(void)
Definition: metafile.c:2251
static void test_mf_conversions(void)
Definition: metafile.c:3072
static void test_emf_PolyPolyline(void)
Definition: metafile.c:3939
static void test_emf_WorldTransform(void)
Definition: metafile.c:4227
static void test_CopyMetaFile(void)
Definition: metafile.c:2102
static void test_emf_GradientFill(void)
Definition: metafile.c:3993
static void test_ExtTextOut(void)
Definition: metafile.c:179
static void test_mf_PatternBrush(void)
Definition: metafile.c:2296
static void test_SetWinMetaFileBits(void)
Definition: metafile.c:3215
static void test_emf_clipping(void)
Definition: metafile.c:2713
static void test_SetEnhMetaFileBits(void)
Definition: metafile.c:3626
static void test_mf_GetPath(void)
Definition: metafile.c:2959
static void test_GetWinMetaFileBits(void)
Definition: metafile.c:3548
static void test_emf_BitBlt(void)
Definition: metafile.c:1937
static void test_emf_ExtTextOut_on_path(void)
Definition: metafile.c:2423
static void test_emf_polybezier(void)
Definition: metafile.c:3677
static void test_mf_ExtTextOut_on_path(void)
Definition: metafile.c:2389
static void init_function_pointers(void)
Definition: metafile.c:52
static void test_mf_Blank(void)
Definition: metafile.c:2068
static void test_SaveDC(void)
Definition: metafile.c:656
static void test_gdiis(void)
Definition: metafile.c:3580
static void test_SetMetaFileBits(void)
Definition: metafile.c:2151
static void test_emf_paths(void)
Definition: metafile.c:3844

◆ test_CopyMetaFile()

static void test_CopyMetaFile ( void  )
static

Definition at line 2102 of file metafile.c.

2103 {
2104  HDC hdcMetafile;
2105  HMETAFILE hMetafile, hmf_copy;
2106  BOOL ret;
2107  char temp_path[MAX_PATH];
2108  char mf_name[MAX_PATH];
2109  INT type;
2110 
2111  hdcMetafile = CreateMetaFileA(NULL);
2112  ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
2113  trace("hdcMetafile %p\n", hdcMetafile);
2114 
2115  hMetafile = CloseMetaFile(hdcMetafile);
2116  ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
2117  type = GetObjectType(hMetafile);
2118  ok(type == OBJ_METAFILE, "CloseMetaFile created object with type %d\n", type);
2119 
2120  if (compare_mf_bits (hMetafile, MF_BLANK_BITS, sizeof(MF_BLANK_BITS),
2121  "mf_blank") != 0)
2122  {
2123  dump_mf_bits(hMetafile, "mf_Blank");
2124  EnumMetaFile(0, hMetafile, mf_enum_proc, 0);
2125  }
2126 
2128  GetTempFileNameA(temp_path, "wmf", 0, mf_name);
2129 
2130  hmf_copy = CopyMetaFileA(hMetafile, mf_name);
2131  ok(hmf_copy != 0, "CopyMetaFile error %d\n", GetLastError());
2132 
2133  type = GetObjectType(hmf_copy);
2134  ok(type == OBJ_METAFILE, "CopyMetaFile created object with type %d\n", type);
2135 
2136  ret = DeleteMetaFile(hMetafile);
2137  ok( ret, "DeleteMetaFile(%p) error %d\n", hMetafile, GetLastError());
2138 
2139  if (compare_mf_disk_bits(mf_name, MF_BLANK_BITS, sizeof(MF_BLANK_BITS), "mf_blank") != 0)
2140  {
2141  dump_mf_bits(hmf_copy, "mf_Blank");
2142  EnumMetaFile(0, hmf_copy, mf_enum_proc, 0);
2143  }
2144 
2145  ret = DeleteMetaFile(hmf_copy);
2146  ok( ret, "DeleteMetaFile(%p) error %d\n", hmf_copy, GetLastError());
2147 
2148  DeleteFileA(mf_name);
2149 }
static int compare_mf_bits(const HMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc)
Definition: metafile.c:1599
BOOL WINAPI DeleteMetaFile(HMETAFILE hmf)
Definition: metafile.c:139
HDC WINAPI CreateMetaFileA(_In_opt_ LPCSTR)
static HDC
Definition: imagelist.c:92
BOOL WINAPI EnumMetaFile(HDC hdc, HMETAFILE hmf, MFENUMPROC lpEnumFunc, LPARAM lpData)
Definition: metafile.c:464
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int32_t INT
Definition: typedefs.h:56
static const unsigned char MF_BLANK_BITS[]
Definition: metafile.c:1031
unsigned int BOOL
Definition: ntddk_ex.h:94
HMETAFILE WINAPI CopyMetaFileA(HMETAFILE hSrcMetaFile, LPCSTR lpFilename)
Definition: metafile.c:352
smooth NULL
Definition: ftsmooth.c:416
static void dump_mf_bits(const HMETAFILE mf, const char *desc)
Definition: metafile.c:1568
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static INT CALLBACK mf_enum_proc(HDC hdc, HANDLETABLE *ht, METARECORD *mr, INT nobj, LPARAM param)
Definition: metafile.c:1556
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
#define OBJ_METAFILE
Definition: objidl.idl:1417
#define trace
Definition: atltest.h:70
#define MAX_PATH
Definition: compat.h:26
int ret
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
#define ok(value,...)
Definition: atltest.h:57
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
static int compare_mf_disk_bits(LPCSTR name, const BYTE *bits, UINT bsize, const char *desc)
Definition: metafile.c:1629
char temp_path[MAX_PATH]
Definition: mspatcha.c:123

Referenced by START_TEST().

◆ test_emf_BitBlt()

static void test_emf_BitBlt ( void  )
static

Definition at line 1937 of file metafile.c.

1938 {
1939  HDC hdcDisplay, hdcMetafile, hdcBitmap;
1940  HBITMAP hBitmap, hOldBitmap;
1941  HENHMETAFILE hMetafile;
1942 #define BMP_DIM 4
1943  BITMAPINFOHEADER bmih =
1944  {
1945  sizeof(BITMAPINFOHEADER),
1946  BMP_DIM,/* biWidth */
1947  BMP_DIM,/* biHeight */
1948  1, /* biPlanes */
1949  24, /* biBitCount */
1950  BI_RGB, /* biCompression */
1951  0, /* biXPelsPerMeter */
1952  0, /* biYPelsPerMeter */
1953  0, /* biClrUsed */
1954  0, /* biClrImportant */
1955  };
1956  void *bits;
1957  XFORM xform;
1958  BOOL ret;
1959 
1960  hdcDisplay = CreateDCA("DISPLAY", NULL, NULL, NULL);
1961  ok( hdcDisplay != 0, "CreateDCA error %d\n", GetLastError() );
1962 
1963  hdcBitmap = CreateCompatibleDC(hdcDisplay);
1964  ok( hdcBitmap != 0, "CreateCompatibleDC failed\n" );
1965  ok(SetGraphicsMode(hdcBitmap, GM_ADVANCED), "SetGraphicsMode failed\n");
1966  bmih.biXPelsPerMeter = MulDiv(GetDeviceCaps(hdcDisplay, LOGPIXELSX), 100, 3937);
1967  bmih.biYPelsPerMeter = MulDiv(GetDeviceCaps(hdcDisplay, LOGPIXELSY), 100, 3937);
1968  hBitmap = CreateDIBSection(hdcDisplay, (const BITMAPINFO *)&bmih,
1969  DIB_RGB_COLORS, &bits, NULL, 0);
1970  hOldBitmap = SelectObject(hdcBitmap, hBitmap);
1971 
1972  hdcMetafile = CreateEnhMetaFileA(hdcBitmap, NULL, NULL, NULL);
1973  ok( hdcMetafile != 0, "CreateEnhMetaFileA failed\n" );
1974 
1975  /* First fill the bitmap DC with something recognizable, like BLACKNESS */
1976  ret = BitBlt(hdcBitmap, 0, 0, BMP_DIM, BMP_DIM, 0, 0, 0, BLACKNESS);
1977  ok( ret, "BitBlt(BLACKNESS) failed\n" );
1978 
1979  ret = BitBlt(hdcMetafile, 0, 0, BMP_DIM, BMP_DIM, hdcBitmap, 0, 0, SRCCOPY);
1980  ok( ret, "BitBlt(SRCCOPY) failed\n" );
1981  ret = BitBlt(hdcMetafile, 0, 0, BMP_DIM, BMP_DIM, 0, 0, 0, WHITENESS);
1982  ok( ret, "BitBlt(WHITENESS) failed\n" );
1983 
1984  ok(SetMapMode(hdcBitmap, MM_ANISOTROPIC), "SetMapMode failed\n");
1985  ok(SetWindowOrgEx(hdcBitmap, 0, 0, NULL), "SetWindowOrgEx failed\n");
1986  ok(SetWindowExtEx(hdcBitmap, 400, 400, NULL), "SetWindowExtEx failed\n");
1987  ok(SetViewportOrgEx(hdcBitmap, 0, 0, NULL), "SetViewportOrgEx failed\n");
1988  ok(SetViewportExtEx(hdcBitmap, BMP_DIM, BMP_DIM, NULL), "SetViewportExtEx failed\n");
1989  memset(&xform, 0, sizeof(xform));
1990  xform.eM11 = 0.5;
1991  xform.eM22 = 1.0;
1992  ok(SetWorldTransform(hdcBitmap, &xform), "SetWorldTransform failed\n");
1993 
1994  ret = StretchBlt(hdcMetafile, 0, 0, BMP_DIM, BMP_DIM, hdcBitmap, 0, 0, 400, 400, SRCCOPY);
1995  ok( ret, "StretchBlt(SRCCOPY) failed\n" );
1996 
1997  hMetafile = CloseEnhMetaFile(hdcMetafile);
1998  ok( hMetafile != 0, "CloseEnhMetaFile failed\n" );
1999 
2000  if(compare_emf_bits(hMetafile, EMF_BITBLT, sizeof(EMF_BITBLT),
2001  "emf_BitBlt", FALSE) != 0)
2002  {
2003  dump_emf_bits(hMetafile, "emf_BitBlt");
2004  dump_emf_records(hMetafile, "emf_BitBlt");
2005  }
2006 
2007  SelectObject(hdcBitmap, hOldBitmap);
2010  DeleteDC(hdcDisplay);
2011 #undef BMP_DIM
2012 }
#define LOGPIXELSX
Definition: wingdi.h:717
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
HDC hdcBitmap
Definition: solcreate.cpp:11
LONG biXPelsPerMeter
Definition: amvideo.idl:37
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG biYPelsPerMeter
Definition: amvideo.idl:38
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
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)
static const unsigned char EMF_BITBLT[]
Definition: metafile.c:1291
static void dump_emf_bits(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1668
BOOL WINAPI SetWorldTransform(_In_ HDC, _In_ const XFORM *)
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI SetMapMode(_In_ HDC, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc, BOOL ignore_scaling)
Definition: metafile.c:1862
static void dump_emf_records(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1692
#define BMP_DIM
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
int ret
FLOAT eM11
Definition: wingdi.h:1716
#define MM_ANISOTROPIC
Definition: wingdi.h:866
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define WHITENESS
Definition: wingdi.h:336
#define BLACKNESS
Definition: wingdi.h:322
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define ok(value,...)
Definition: atltest.h:57
FLOAT eM22
Definition: wingdi.h:1719
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
#define LOGPIXELSY
Definition: wingdi.h:718
static HBITMAP
Definition: button.c:44
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
Definition: coord.c:465
#define DIB_RGB_COLORS
Definition: wingdi.h:366
HDC WINAPI CreateDCA(_In_opt_ LPCSTR pszDriver, _In_opt_ LPCSTR pszDevice, _In_opt_ LPCSTR pszOutput, _In_opt_ const DEVMODEA *pdmInit)
#define memset(x, y, z)
Definition: compat.h:39
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
Definition: dc.c:1202
#define BI_RGB
Definition: precomp.h:34
static HBITMAP hBitmap
Definition: timezone.c:35
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
#define SRCCOPY
Definition: wingdi.h:332
#define GM_ADVANCED
Definition: wingdi.h:864

Referenced by START_TEST().

◆ test_emf_clipping()

static void test_emf_clipping ( void  )
static

Definition at line 2713 of file metafile.c.

2714 {
2715  static const RECT rc = { 0, 0, 100, 100 };
2716  RECT rc_clip = { 100, 100, 1024, 1024 };
2717  HWND hwnd;
2718  HDC hdc;
2719  HENHMETAFILE hemf;
2720  HRGN hrgn;
2721  INT ret;
2722  RECT rc_res, rc_sclip;
2723 
2724  SetLastError(0xdeadbeef);
2726  ok(hdc != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
2727 
2728  /* Need to write something to the emf, otherwise Windows won't play it back */
2729  LineTo(hdc, 1, 1);
2730 
2731  hrgn = CreateRectRgn(rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
2732  ret = SelectClipRgn(hdc, hrgn);
2733  ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
2734 
2735  BeginPath(hdc);
2736  Rectangle(hdc, rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
2737  EndPath(hdc);
2739  ok(ret, "SelectClipPath error %d\n", GetLastError());
2740 
2741  SetLastError(0xdeadbeef);
2742  hemf = CloseEnhMetaFile(hdc);
2743  ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
2744 
2745  if (compare_emf_bits(hemf, EMF_CLIPPING, sizeof(EMF_CLIPPING),
2746  "emf_clipping", FALSE) != 0)
2747  {
2748  dump_emf_bits(hemf, "emf_clipping");
2749  dump_emf_records(hemf, "emf_clipping");
2750  }
2751 
2752  DeleteObject(hrgn);
2753 
2754  /* Win9x doesn't play EMFs on invisible windows */
2755  hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
2756  0, 0, 200, 200, 0, 0, 0, NULL);
2757  ok(hwnd != 0, "CreateWindowExA error %d\n", GetLastError());
2758 
2759  hdc = GetDC(hwnd);
2760 
2761  ret = EnumEnhMetaFile(hdc, hemf, clip_emf_enum_proc, &rc_clip, &rc);
2762  ok(ret, "EnumEnhMetaFile error %d\n", GetLastError());
2763 
2764  DeleteEnhMetaFile(hemf);
2765  ReleaseDC(hwnd, hdc);
2767 
2769 
2771  hrgn = CreateRectRgn(rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom);
2773  SetRect(&rc_res, -1, -1, -1, -1);
2774  ret = GetClipBox(hdc, &rc_res);
2775  ok(ret == SIMPLEREGION, "got %d\n", ret);
2776  ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
2777  wine_dbgstr_rect(&rc_res));
2778 
2779  OffsetRect(&rc_sclip, -100, -100);
2780  ret = OffsetClipRgn(hdc, -100, -100);
2781  ok(ret == SIMPLEREGION, "got %d\n", ret);
2782  SetRect(&rc_res, -1, -1, -1, -1);
2783  ret = GetClipBox(hdc, &rc_res);
2784  ok(ret == SIMPLEREGION, "got %d\n", ret);
2785  ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
2786  wine_dbgstr_rect(&rc_res));
2787 
2788  ret = IntersectClipRect(hdc, 0, 0, 100, 100);
2789  ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION) /* XP */, "got %d\n", ret);
2790  if (ret == COMPLEXREGION)
2791  {
2792  /* XP returns COMPLEXREGION although region contains only 1 rect */
2793  ret = GetClipRgn(hdc, hrgn);
2794  ok(ret == 1, "expected 1, got %d\n", ret);
2795  ret = rgn_rect_count(hrgn);
2796  ok(ret == 1, "expected 1, got %d\n", ret);
2797  }
2798  SetRect(&rc_res, -1, -1, -1, -1);
2799  ret = GetClipBox(hdc, &rc_res);
2800  ok(ret == SIMPLEREGION, "got %d\n", ret);
2801  ok(EqualRect(&rc_res, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rc),
2802  wine_dbgstr_rect(&rc_res));
2803 
2804  SetRect(&rc_sclip, 0, 0, 100, 50);
2805  ret = ExcludeClipRect(hdc, 0, 50, 100, 100);
2806  ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION) /* XP */, "got %d\n", ret);
2807  if (ret == COMPLEXREGION)
2808  {
2809  /* XP returns COMPLEXREGION although region contains only 1 rect */
2810  ret = GetClipRgn(hdc, hrgn);
2811  ok(ret == 1, "expected 1, got %d\n", ret);
2812  ret = rgn_rect_count(hrgn);
2813  ok(ret == 1, "expected 1, got %d\n", ret);
2814  }
2815  SetRect(&rc_res, -1, -1, -1, -1);
2816  ret = GetClipBox(hdc, &rc_res);
2817  ok(ret == SIMPLEREGION, "got %d\n", ret);
2818  ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
2819  wine_dbgstr_rect(&rc_res));
2820 
2821  hemf = CloseEnhMetaFile(hdc);
2822  DeleteEnhMetaFile(hemf);
2823  DeleteObject(hrgn);
2824 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
static const unsigned char EMF_CLIPPING[]
Definition: metafile.c:2549
BOOL WINAPI EndPath(_In_ HDC)
static HDC
Definition: imagelist.c:92
static DWORD rgn_rect_count(HRGN hrgn)
Definition: metafile.c:67
BOOL WINAPI SelectClipPath(_In_ HDC, _In_ int)
#define COMPLEXREGION
Definition: wingdi.h:362
LONG top
Definition: windef.h:292
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:56
static void dump_emf_bits(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1668
#define RGN_AND
Definition: wingdi.h:355
#define SM_CXSCREEN
Definition: winuser.h:949
int WINAPI OffsetClipRgn(_In_ HDC, _In_ int, _In_ int)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EnumEnhMetaFile(_In_opt_ HDC, _In_ HENHMETAFILE, _In_ ENHMFENUMPROC, _In_opt_ PVOID, _In_opt_ LPCRECT)
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
static int CALLBACK clip_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param)
Definition: metafile.c:2607
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc, BOOL ignore_scaling)
Definition: metafile.c:1862
#define SM_CYSCREEN
Definition: winuser.h:950
static void dump_emf_records(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1692
const char * wine_dbgstr_rect(const RECT *rect)
int WINAPI GetSystemMetrics(_In_ int)
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
#define SetLastError(x)
Definition: compat.h:409
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
int ret
HDC hdc
Definition: main.c:9
static HRGN hrgn
Definition: win.c:55
#define broken(x)
Definition: _sntprintf.h:21
#define SIMPLEREGION
Definition: wingdi.h:361
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
int WINAPI ExcludeClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
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)
LONG bottom
Definition: windef.h:294
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by START_TEST().

◆ test_emf_DCBrush()

static void test_emf_DCBrush ( void  )
static

Definition at line 2014 of file metafile.c.

2015 {
2016  HDC hdcMetafile;
2017  HENHMETAFILE hMetafile;
2018  HBRUSH hBrush;
2019  HPEN hPen;
2020  BOOL ret;
2021  COLORREF color;
2022 
2023  if (!pSetDCBrushColor || !pSetDCPenColor)
2024  {
2025  win_skip( "SetDCBrush/PenColor not supported\n" );
2026  return;
2027  }
2028 
2029  hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
2030  ok( hdcMetafile != 0, "CreateEnhMetaFileA failed\n" );
2031 
2032  hBrush = SelectObject(hdcMetafile, GetStockObject(DC_BRUSH));
2033  ok(hBrush != 0, "SelectObject error %d.\n", GetLastError());
2034 
2035  hPen = SelectObject(hdcMetafile, GetStockObject(DC_PEN));
2036  ok(hPen != 0, "SelectObject error %d.\n", GetLastError());
2037 
2038  color = pSetDCBrushColor( hdcMetafile, RGB(0x55,0x55,0x55) );
2039  ok( color == 0xffffff, "SetDCBrushColor returned %x\n", color );
2040 
2041  color = pSetDCPenColor( hdcMetafile, RGB(0x33,0x44,0x55) );
2042  ok( color == 0, "SetDCPenColor returned %x\n", color );
2043 
2044  Rectangle( hdcMetafile, 10, 10, 20, 20 );
2045 
2046  color = pSetDCBrushColor( hdcMetafile, RGB(0x12,0x34,0x56) );
2047  ok( color == 0x555555, "SetDCBrushColor returned %x\n", color );
2048 
2049  hMetafile = CloseEnhMetaFile(hdcMetafile);
2050  ok( hMetafile != 0, "CloseEnhMetaFile failed\n" );
2051 
2052  if (compare_emf_bits (hMetafile, EMF_DCBRUSH_BITS, sizeof(EMF_DCBRUSH_BITS),
2053  "emf_DC_Brush", FALSE ) != 0)
2054  {
2055  dump_emf_bits(hMetafile, "emf_DC_Brush");
2056  dump_emf_records(hMetafile, "emf_DC_Brush");
2057  }
2058  ret = DeleteEnhMetaFile(hMetafile);
2059  ok( ret, "DeleteEnhMetaFile error %d\n", GetLastError());
2060  ret = DeleteObject(hBrush);
2061  ok( ret, "DeleteObject(HBRUSH) error %d\n", GetLastError());
2062  ret = DeleteObject(hPen);
2063  ok( ret, "DeleteObject(HPEN) error %d\n", GetLastError());
2064 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
static void dump_emf_bits(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1668
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint color
Definition: glext.h:6243
smooth NULL
Definition: ftsmooth.c:416
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
static const unsigned char EMF_DCBRUSH_BITS[]
Definition: metafile.c:1372
static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc, BOOL ignore_scaling)
Definition: metafile.c:1862
DWORD COLORREF
Definition: windef.h:285
static void dump_emf_records(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1692
#define RGB(r, g, b)
Definition: wingdi.h:2935
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
int ret
#define ok(value,...)
Definition: atltest.h:57
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_emf_ExtTextOut_on_path()

static void test_emf_ExtTextOut_on_path ( void  )
static

Definition at line 2423 of file metafile.c.

2424 {
2425  HWND hwnd;
2426  HDC hdcDisplay, hdcMetafile;
2427  HENHMETAFILE hMetafile;
2428  BOOL ret;
2429  LOGFONTA lf;
2430  HFONT hFont;
2431  static const INT dx[4] = { 3, 5, 8, 12 };
2432 
2433  /* Win9x doesn't play EMFs on invisible windows */
2434  hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
2435  0, 0, 200, 200, 0, 0, 0, NULL);
2436  ok(hwnd != 0, "CreateWindowExA error %d\n", GetLastError());
2437 
2438  hdcDisplay = GetDC(hwnd);
2439  ok(hdcDisplay != 0, "GetDC error %d\n", GetLastError());
2440 
2441  /* with default font */
2442  ret = BeginPath(hdcDisplay);
2443  ok(ret, "BeginPath error %d\n", GetLastError());
2444 
2445  ret = ExtTextOutA(hdcDisplay, 11, 22, 0, NULL, "Test", 4, dx);
2446  ok(ret, "ExtTextOut error %d\n", GetLastError());
2447 
2448  ret = EndPath(hdcDisplay);
2449  ok(ret, "EndPath error %d\n", GetLastError());
2450 
2451  ret = GetPath(hdcDisplay, NULL, NULL, 0);
2452  ok(!ret, "expected 0, got %d\n", ret);
2453 
2454  hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
2455  ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
2456 
2457  ret = BeginPath(hdcMetafile);
2458  ok(ret, "BeginPath error %d\n", GetLastError());
2459 
2460  ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
2461  ok(ret, "ExtTextOut error %d\n", GetLastError());
2462 
2463  ret = EndPath(hdcMetafile);
2464  ok(ret, "EndPath error %d\n", GetLastError());
2465 
2466  ret = GetPath(hdcMetafile, NULL, NULL, 0);
2467  ok(!ret, "expected 0, got %d\n", ret);
2468 
2469  hMetafile = CloseEnhMetaFile(hdcMetafile);
2470  ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError());
2471 
2472  /* this doesn't succeed yet: EMF has correct size, all EMF records
2473  * are there, but their contents don't match for different reasons.
2474  */
2476  "emf_TextOut_on_path", FALSE) != 0)
2477  {
2478  dump_emf_bits(hMetafile, "emf_TextOut_on_path");
2479  dump_emf_records(hMetafile, "emf_TextOut_on_path");
2480  }
2481 
2482  ret = DeleteEnhMetaFile(hMetafile);
2483  ok(ret, "DeleteEnhMetaFile error %d\n", GetLastError());
2484 
2485  /* with outline font */
2486  memset(&lf, 0, sizeof(lf));
2487  lf.lfCharSet = ANSI_CHARSET;
2489  lf.lfWeight = FW_DONTCARE;
2490  lf.lfHeight = 7;
2492  lstrcpyA(lf.lfFaceName, "Tahoma");
2493  hFont = CreateFontIndirectA(&lf);
2494  ok(hFont != 0, "CreateFontIndirectA error %d\n", GetLastError());
2495  hFont = SelectObject(hdcDisplay, hFont);
2496 
2497  ret = BeginPath(hdcDisplay);
2498  ok(ret, "BeginPath error %d\n", GetLastError());
2499 
2500  ret = ExtTextOutA(hdcDisplay, 11, 22, 0, NULL, "Test", 4, dx);
2501  ok(ret, "ExtTextOut error %d\n", GetLastError());
2502 
2503  ret = EndPath(hdcDisplay);
2504  ok(ret, "EndPath error %d\n", GetLastError());
2505 
2506  ret = GetPath(hdcDisplay, NULL, NULL, 0);
2507  ok(ret != 0, "expected != 0\n");
2508 
2509  SelectObject(hdcDisplay, hFont);
2510 
2511  hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
2512  ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
2513 
2514  hFont = SelectObject(hdcMetafile, hFont);
2515 
2516  ret = BeginPath(hdcMetafile);
2517  ok(ret, "BeginPath error %d\n", GetLastError());
2518 
2519  ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
2520  ok(ret, "ExtTextOut error %d\n", GetLastError());
2521 
2522  ret = EndPath(hdcMetafile);
2523  ok(ret, "EndPath error %d\n", GetLastError());
2524 
2525  ret = GetPath(hdcMetafile, NULL, NULL, 0);
2526  ok(!ret, "expected 0, got %d\n", ret);
2527 
2528  hFont = SelectObject(hdcMetafile, hFont);
2530 
2531  hMetafile = CloseEnhMetaFile(hdcMetafile);
2532  ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError());
2533 
2535  "emf_TextOut_on_path", FALSE) != 0)
2536  {
2537  dump_emf_bits(hMetafile, "emf_TextOut_outline_on_path");
2538  dump_emf_records(hMetafile, "emf_TextOut_outline_on_path");
2539  }
2540 
2541  ret = DeleteEnhMetaFile(hMetafile);
2542  ok(ret, "DeleteEnhMetaFile error %d\n", GetLastError());
2543 
2544  ret = ReleaseDC(hwnd, hdcDisplay);
2545  ok(ret, "ReleaseDC error %d\n", GetLastError());
2547 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DEFAULT_QUALITY
Definition: wingdi.h:435
HDC WINAPI GetDC(_In_opt_ HWND)
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
BOOL WINAPI EndPath(_In_ HDC)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BYTE lfCharSet
Definition: dimm.idl:50
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:56
HFONT hFont
Definition: main.c:53
static void dump_emf_bits(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1668
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG lfHeight
Definition: dimm.idl:42
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:425
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LONG lfWeight
Definition: dimm.idl:46
smooth NULL
Definition: ftsmooth.c:416
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc, BOOL ignore_scaling)
Definition: metafile.c:1862
static void dump_emf_records(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1692
int WINAPI GetPath(_In_ HDC hdc, _Out_writes_opt_(cpt) LPPOINT apt, _Out_writes_opt_(cpt) LPBYTE aj, int cpt)
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int ret
BYTE lfQuality
Definition: dimm.idl:53
static const unsigned char EMF_TEXTOUT_ON_PATH_BITS[]
Definition: metafile.c:1094
#define FW_DONTCARE
Definition: wingdi.h:367
BYTE lfClipPrecision
Definition: dimm.idl:52
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
GLint dx
Definition: linetemp.h:97
static const unsigned char EMF_TEXTOUT_OUTLINE_ON_PATH_BITS[]
Definition: metafile.c:1129
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)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
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)
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define ANSI_CHARSET
Definition: wingdi.h:382
#define WS_VISIBLE
Definition: pedump.c:620
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_emf_GradientFill()

static void test_emf_GradientFill ( void  )
static

Definition at line 3993 of file metafile.c.

3994 {
3995  HDC mf;
3996  HENHMETAFILE hemf;
3997  TRIVERTEX v[] =
3998  {
3999  { 1, 10, 0xff00, 0x8000, 0x0000, 0x8001 },
4000  { 200, 210, 0x0000, 0x0000, 0xff00, 0xff00 },
4001  { 180, 190, 0x1234, 0x5678, 0x9abc, 0xdef0 },
4002  { 300, 310, 0xff00, 0xff00, 0xff00, 0x0000 },
4003  { 400, 410, 0xff00, 0xff00, 0xff00, 0x0000 }
4004  };
4005  GRADIENT_TRIANGLE tri[] = { { 0, 1, 2 }, { 3, 1, 0 } };
4006  BOOL ret;
4007 
4008  mf = CreateEnhMetaFileA( GetDC( 0 ), NULL, NULL, NULL );
4009  ok( mf != 0, "CreateEnhMetaFileA error %d\n", GetLastError() );
4010 
4011  /* Don't test the GRADIENT_FILL_RECT_ modes since a Windows bug
4012  * means it allocates three mesh indices rather than two per
4013  * rectangle. This results in uninitialised values being written
4014  * to the EMF which is rather difficult to test against.
4015  *
4016  * Note also that the final vertex here is not required, yet it is
4017  * written to the EMF, but is not considered in the bounds
4018  * calculation.
4019  */
4020  ret = GdiGradientFill( mf, v, sizeof(v) / sizeof(v[0]), tri, sizeof(tri) / sizeof(tri[0]),
4021  GRADIENT_FILL_TRIANGLE );
4022  ok( ret, "GradientFill\n" );
4023 
4024  hemf = CloseEnhMetaFile( mf );
4025  ok( hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError() );
4026 
4028  "emf_GradientFill", FALSE ) != 0)
4029  {
4030  dump_emf_bits( hemf, "emf_GradientFill" );
4031  dump_emf_records( hemf, "emf_GradientFill" );
4032  }
4033 
4034  DeleteEnhMetaFile( hemf );
4035 }
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static void dump_emf_bits(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1668
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc, BOOL ignore_scaling)
Definition: metafile.c:1862
static void dump_emf_records(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1692
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
int ret
static const unsigned char EMF_GRADIENTFILL_BITS[]
Definition: metafile.c:1515
const GLdouble * v
Definition: gl.h:2040
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GdiGradientFill(HDC hdc, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode)

Referenced by START_TEST().

◆ test_emf_paths()

static void test_emf_paths ( void  )
static

Definition at line 3844 of file metafile.c.

3845 {
3846  POINT pts[9] = {{10, 10}, {20, 10}, {10, 20}, {20, 20}, {30, 30}, {40, 20}, {20, 30}, {20, 20}, {20, 10}};
3847  DWORD counts[2] = {2, 2};
3850  HDC hdcMetafile;
3851  HENHMETAFILE hemf;
3852  BOOL ret;
3853  int size;
3854 
3855  SetLastError(0xdeadbeef);
3856  hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
3857  ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
3858 
3859  ret = BeginPath(hdcMetafile);
3860  ok(ret, "BeginPath error %d\n", GetLastError());
3861  ret = MoveToEx(hdcMetafile, 50, 50, NULL);
3862  ok( ret, "MoveToEx error %d.\n", GetLastError());
3863  ret = LineTo(hdcMetafile, 50, 150);
3864  ok( ret, "LineTo error %d.\n", GetLastError());
3865  ret = LineTo(hdcMetafile, 150, 150);
3866  ok( ret, "LineTo error %d.\n", GetLastError());
3867  ret = LineTo(hdcMetafile, 150, 50);
3868  ok( ret, "LineTo error %d.\n", GetLastError());
3869  ret = LineTo(hdcMetafile, 50, 50);
3870  ok( ret, "LineTo error %d.\n", GetLastError());
3871  Rectangle(hdcMetafile, 10, 10, 20, 20);
3872  Arc(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21);
3873  ArcTo(hdcMetafile, 23, 23, 37, 27, 37, 27, 23, 23);
3874  Chord(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21);
3875  Pie(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21);
3876  Ellipse(hdcMetafile, 10, 10, 20, 20);
3877  RoundRect(hdcMetafile, 10, 10, 20, 20, 3, 5);
3878  Polyline(hdcMetafile, pts, 4);
3879  PolylineTo(hdcMetafile, pts, 4);
3880  PolyPolyline(hdcMetafile, pts, counts, 2);
3881  PolyDraw(hdcMetafile, pts, types, 9);
3882  AngleArc(hdcMetafile, 37, 36, 23, 90, 180);
3883  EndPath(hdcMetafile);
3884 
3885  size = GetPath(hdcMetafile, NULL, NULL, 0);
3886  ok( size == 112, "GetPath returned %d.\n", size);
3887 
3888  ret = StrokeAndFillPath( hdcMetafile );
3889  ok( ret, "StrokeAndFillPath failed err %d\n", GetLastError() );
3890  ret = StrokeAndFillPath( hdcMetafile );
3891  ok( !ret, "StrokeAndFillPath succeeded\n" );
3892 
3893  hemf = CloseEnhMetaFile(hdcMetafile);
3894  ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
3895 
3896  if (compare_emf_bits(hemf, EMF_PATH_BITS, sizeof(EMF_PATH_BITS), "test_emf_paths", FALSE) != 0)
3897  {
3898  dump_emf_bits(hemf, "test_emf_paths");
3899  dump_emf_records(hemf, "test_emf_paths");
3900  }
3901 
3902  DeleteEnhMetaFile(hemf);
3903 
3904  SetLastError(0xdeadbeef);
3905  hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
3906  ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
3907 
3908  ret = BeginPath(hdcMetafile);
3909  ok( ret, "BeginPath failed error %d\n", GetLastError() );
3910  ret = CloseFigure(hdcMetafile);
3911  ok( ret, "CloseFigure failed error %d\n", GetLastError() );
3912  ret = BeginPath(hdcMetafile);
3913  ok( ret, "BeginPath failed error %d\n", GetLastError() );
3914  ret = EndPath(hdcMetafile);
3915  ok( ret, "EndPath failed error %d\n", GetLastError() );
3916  ret = EndPath(hdcMetafile);
3917  ok( !ret, "EndPath succeeded\n" );
3918  ret = CloseFigure(hdcMetafile);
3919  ok( !ret, "CloseFigure succeeded\n" );
3920  ret = BeginPath(hdcMetafile);
3921  ok( ret, "BeginPath failed error %d\n", GetLastError() );
3922  ret = AbortPath(hdcMetafile);
3923  ok( ret, "AbortPath failed error %d\n", GetLastError() );
3924  ret = AbortPath(hdcMetafile);
3925  ok( ret, "AbortPath failed error %d\n", GetLastError() );
3926 
3927  hemf = CloseEnhMetaFile(hdcMetafile);
3928  ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
3929 
3930  if (compare_emf_bits(hemf, EMF_EMPTY_PATH_BITS, sizeof(EMF_EMPTY_PATH_BITS), "empty path", FALSE) != 0)
3931  {
3932  dump_emf_bits(hemf, "empty path");
3933  dump_emf_records(hemf, "empty path");
3934  }
3935 
3936  DeleteEnhMetaFile(hemf);
3937 }
BOOL WINAPI PolyDraw(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_reads_(cpt) const BYTE *aj, _In_ int cpt)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HDC WINAPI GetDC(_In_opt_ HWND)
static const unsigned char EMF_EMPTY_PATH_BITS[]
Definition: metafile.c:3815
BOOL WINAPI EndPath(_In_ HDC)
static const unsigned char EMF_PATH_BITS[]
Definition: metafile.c:3716
static HDC
Definition: imagelist.c:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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 LineTo(_In_ HDC, _In_ int, _In_ int)
BOOL WINAPI PolylineTo(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:354
static void dump_emf_bits(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1668
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
BOOL WINAPI RoundRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI Arc(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom, _In_ INT xStartArc, _In_ INT yStartArc, _In_ INT xEndArc, _In_ INT yEndArc)
Definition: arc.c:5
BOOL WINAPI StrokeAndFillPath(_In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits, UINT bsize, const char *desc, BOOL ignore_scaling)
Definition: metafile.c:1862
GLsizeiptr size
Definition: glext.h:5919
Definition: cmds.c:130
BOOL WINAPI Pie(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
static void dump_emf_records(const HENHMETAFILE mf, const char *desc)
Definition: metafile.c:1692
unsigned long DWORD
Definition: ntddk_ex.h:95
int WINAPI GetPath(_In_ HDC hdc, _Out_writes_opt_(cpt) LPPOINT apt, _Out_writes_opt_(cpt) LPBYTE aj, int cpt)
#define SetLastError(x)
Definition: compat.h:409
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
int ret
unsigned char BYTE
Definition: mem.h:68
BOOL WINAPI PolyPolyline(_In_ HDC hdc, _In_ const POINT *apt, _In_reads_(csz) const DWORD *asz, _In_ DWORD csz)
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define ok(value,...)
Definition: atltest.h:57