Jacek Caban : gdi32: Use NtGdiFlattenPath for FlattenPath.
Alexandre Julliard
julliard at winehq.org
Wed Aug 18 16:22:09 CDT 2021
Module: wine
Branch: master
Commit: b39d4cbe36708d791a4c45f7a27cfa75e93db56c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b39d4cbe36708d791a4c45f7a27cfa75e93db56c
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Aug 18 11:59:15 2021 +0200
gdi32: Use NtGdiFlattenPath for FlattenPath.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/enhmfdrv/dc.c | 5 ++---
dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 1 -
dlls/gdi32/enhmfdrv/init.c | 2 +-
dlls/gdi32/gdi_private.h | 1 +
dlls/gdi32/gdidc.c | 12 ++++++++++++
dlls/gdi32/path.c | 33 +++++++++++++--------------------
6 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c
index bf8f1a85ad9..5b88e6e9c13 100644
--- a/dlls/gdi32/enhmfdrv/dc.c
+++ b/dlls/gdi32/enhmfdrv/dc.c
@@ -376,14 +376,13 @@ BOOL EMFDC_EndPath( DC_ATTR *dc_attr )
return EMFDRV_WriteRecord( &emf->dev, &emr.emr );
}
-BOOL CDECL EMFDRV_FlattenPath( PHYSDEV dev )
+BOOL EMFDC_FlattenPath( DC_ATTR *dc_attr )
{
EMRFLATTENPATH emr;
emr.emr.iType = EMR_FLATTENPATH;
emr.emr.nSize = sizeof(emr);
-
- return EMFDRV_WriteRecord( dev, &emr.emr );
+ return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL EMFDC_SelectClipPath( DC_ATTR *dc_attr, INT mode )
diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
index ea60aa6cf29..6e0a89495e6 100644
--- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
+++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
@@ -71,7 +71,6 @@ extern BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
UINT count, const INT *lpDx ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
-extern BOOL CDECL EMFDRV_FlattenPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT height ) DECLSPEC_HIDDEN;
extern INT CDECL EMFDRV_GetDeviceCaps( PHYSDEV dev, INT cap ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c
index 57d538f3597..7cbe6efb96d 100644
--- a/dlls/gdi32/enhmfdrv/init.c
+++ b/dlls/gdi32/enhmfdrv/init.c
@@ -63,7 +63,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_ExtTextOut, /* pExtTextOut */
EMFDRV_FillPath, /* pFillPath */
EMFDRV_FillRgn, /* pFillRgn */
- EMFDRV_FlattenPath, /* pFlattenPath */
+ NULL, /* pFlattenPath */
NULL, /* pFontIsLinked */
EMFDRV_FrameRgn, /* pFrameRgn */
NULL, /* pGetBoundsRect */
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 1e0e4d2dd0a..bb90ee471f1 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -149,6 +149,7 @@ extern BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const
const WCHAR *str, UINT count, const INT *dx ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_FillPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_FillRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
+extern BOOL EMFDC_FlattenPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_FrameRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush, INT width,
INT height ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_GradientFill( DC_ATTR *dc_attr, TRIVERTEX *vert_array, ULONG nvert,
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 067a7e7f588..c5e8d29837a 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -1531,6 +1531,18 @@ BOOL WINAPI FillPath( HDC hdc )
return NtGdiFillPath( hdc );
}
+/***********************************************************************
+ * FlattenPath (GDI32.@)
+ */
+BOOL WINAPI FlattenPath( HDC hdc )
+{
+ DC_ATTR *dc_attr;
+
+ if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
+ if (dc_attr->emf && !EMFDC_FlattenPath( dc_attr )) return FALSE;
+ return NtGdiFlattenPath( hdc );
+}
+
/***********************************************************************
* SelectClipPath (GDI32.@)
*/
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index 2badf2874f2..a47682a6eda 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -1588,21 +1588,25 @@ static BOOL CDECL pathdrv_CloseFigure( PHYSDEV dev )
/*******************************************************************
- * FlattenPath [GDI32.@]
- *
- *
+ * NtGdiFlattenPath (win32u.@)
*/
-BOOL WINAPI FlattenPath(HDC hdc)
+BOOL WINAPI NtGdiFlattenPath( HDC hdc )
{
+ struct gdi_path *path;
BOOL ret = FALSE;
- DC *dc = get_dc_ptr( hdc );
+ DC *dc;
- if (dc)
+ if (!(dc = get_dc_ptr( hdc ))) return FALSE;
+
+ if (!dc->path) SetLastError( ERROR_CAN_NOT_COMPLETE );
+ else if ((path = PATH_FlattenPath( dc->path )))
{
- PHYSDEV physdev = GET_DC_PHYSDEV( dc, pFlattenPath );
- ret = physdev->funcs->pFlattenPath( physdev );
- release_dc_ptr( dc );
+ free_gdi_path( dc->path );
+ dc->path = path;
+ ret = TRUE;
}
+
+ release_dc_ptr( dc );
return ret;
}
@@ -2030,17 +2034,6 @@ BOOL CDECL nulldrv_StrokePath( PHYSDEV dev )
BOOL CDECL nulldrv_FlattenPath( PHYSDEV dev )
{
- DC *dc = get_nulldrv_dc( dev );
- struct gdi_path *path;
-
- if (!dc->path)
- {
- SetLastError( ERROR_CAN_NOT_COMPLETE );
- return FALSE;
- }
- if (!(path = PATH_FlattenPath( dc->path ))) return FALSE;
- free_gdi_path( dc->path );
- dc->path = path;
return TRUE;
}
More information about the wine-cvs
mailing list