gdi32: Implement a path driver for enhanced metafiles.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-06-21 14:38:19 +09:00
parent 6bab6ad40d
commit 625ff9b528
3 changed files with 535 additions and 14 deletions

View File

@ -2,6 +2,7 @@
* Enhanced MetaFile driver dc value functions
*
* Copyright 1999 Huw D M Davies
* Copyright 2016 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -18,11 +19,20 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "enhmfdrv/enhmetafiledrv.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);
/* get the emf physdev from the path physdev */
static inline PHYSDEV get_emfdev( PHYSDEV path )
{
return &CONTAINING_RECORD( path, EMFDRV_PDEVICE, pathdev )->dev;
}
static const struct gdi_dc_funcs emfpath_driver;
INT EMFDRV_SaveDC( PHYSDEV dev )
{
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSaveDC );
@ -421,14 +431,22 @@ BOOL EMFDRV_AbortPath( PHYSDEV dev )
BOOL EMFDRV_BeginPath( PHYSDEV dev )
{
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pBeginPath );
EMRBEGINPATH emr;
physDev->path = TRUE;
DC *dc;
emr.emr.iType = EMR_BEGINPATH;
emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dev, &emr.emr );
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE;
if (physDev->path) return TRUE; /* already open */
if (!next->funcs->pBeginPath( next )) return FALSE;
dc = get_dc_ptr( dev->hdc );
push_dc_driver( &dc->physDev, &physDev->pathdev, &emfpath_driver );
physDev->path = TRUE;
release_dc_ptr( dc );
return TRUE;
}
BOOL EMFDRV_CloseFigure( PHYSDEV dev )
@ -438,20 +456,19 @@ BOOL EMFDRV_CloseFigure( PHYSDEV dev )
emr.emr.iType = EMR_CLOSEFIGURE;
emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dev, &emr.emr );
EMFDRV_WriteRecord( dev, &emr.emr );
return FALSE; /* always fails without a path */
}
BOOL EMFDRV_EndPath( PHYSDEV dev )
{
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
EMRENDPATH emr;
physDev->path = FALSE;
emr.emr.iType = EMR_ENDPATH;
emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dev, &emr.emr );
EMFDRV_WriteRecord( dev, &emr.emr );
return FALSE; /* always fails without a path */
}
BOOL EMFDRV_FillPath( PHYSDEV dev )
@ -535,3 +552,443 @@ INT EMFDRV_GetDeviceCaps(PHYSDEV dev, INT cap)
return GetDeviceCaps( physDev->ref_dc, cap );
}
/***********************************************************************
* emfpathdrv_AbortPath
*/
static BOOL emfpathdrv_AbortPath( PHYSDEV dev )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pAbortPath );
DC *dc = get_dc_ptr( dev->hdc );
emfpath_driver.pDeleteDC( pop_dc_driver( dc, &emfpath_driver ));
release_dc_ptr( dc );
emfdev->funcs->pAbortPath( emfdev );
return next->funcs->pAbortPath( next );
}
/***********************************************************************
* emfpathdrv_AngleArc
*/
static BOOL emfpathdrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pAngleArc );
return (emfdev->funcs->pAngleArc( emfdev, x, y, radius, start, sweep ) &&
next->funcs->pAngleArc( next, x, y, radius, start, sweep ));
}
/***********************************************************************
* emfpathdrv_Arc
*/
static BOOL emfpathdrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pArc );
return (emfdev->funcs->pArc( emfdev, left, top, right, bottom, xstart, ystart, xend, yend ) &&
next->funcs->pArc( next, left, top, right, bottom, xstart, ystart, xend, yend ));
}
/***********************************************************************
* emfpathdrv_ArcTo
*/
static BOOL emfpathdrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pArcTo );
return (emfdev->funcs->pArcTo( emfdev, left, top, right, bottom, xstart, ystart, xend, yend ) &&
next->funcs->pArcTo( next, left, top, right, bottom, xstart, ystart, xend, yend ));
}
/***********************************************************************
* emfpathdrv_BeginPath
*/
static BOOL emfpathdrv_BeginPath( PHYSDEV dev )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pBeginPath );
return (emfdev->funcs->pBeginPath( emfdev ) && next->funcs->pBeginPath( next ));
}
/***********************************************************************
* emfpathdrv_Chord
*/
static BOOL emfpathdrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pChord );
return (emfdev->funcs->pChord( emfdev, left, top, right, bottom, xstart, ystart, xend, yend ) &&
next->funcs->pChord( next, left, top, right, bottom, xstart, ystart, xend, yend ));
}
/***********************************************************************
* emfpathdrv_CloseFigure
*/
static BOOL emfpathdrv_CloseFigure( PHYSDEV dev )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pCloseFigure );
emfdev->funcs->pCloseFigure( emfdev );
return next->funcs->pCloseFigure( next );
}
/***********************************************************************
* emfpathdrv_CreateDC
*/
static BOOL emfpathdrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device,
LPCWSTR output, const DEVMODEW *devmode )
{
assert( 0 ); /* should never be called */
return TRUE;
}
/*************************************************************
* emfpathdrv_DeleteDC
*/
static BOOL emfpathdrv_DeleteDC( PHYSDEV dev )
{
EMFDRV_PDEVICE *physdev = (EMFDRV_PDEVICE *)get_emfdev( dev );
physdev->path = FALSE;
return TRUE;
}
/***********************************************************************
* emfpathdrv_Ellipse
*/
static BOOL emfpathdrv_Ellipse( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pEllipse );
return (emfdev->funcs->pEllipse( emfdev, x1, y1, x2, y2 ) &&
next->funcs->pEllipse( next, x1, y1, x2, y2 ));
}
/***********************************************************************
* emfpathdrv_EndPath
*/
static BOOL emfpathdrv_EndPath( PHYSDEV dev )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pEndPath );
DC *dc = get_dc_ptr( dev->hdc );
emfpath_driver.pDeleteDC( pop_dc_driver( dc, &emfpath_driver ));
release_dc_ptr( dc );
emfdev->funcs->pEndPath( emfdev );
return next->funcs->pEndPath( next );
}
/***********************************************************************
* emfpathdrv_ExtTextOut
*/
static BOOL emfpathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect,
LPCWSTR str, UINT count, const INT *dx )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pExtTextOut );
return (emfdev->funcs->pExtTextOut( emfdev, x, y, flags, rect, str, count, dx ) &&
next->funcs->pExtTextOut( next, x, y, flags, rect, str, count, dx ));
}
/***********************************************************************
* emfpathdrv_LineTo
*/
static BOOL emfpathdrv_LineTo( PHYSDEV dev, INT x, INT y )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pLineTo );
return (emfdev->funcs->pLineTo( emfdev, x, y ) && next->funcs->pLineTo( next, x, y ));
}
/***********************************************************************
* emfpathdrv_MoveTo
*/
static BOOL emfpathdrv_MoveTo( PHYSDEV dev, INT x, INT y )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pMoveTo );
return (emfdev->funcs->pMoveTo( emfdev, x, y ) && next->funcs->pMoveTo( next, x, y ));
}
/***********************************************************************
* emfpathdrv_Pie
*/
static BOOL emfpathdrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPie );
return (emfdev->funcs->pPie( emfdev, left, top, right, bottom, xstart, ystart, xend, yend ) &&
next->funcs->pPie( next, left, top, right, bottom, xstart, ystart, xend, yend ));
}
/***********************************************************************
* emfpathdrv_PolyBezier
*/
static BOOL emfpathdrv_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyBezier );
return (emfdev->funcs->pPolyBezier( emfdev, pts, count ) &&
next->funcs->pPolyBezier( next, pts, count ));
}
/***********************************************************************
* emfpathdrv_PolyBezierTo
*/
static BOOL emfpathdrv_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyBezierTo );
return (emfdev->funcs->pPolyBezierTo( emfdev, pts, count ) &&
next->funcs->pPolyBezierTo( next, pts, count ));
}
/***********************************************************************
* emfpathdrv_PolyDraw
*/
static BOOL emfpathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, DWORD count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyDraw );
return (emfdev->funcs->pPolyDraw( emfdev, pts, types, count ) &&
next->funcs->pPolyDraw( next, pts, types, count ));
}
/***********************************************************************
* emfpathdrv_PolyPolygon
*/
static BOOL emfpathdrv_PolyPolygon( PHYSDEV dev, const POINT *pts, const INT *counts, UINT polygons )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyPolygon );
return (emfdev->funcs->pPolyPolygon( emfdev, pts, counts, polygons ) &&
next->funcs->pPolyPolygon( next, pts, counts, polygons ));
}
/***********************************************************************
* emfpathdrv_PolyPolyline
*/
static BOOL emfpathdrv_PolyPolyline( PHYSDEV dev, const POINT *pts, const DWORD *counts, DWORD polylines )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyPolyline );
return (emfdev->funcs->pPolyPolyline( emfdev, pts, counts, polylines ) &&
next->funcs->pPolyPolyline( next, pts, counts, polylines ));
}
/***********************************************************************
* emfpathdrv_Polygon
*/
static BOOL emfpathdrv_Polygon( PHYSDEV dev, const POINT *pts, INT count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolygon );
return (emfdev->funcs->pPolygon( emfdev, pts, count ) &&
next->funcs->pPolygon( next, pts, count ));
}
/***********************************************************************
* emfpathdrv_Polyline
*/
static BOOL emfpathdrv_Polyline( PHYSDEV dev, const POINT *pts, INT count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyline );
return (emfdev->funcs->pPolyline( emfdev, pts, count ) &&
next->funcs->pPolyline( next, pts, count ));
}
/***********************************************************************
* emfpathdrv_PolylineTo
*/
static BOOL emfpathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT count )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolylineTo );
return (emfdev->funcs->pPolylineTo( emfdev, pts, count ) &&
next->funcs->pPolylineTo( next, pts, count ));
}
/***********************************************************************
* emfpathdrv_Rectangle
*/
static BOOL emfpathdrv_Rectangle( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRectangle );
return (emfdev->funcs->pRectangle( emfdev, x1, y1, x2, y2 ) &&
next->funcs->pRectangle( next, x1, y1, x2, y2 ));
}
/***********************************************************************
* emfpathdrv_RoundRect
*/
static BOOL emfpathdrv_RoundRect( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2,
INT ell_width, INT ell_height )
{
PHYSDEV emfdev = get_emfdev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRoundRect );
return (emfdev->funcs->pRoundRect( emfdev, x1, y1, x2, y2, ell_width, ell_height ) &&
next->funcs->pRoundRect( next, x1, y1, x2, y2, ell_width, ell_height ));
}
static const struct gdi_dc_funcs emfpath_driver =
{
NULL, /* pAbortDoc */
emfpathdrv_AbortPath, /* pAbortPath */
NULL, /* pAlphaBlend */
emfpathdrv_AngleArc, /* pAngleArc */
emfpathdrv_Arc, /* pArc */
emfpathdrv_ArcTo, /* pArcTo */
emfpathdrv_BeginPath, /* pBeginPath */
NULL, /* pBlendImage */
emfpathdrv_Chord, /* pChord */
emfpathdrv_CloseFigure, /* pCloseFigure */
NULL, /* pCreateCompatibleDC */
emfpathdrv_CreateDC, /* pCreateDC */
emfpathdrv_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDeviceCapabilities */
emfpathdrv_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
NULL, /* pEndPage */
emfpathdrv_EndPath, /* pEndPath */
NULL, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
NULL, /* pExcludeClipRect */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
NULL, /* pExtFloodFill */
NULL, /* pExtSelectClipRgn */
emfpathdrv_ExtTextOut, /* pExtTextOut */
NULL, /* pFillPath */
NULL, /* pFillRgn */
NULL, /* pFlattenPath */
NULL, /* pFontIsLinked */
NULL, /* pFrameRgn */
NULL, /* pGdiComment */
NULL, /* pGetBoundsRect */
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */
NULL, /* pGetFontRealizationInfo */
NULL, /* pGetFontUnicodeRanges */
NULL, /* pGetGlyphIndices */
NULL, /* pGetGlyphOutline */
NULL, /* pGetICMProfile */
NULL, /* pGetImage */
NULL, /* pGetKerningPairs */
NULL, /* pGetNearestColor */
NULL, /* pGetOutlineTextMetrics */
NULL, /* pGetPixel */
NULL, /* pGetSystemPaletteEntries */
NULL, /* pGetTextCharsetInfo */
NULL, /* pGetTextExtentExPoint */
NULL, /* pGetTextExtentExPointI */
NULL, /* pGetTextFace */
NULL, /* pGetTextMetrics */
NULL, /* pGradientFill */
NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */
emfpathdrv_LineTo, /* pLineTo */
NULL, /* pModifyWorldTransform */
emfpathdrv_MoveTo, /* pMoveTo */
NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrg */
NULL, /* pOffsetWindowOrg */
NULL, /* pPaintRgn */
NULL, /* pPatBlt */
emfpathdrv_Pie, /* pPie */
emfpathdrv_PolyBezier, /* pPolyBezier */
emfpathdrv_PolyBezierTo, /* pPolyBezierTo */
emfpathdrv_PolyDraw, /* pPolyDraw */
emfpathdrv_PolyPolygon, /* pPolyPolygon */
emfpathdrv_PolyPolyline, /* pPolyPolyline */
emfpathdrv_Polygon, /* pPolygon */
emfpathdrv_Polyline, /* pPolyline */
emfpathdrv_PolylineTo, /* pPolylineTo */
NULL, /* pPutImage */
NULL, /* pRealizeDefaultPalette */
NULL, /* pRealizePalette */
emfpathdrv_Rectangle, /* pRectangle */
NULL, /* pResetDC */
NULL, /* pRestoreDC */
emfpathdrv_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
NULL, /* pSelectBitmap */
NULL, /* pSelectBrush */
NULL, /* pSelectClipPath */
NULL, /* pSelectFont */
NULL, /* pSelectPalette */
NULL, /* pSelectPen */
NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
NULL, /* pSetBkMode */
NULL, /* pSetDCBrushColor */
NULL, /* pSetDCPenColor */
NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBitsToDevice */
NULL, /* pSetDeviceClipping */
NULL, /* pSetDeviceGammaRamp */
NULL, /* pSetLayout */
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */
NULL, /* pSetStretchBltMode */
NULL, /* pSetTextAlign */
NULL, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */
NULL, /* pSetTextJustification */
NULL, /* pSetViewportExt */
NULL, /* pSetViewportOrg */
NULL, /* pSetWindowExt */
NULL, /* pSetWindowOrg */
NULL, /* pSetWorldTransform */
NULL, /* pStartDoc */
NULL, /* pStartPage */
NULL, /* pStretchBlt */
NULL, /* pStretchDIBits */
NULL, /* pStrokeAndFillPath */
NULL, /* pStrokePath */
NULL, /* pUnrealizePalette */
NULL, /* pWidenPath */
NULL, /* wine_get_wgl_driver */
GDI_PRIORITY_PATH_DRV + 1 /* priority */
};

View File

@ -33,6 +33,7 @@
typedef struct
{
struct gdi_physdev dev;
struct gdi_physdev pathdev;
ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */
UINT handles_size, cur_handles;
HGDIOBJ *handles;

View File

@ -2401,7 +2401,7 @@ static void test_emf_ExtTextOut_on_path(void)
ok(ret, "BeginPath error %d\n", GetLastError());
ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
ok(ret, "ExtTextOut error %d\n", GetLastError());
todo_wine ok(ret, "ExtTextOut error %d\n", GetLastError());
ret = EndPath(hdcMetafile);
ok(ret, "EndPath error %d\n", GetLastError());
@ -3673,7 +3673,36 @@ static const unsigned char EMF_PATH_BITS[] =
0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
};
static void test_emf_GetPath(void)
static const unsigned char EMF_EMPTY_PATH_BITS[] =
{
0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xd8, 0xff, 0xff, 0xff, 0xd8, 0xff, 0xff, 0xff,
0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
0xc8, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x03, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00,
0x40, 0x01, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x04, 0x00,
0x80, 0xa9, 0x03, 0x00, 0x3b, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
};
static void test_emf_paths(void)
{
POINT pts[9] = {{10, 10}, {20, 10}, {10, 20}, {20, 20}, {30, 30}, {40, 20}, {20, 30}, {20, 20}, {20, 10}};
DWORD counts[2] = {2, 2};
@ -3719,10 +3748,44 @@ static void test_emf_GetPath(void)
hemf = CloseEnhMetaFile(hdcMetafile);
ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
if (compare_emf_bits(hemf, EMF_PATH_BITS, sizeof(EMF_PATH_BITS), "test_emf_GetPath", FALSE) != 0)
if (compare_emf_bits(hemf, EMF_PATH_BITS, sizeof(EMF_PATH_BITS), "test_emf_paths", FALSE) != 0)
{
dump_emf_bits(hemf, "test_emf_GetPath");
dump_emf_records(hemf, "test_emf_GetPath");
dump_emf_bits(hemf, "test_emf_paths");
dump_emf_records(hemf, "test_emf_paths");
}
DeleteEnhMetaFile(hemf);
SetLastError(0xdeadbeef);
hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
ret = BeginPath(hdcMetafile);
ok( ret, "BeginPath failed error %d\n", GetLastError() );
ret = CloseFigure(hdcMetafile);
ok( ret, "CloseFigure failed error %d\n", GetLastError() );
ret = BeginPath(hdcMetafile);
ok( ret, "BeginPath failed error %d\n", GetLastError() );
ret = EndPath(hdcMetafile);
ok( ret, "EndPath failed error %d\n", GetLastError() );
ret = EndPath(hdcMetafile);
ok( !ret, "EndPath succeeded\n" );
ret = CloseFigure(hdcMetafile);
ok( !ret, "CloseFigure succeeded\n" );
ret = BeginPath(hdcMetafile);
ok( ret, "BeginPath failed error %d\n", GetLastError() );
ret = AbortPath(hdcMetafile);
ok( ret, "AbortPath failed error %d\n", GetLastError() );
ret = AbortPath(hdcMetafile);
ok( ret, "AbortPath failed error %d\n", GetLastError() );
hemf = CloseEnhMetaFile(hdcMetafile);
ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
if (compare_emf_bits(hemf, EMF_EMPTY_PATH_BITS, sizeof(EMF_EMPTY_PATH_BITS), "empty path", FALSE) != 0)
{
dump_emf_bits(hemf, "empty path");
dump_emf_records(hemf, "empty path");
}
DeleteEnhMetaFile(hemf);
@ -3839,7 +3902,7 @@ START_TEST(metafile)
test_emf_ExtTextOut_on_path();
test_emf_clipping();
test_emf_polybezier();
test_emf_GetPath();
test_emf_paths();
test_emf_PolyPolyline();
test_emf_GradientFill();