gdi32: Use NtGdiTransformPoints for DPtoLP.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-08-05 11:25:32 +02:00 committed by Alexandre Julliard
parent c4f038ec21
commit d57865a032
3 changed files with 44 additions and 6 deletions

View File

@ -1147,6 +1147,14 @@ INT WINAPI SetMetaRgn( HDC hdc )
return NtGdiSetMetaRgn( hdc ); return NtGdiSetMetaRgn( hdc );
} }
/***********************************************************************
* DPtoLP (GDI32.@)
*/
BOOL WINAPI DPtoLP( HDC hdc, POINT *points, INT count )
{
return NtGdiTransformPoints( hdc, points, points, count, NtGdiDPtoLP );
}
/*********************************************************************** /***********************************************************************
* GdiSetPixelFormat (GDI32.@) * GdiSetPixelFormat (GDI32.@)
*/ */

View File

@ -332,16 +332,39 @@ BOOL dp_to_lp( DC *dc, POINT *points, INT count )
} }
/*********************************************************************** /***********************************************************************
* DPtoLP (GDI32.@) * NtGdiTransformPoints (win32u.@)
*/ */
BOOL WINAPI DPtoLP( HDC hdc, POINT *points, INT count ) BOOL WINAPI NtGdiTransformPoints( HDC hdc, const POINT *points_in, POINT *points_out,
INT count, UINT mode )
{ {
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
BOOL ret; int i = 0;
BOOL ret = FALSE;
if (!dc) return FALSE; if (!dc) return FALSE;
ret = dp_to_lp( dc, points, count ); switch (mode)
{
case NtGdiDPtoLP:
if (!dc->vport2WorldValid) break;
for (i = 0; i < count; i++)
{
double x = points_in[i].x;
double y = points_in[i].y;
points_out[i].x = floor( x * dc->xformVport2World.eM11 +
y * dc->xformVport2World.eM21 +
dc->xformVport2World.eDx + 0.5 );
points_out[i].y = floor( x * dc->xformVport2World.eM12 +
y * dc->xformVport2World.eM22 +
dc->xformVport2World.eDy + 0.5 );
}
ret = TRUE;
break;
default:
WARN( "invalid mode %x\n", mode );
break;
}
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;

View File

@ -93,6 +93,12 @@ enum
NtGdiPolyPolygonRgn, NtGdiPolyPolygonRgn,
}; };
enum
{
NtGdiLPtoDP,
NtGdiDPtoLP,
};
/* structs not compatible with native Windows */ /* structs not compatible with native Windows */
#ifdef __WINESRC__ #ifdef __WINESRC__
@ -251,7 +257,8 @@ INT WINAPI NtGdiStartDoc( HDC hdc, const DOCINFOW *doc );
INT WINAPI NtGdiStartPage( HDC hdc ); INT WINAPI NtGdiStartPage( HDC hdc );
BOOL WINAPI NtGdiStrokePath( HDC hdc ); BOOL WINAPI NtGdiStrokePath( HDC hdc );
BOOL WINAPI NtGdiStrokeAndFillPath( HDC hdc ); BOOL WINAPI NtGdiStrokeAndFillPath( HDC hdc );
BOOL WINAPI NtGdiTransformPoints( HDC hdc, POINT *points, INT count, UINT mode ); BOOL WINAPI NtGdiTransformPoints( HDC hdc, const POINT *points_in, POINT *points_out,
INT count, UINT mode );
BOOL WINAPI NtGdiUnrealizeObject( HGDIOBJ obj ); BOOL WINAPI NtGdiUnrealizeObject( HGDIOBJ obj );
BOOL WINAPI NtGdiWidenPath( HDC hdc ); BOOL WINAPI NtGdiWidenPath( HDC hdc );