Jacek Caban : gdi32: Use NtGdiTransformPoints for LPtoDP.

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


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

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

gdi32: Use NtGdiTransformPoints for LPtoDP.

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   |  9 +++++++++
 dlls/gdi32/mapping.c | 30 +++++++++++++++---------------
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 79d5133b30c..3d1fb9049a6 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -1155,6 +1155,15 @@ BOOL WINAPI DPtoLP( HDC hdc, POINT *points, INT count )
     return NtGdiTransformPoints( hdc, points, points, count, NtGdiDPtoLP );
 }
 
+/***********************************************************************
+ *           LPtoDP    (GDI32.@)
+ */
+BOOL WINAPI LPtoDP( HDC hdc, POINT *points, INT count )
+{
+    return NtGdiTransformPoints( hdc, points, points, count, NtGdiLPtoDP );
+}
+
+
 /***********************************************************************
  *           GdiSetPixelFormat   (GDI32.@)
  */
diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c
index 8ab0b3b3ef3..3dea94efc68 100644
--- a/dlls/gdi32/mapping.c
+++ b/dlls/gdi32/mapping.c
@@ -345,6 +345,21 @@ BOOL WINAPI NtGdiTransformPoints( HDC hdc, const POINT *points_in, POINT *points
 
     switch (mode)
     {
+    case NtGdiLPtoDP:
+        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->xformWorld2Vport.eM11 +
+                                     y * dc->xformWorld2Vport.eM21 +
+                                     dc->xformWorld2Vport.eDx + 0.5 );
+            points_out[i].y = floor( x * dc->xformWorld2Vport.eM12 +
+                                     y * dc->xformWorld2Vport.eM22 +
+                                     dc->xformWorld2Vport.eDy + 0.5 );
+        }
+        ret = TRUE;
+        break;
+
     case NtGdiDPtoLP:
         if (!dc->vport2WorldValid) break;
         for (i = 0; i < count; i++)
@@ -392,21 +407,6 @@ void lp_to_dp( DC *dc, POINT *points, INT count )
     }
 }
 
-/***********************************************************************
- *           LPtoDP    (GDI32.@)
- */
-BOOL WINAPI LPtoDP( HDC hdc, POINT *points, INT count )
-{
-    DC * dc = get_dc_ptr( hdc );
-    if (!dc) return FALSE;
-
-    lp_to_dp( dc, points, count );
-
-    release_dc_ptr( dc );
-    return TRUE;
-}
-
-
 /***********************************************************************
  *           SetMapMode    (GDI32.@)
  */




More information about the wine-cvs mailing list