Commit 11f09c2d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiPolyDraw for PolyDraw implementation.

parent f838d5a2
...@@ -671,18 +671,6 @@ static BOOL CDECL emfpathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -671,18 +671,6 @@ static BOOL CDECL emfpathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
next->funcs->pExtTextOut( next, x, y, flags, rect, str, count, dx )); next->funcs->pExtTextOut( next, x, y, flags, rect, str, count, dx ));
} }
/***********************************************************************
* emfpathdrv_PolyDraw
*/
static BOOL CDECL 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 ));
}
static const struct gdi_dc_funcs emfpath_driver = static const struct gdi_dc_funcs emfpath_driver =
{ {
...@@ -757,7 +745,7 @@ static const struct gdi_dc_funcs emfpath_driver = ...@@ -757,7 +745,7 @@ static const struct gdi_dc_funcs emfpath_driver =
NULL, /* pPie */ NULL, /* pPie */
NULL, /* pPolyBezier */ NULL, /* pPolyBezier */
NULL, /* pPolyBezierTo */ NULL, /* pPolyBezierTo */
emfpathdrv_PolyDraw, /* pPolyDraw */ NULL, /* pPolyDraw */
NULL, /* pPolyPolygon */ NULL, /* pPolyPolygon */
NULL, /* pPolyPolyline */ NULL, /* pPolyPolyline */
NULL, /* pPolylineTo */ NULL, /* pPolylineTo */
......
...@@ -741,11 +741,11 @@ BOOL CDECL EMFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, ...@@ -741,11 +741,11 @@ BOOL CDECL EMFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts,
} }
/********************************************************************** /**********************************************************************
* EMFDRV_PolyDraw * EMFDC_PolyDraw
*/ */
BOOL CDECL EMFDRV_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, DWORD count ) BOOL EMFDC_PolyDraw( DC_ATTR *dc_attr, const POINT *pts, const BYTE *types, DWORD count )
{ {
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); EMFDRV_PDEVICE *emf = dc_attr->emf;
EMRPOLYDRAW *emr; EMRPOLYDRAW *emr;
BOOL ret; BOOL ret;
BYTE *types_dest; BYTE *types_dest;
...@@ -765,19 +765,29 @@ BOOL CDECL EMFDRV_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, DW ...@@ -765,19 +765,29 @@ BOOL CDECL EMFDRV_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, DW
memcpy( types_dest, types, count ); memcpy( types_dest, types, count );
if (count & 3) memset( types_dest + count, 0, 4 - (count & 3) ); if (count & 3) memset( types_dest + count, 0, 4 - (count & 3) );
if (!physDev->path) if (!emf->path)
get_points_bounds( &emr->rclBounds, pts, count, 0 ); get_points_bounds( &emr->rclBounds, pts, count, 0 );
else else
emr->rclBounds = empty_bounds; emr->rclBounds = empty_bounds;
ret = EMFDRV_WriteRecord( dev, &emr->emr ); ret = EMFDRV_WriteRecord( &emf->dev, &emr->emr );
if (ret && !physDev->path) EMFDRV_UpdateBBox( dev, &emr->rclBounds ); if (ret && !emf->path) EMFDRV_UpdateBBox( &emf->dev, &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
/********************************************************************** /**********************************************************************
* EMFDRV_PolyDraw
*/
BOOL CDECL EMFDRV_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, DWORD count )
{
/* FIXME: update bounding rect */
return TRUE;
}
/**********************************************************************
* EMFDRV_ExtFloodFill * EMFDRV_ExtFloodFill
*/ */
BOOL CDECL EMFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType ) BOOL CDECL EMFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType )
......
...@@ -71,6 +71,8 @@ extern BOOL EMFDC_LineTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN; ...@@ -71,6 +71,8 @@ extern BOOL EMFDC_LineTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_MoveTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL EMFDC_MoveTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PolyBezier( DC_ATTR *dc_attr, const POINT *points, DWORD count ) DECLSPEC_HIDDEN; extern BOOL EMFDC_PolyBezier( DC_ATTR *dc_attr, const POINT *points, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PolyBezierTo( DC_ATTR *dc_attr, const POINT *points, DWORD count ) DECLSPEC_HIDDEN; extern BOOL EMFDC_PolyBezierTo( DC_ATTR *dc_attr, const POINT *points, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PolyDraw( DC_ATTR *dc_attr, const POINT *points, const BYTE *types,
DWORD count ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PolyPolyline( DC_ATTR *dc_attr, const POINT *points, const DWORD *counts, extern BOOL EMFDC_PolyPolyline( DC_ATTR *dc_attr, const POINT *points, const DWORD *counts,
DWORD polys ) DECLSPEC_HIDDEN; DWORD polys ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PolyPolygon( DC_ATTR *dc_attr, const POINT *points, const INT *counts, extern BOOL EMFDC_PolyPolygon( DC_ATTR *dc_attr, const POINT *points, const INT *counts,
......
...@@ -337,3 +337,17 @@ BOOL WINAPI PolylineTo( HDC hdc, const POINT *points, DWORD count ) ...@@ -337,3 +337,17 @@ BOOL WINAPI PolylineTo( HDC hdc, const POINT *points, DWORD count )
if (dc_attr->emf && !EMFDC_PolylineTo( dc_attr, points, count )) return FALSE; if (dc_attr->emf && !EMFDC_PolylineTo( dc_attr, points, count )) return FALSE;
return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolylineTo ); return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolylineTo );
} }
/***********************************************************************
* PolyDraw (GDI32.@)
*/
BOOL WINAPI PolyDraw( HDC hdc, const POINT *points, const BYTE *types, DWORD count )
{
DC_ATTR *dc_attr;
TRACE( "%p, %p, %p, %u\n", hdc, points, types, count );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_PolyDraw( dc_attr, points, types, count )) return FALSE;
return NtGdiPolyDraw( hdc, points, types, count );
}
...@@ -699,24 +699,21 @@ BOOL WINAPI NtGdiAngleArc( HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAn ...@@ -699,24 +699,21 @@ BOOL WINAPI NtGdiAngleArc( HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAn
} }
/*********************************************************************** /***********************************************************************
* PolyDraw (GDI32.@) * NtGdiPolyDraw (win32u.@)
*/ */
BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes, BOOL WINAPI NtGdiPolyDraw( HDC hdc, const POINT *points, const BYTE *types, DWORD count )
DWORD cCount)
{ {
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
PHYSDEV physdev; PHYSDEV physdev;
BOOL result; BOOL result;
TRACE( "%p, %p, %p, %u\n", hdc, lppt, lpbTypes, cCount );
if(!dc) return FALSE; if(!dc) return FALSE;
update_dc( dc ); update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pPolyDraw ); physdev = GET_DC_PHYSDEV( dc, pPolyDraw );
result = physdev->funcs->pPolyDraw( physdev, lppt, lpbTypes, cCount ); result = physdev->funcs->pPolyDraw( physdev, points, types, count );
if (result && cCount) if (result && count)
dc->attr->cur_pos = lppt[cCount - 1]; dc->attr->cur_pos = points[count - 1];
release_dc_ptr( dc ); release_dc_ptr( dc );
return result; return result;
......
...@@ -3324,6 +3324,9 @@ static void test_mf_Graphics(void) ...@@ -3324,6 +3324,9 @@ static void test_mf_Graphics(void)
INT type; INT type;
BOOL ret; BOOL ret;
static const POINT points[] = { {1, 1}, {2, 2} };
static const BYTE types[] = { PT_MOVETO, PT_LINETO };
hdcMetafile = CreateMetaFileA(NULL); hdcMetafile = CreateMetaFileA(NULL);
ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError()); ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
...@@ -3344,6 +3347,12 @@ static void test_mf_Graphics(void) ...@@ -3344,6 +3347,12 @@ static void test_mf_Graphics(void)
ret = ArcTo(hdcMetafile, 1, 2, 30, 40, 11, 12, 23, 24 ); ret = ArcTo(hdcMetafile, 1, 2, 30, 40, 11, 12, 23, 24 );
ok( !ret, "ArcTo succeeded\n" ); ok( !ret, "ArcTo succeeded\n" );
SetLastError(0xdeadbeef);
ret = PolyDraw(hdcMetafile, points, types, ARRAY_SIZE(points));
ok(!ret, "PolyDraw succeeded\n");
todo_wine
ok(GetLastError() == 0xdeadbeef, "GetLastError() = %u\n", GetLastError());
hMetafile = CloseMetaFile(hdcMetafile); hMetafile = CloseMetaFile(hdcMetafile);
ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError()); ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
type = GetObjectType(hdcMetafile); type = GetObjectType(hdcMetafile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment