Alexandre Julliard : gdi32: Implement bounds for FillPath, StrokeAndFillPath and StrokePath in enhanced metafiles.
Alexandre Julliard
julliard at winehq.org
Tue Jun 21 11:13:47 CDT 2016
Module: wine
Branch: master
Commit: c7bbc83062bad9dbd095e52988eedc0a9a096405
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c7bbc83062bad9dbd095e52988eedc0a9a096405
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jun 21 15:16:04 2016 +0900
gdi32: Implement bounds for FillPath, StrokeAndFillPath and StrokePath in enhanced metafiles.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/enhmfdrv/dc.c | 42 -----------------------------------
dlls/gdi32/enhmfdrv/graphics.c | 50 ++++++++++++++++++++++++++++++++++++++++++
dlls/gdi32/tests/metafile.c | 23 ++++++++++++++-----
3 files changed, 67 insertions(+), 48 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c
index 12f03f4..00f4d65 100644
--- a/dlls/gdi32/enhmfdrv/dc.c
+++ b/dlls/gdi32/enhmfdrv/dc.c
@@ -471,20 +471,6 @@ BOOL EMFDRV_EndPath( PHYSDEV dev )
return FALSE; /* always fails without a path */
}
-BOOL EMFDRV_FillPath( PHYSDEV dev )
-{
- EMRFILLPATH emr;
-
- emr.emr.iType = EMR_FILLPATH;
- emr.emr.nSize = sizeof(emr);
- FIXME("Bounds\n");
- emr.rclBounds.left = 0;
- emr.rclBounds.top = 0;
- emr.rclBounds.right = 0;
- emr.rclBounds.bottom = 0;
- return EMFDRV_WriteRecord( dev, &emr.emr );
-}
-
BOOL EMFDRV_FlattenPath( PHYSDEV dev )
{
EMRFLATTENPATH emr;
@@ -508,34 +494,6 @@ BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
return next->funcs->pSelectClipPath( next, iMode );
}
-BOOL EMFDRV_StrokeAndFillPath( PHYSDEV dev )
-{
- EMRSTROKEANDFILLPATH emr;
-
- emr.emr.iType = EMR_STROKEANDFILLPATH;
- emr.emr.nSize = sizeof(emr);
- FIXME("Bounds\n");
- emr.rclBounds.left = 0;
- emr.rclBounds.top = 0;
- emr.rclBounds.right = 0;
- emr.rclBounds.bottom = 0;
- return EMFDRV_WriteRecord( dev, &emr.emr );
-}
-
-BOOL EMFDRV_StrokePath( PHYSDEV dev )
-{
- EMRSTROKEPATH emr;
-
- emr.emr.iType = EMR_STROKEPATH;
- emr.emr.nSize = sizeof(emr);
- FIXME("Bounds\n");
- emr.rclBounds.left = 0;
- emr.rclBounds.top = 0;
- emr.rclBounds.right = 0;
- emr.rclBounds.bottom = 0;
- return EMFDRV_WriteRecord( dev, &emr.emr );
-}
-
BOOL EMFDRV_WidenPath( PHYSDEV dev )
{
EMRWIDENPATH emr;
diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c
index fb0ac9c..d905490 100644
--- a/dlls/gdi32/enhmfdrv/graphics.c
+++ b/dlls/gdi32/enhmfdrv/graphics.c
@@ -96,6 +96,32 @@ static void get_points_bounds( RECTL *bounds, const POINT *pts, UINT count, HDC
}
}
+/* helper for path stroke and fill functions */
+static BOOL emfdrv_stroke_and_fill_path( PHYSDEV dev, INT type )
+{
+ EMRSTROKEANDFILLPATH emr;
+ int count;
+ POINT *points;
+ BYTE *flags;
+
+ emr.emr.iType = type;
+ emr.emr.nSize = sizeof(emr);
+
+ count = get_gdi_flat_path( dev->hdc, &points, &flags, NULL );
+ if (count >= 0)
+ {
+ get_points_bounds( &emr.rclBounds, points, count, 0 );
+ HeapFree( GetProcessHeap(), 0, points );
+ HeapFree( GetProcessHeap(), 0, flags );
+ }
+ else emr.rclBounds = empty_bounds;
+
+ if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE;
+ if (count < 0) return FALSE;
+ EMFDRV_UpdateBBox( dev, &emr.rclBounds );
+ return TRUE;
+}
+
/**********************************************************************
* EMFDRV_MoveTo
*/
@@ -961,3 +987,27 @@ BOOL EMFDRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
HeapFree( GetProcessHeap(), 0, emr );
return ret;
}
+
+/**********************************************************************
+ * EMFDRV_FillPath
+ */
+BOOL EMFDRV_FillPath( PHYSDEV dev )
+{
+ return emfdrv_stroke_and_fill_path( dev, EMR_FILLPATH );
+}
+
+/**********************************************************************
+ * EMFDRV_StrokeAndFillPath
+ */
+BOOL EMFDRV_StrokeAndFillPath( PHYSDEV dev )
+{
+ return emfdrv_stroke_and_fill_path( dev, EMR_STROKEANDFILLPATH );
+}
+
+/**********************************************************************
+ * EMFDRV_MoveTo
+ */
+BOOL EMFDRV_StrokePath( PHYSDEV dev )
+{
+ return emfdrv_stroke_and_fill_path( dev, EMR_STROKEPATH );
+}
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index f655d01..bcd085c 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -3583,12 +3583,12 @@ static void test_emf_polybezier(void)
static const unsigned char EMF_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,
+ 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+ 0x96, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+ 0x70, 0x17, 0x00, 0x00, 0x70, 0x17, 0x00, 0x00,
0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
- 0xc8, 0x02, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+ 0xf8, 0x02, 0x00, 0x00, 0x17, 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,
@@ -3668,7 +3668,13 @@ static const unsigned char EMF_PATH_BITS[] =
0x25, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x42,
0x00, 0x00, 0x34, 0x43, 0x3c, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00,
+ 0x96, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x0e, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
};
@@ -3745,6 +3751,11 @@ static void test_emf_paths(void)
size = GetPath(hdcMetafile, NULL, NULL, 0);
todo_wine ok( size == 112, "GetPath returned %d.\n", size);
+ ret = StrokeAndFillPath( hdcMetafile );
+ ok( ret, "StrokeAndFillPath failed err %d\n", GetLastError() );
+ ret = StrokeAndFillPath( hdcMetafile );
+ ok( !ret, "StrokeAndFillPath succeeded\n" );
+
hemf = CloseEnhMetaFile(hdcMetafile);
ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
More information about the wine-cvs
mailing list