Jacek Caban : gdi32: Use NtGdiTransformPoints for DPtoLP.

Alexandre Julliard julliard at winehq.org
Thu Aug 5 16:13:40 CDT 2021


Module: wine
Branch: master
Commit: d57865a032990a43f4f06f003a923e1792df9bb2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d57865a032990a43f4f06f003a923e1792df9bb2

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Aug  5 11:25:32 2021 +0200

gdi32: Use NtGdiTransformPoints for DPtoLP.

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/gdidc.c   |  8 ++++++++
 dlls/gdi32/mapping.c | 33 ++++++++++++++++++++++++++++-----
 include/ntgdi.h      |  9 ++++++++-
 3 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 45314781b37..79d5133b30c 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -1147,6 +1147,14 @@ INT WINAPI SetMetaRgn( HDC hdc )
     return NtGdiSetMetaRgn( hdc );
 }
 
+/***********************************************************************
+ *           DPtoLP    (GDI32.@)
+ */
+BOOL WINAPI DPtoLP( HDC hdc, POINT *points, INT count )
+{
+    return NtGdiTransformPoints( hdc, points, points, count, NtGdiDPtoLP );
+}
+
 /***********************************************************************
  *           GdiSetPixelFormat   (GDI32.@)
  */
diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c
index 6eafc4a362c..8ab0b3b3ef3 100644
--- a/dlls/gdi32/mapping.c
+++ b/dlls/gdi32/mapping.c
@@ -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 );
-    BOOL ret;
+    DC *dc = get_dc_ptr( hdc );
+    int i = 0;
+    BOOL ret = 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 );
     return ret;
diff --git a/include/ntgdi.h b/include/ntgdi.h
index c2f61fca6df..9be37414dce 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -93,6 +93,12 @@ enum
     NtGdiPolyPolygonRgn,
 };
 
+enum
+{
+    NtGdiLPtoDP,
+    NtGdiDPtoLP,
+};
+
 /* structs not compatible with native Windows */
 #ifdef __WINESRC__
 
@@ -251,7 +257,8 @@ INT      WINAPI NtGdiStartDoc( HDC hdc, const DOCINFOW *doc );
 INT      WINAPI NtGdiStartPage( HDC hdc );
 BOOL     WINAPI NtGdiStrokePath( 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 NtGdiWidenPath( HDC hdc );
 




More information about the wine-cvs mailing list