From e92e5ec376e21c0c52b62ea8588b477d76b5be8a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 17 Jun 2016 13:51:05 +0900 Subject: [PATCH] gdi32: Implement ArcTo in enhanced metafiles. Signed-off-by: Alexandre Julliard --- dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 2 ++ dlls/gdi32/enhmfdrv/graphics.c | 19 +++++++++++++++++++ dlls/gdi32/enhmfdrv/init.c | 2 +- dlls/gdi32/tests/metafile.c | 16 +++++++++++----- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h index 8aa1b2d72bf..aa249132c6b 100644 --- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h +++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h @@ -56,6 +56,8 @@ extern DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) DECLSPEC_H extern BOOL EMFDRV_AbortPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL EMFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; +extern BOOL EMFDRV_ArcTo( PHYSDEV dev, INT left, INT top, INT right, + INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; extern BOOL EMFDRV_BeginPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL EMFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst, INT width, INT height, PHYSDEV devSrc, INT xSrc, INT ySrc, DWORD rop ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c index b139305b173..6724c1030c1 100644 --- a/dlls/gdi32/enhmfdrv/graphics.c +++ b/dlls/gdi32/enhmfdrv/graphics.c @@ -177,6 +177,15 @@ EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, if(bounds.top > yCentre) bounds.top = yCentre; else if(bounds.bottom < yCentre) bounds.bottom = yCentre; } + if (iType == EMR_ARCTO) + { + POINT pt; + GetCurrentPositionEx( dev->hdc, &pt ); + bounds.left = min( bounds.left, pt.x ); + bounds.top = min( bounds.top, pt.y ); + bounds.right = max( bounds.right, pt.x ); + bounds.bottom = max( bounds.bottom, pt.y ); + } if(!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE; if(!physDev->path) @@ -195,6 +204,16 @@ BOOL EMFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, xend, yend, EMR_ARC ); } +/*********************************************************************** + * EMFDRV_ArcTo + */ +BOOL EMFDRV_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, + INT xstart, INT ystart, INT xend, INT yend ) +{ + return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart, + xend, yend, EMR_ARCTO ); +} + /*********************************************************************** * EMFDRV_Pie */ diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c index f618e856c09..4d13c2b4a3d 100644 --- a/dlls/gdi32/enhmfdrv/init.c +++ b/dlls/gdi32/enhmfdrv/init.c @@ -41,7 +41,7 @@ static const struct gdi_dc_funcs EMFDRV_Funcs = NULL, /* pAlphaBlend */ NULL, /* pAngleArc */ EMFDRV_Arc, /* pArc */ - NULL, /* pArcTo */ + EMFDRV_ArcTo, /* pArcTo */ EMFDRV_BeginPath, /* pBeginPath */ NULL, /* pBlendImage */ EMFDRV_Chord, /* pChord */ diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index 79f072b9cca..4cf61a26931 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -3599,12 +3599,12 @@ static const unsigned char EMF_PATH_BITS[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xef, 0xff, 0xff, 0xff, 0xea, 0xff, 0xff, 0xff, + 0xd8, 0xff, 0xff, 0xff, 0xd8, 0xff, 0xff, 0xff, 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00, - 0x0c, 0x02, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x34, 0x02, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x07, 0x00, 0x00, 0x3e, 0x04, 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, @@ -3627,7 +3627,12 @@ static const unsigned char EMF_PATH_BITS[] = 0x15, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x1a, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x1b, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, @@ -3689,6 +3694,7 @@ static void test_emf_GetPath(void) ok( ret, "LineTo error %d.\n", GetLastError()); Rectangle(hdcMetafile, 10, 10, 20, 20); Arc(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21); + ArcTo(hdcMetafile, 23, 23, 37, 27, 37, 27, 23, 23); Chord(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21); Pie(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21); Ellipse(hdcMetafile, 10, 10, 20, 20); @@ -3698,7 +3704,7 @@ static void test_emf_GetPath(void) EndPath(hdcMetafile); size = GetPath(hdcMetafile, NULL, NULL, 0); - todo_wine ok( size == 77, "GetPath returned %d.\n", size); + todo_wine ok( size == 88, "GetPath returned %d.\n", size); hemf = CloseEnhMetaFile(hdcMetafile); ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());