Jacek Caban : gdi32: Use NtGdiArcInternal for ArcTo implementation.

Alexandre Julliard julliard at winehq.org
Mon Jul 19 15:59:15 CDT 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sat Jul 17 16:57:06 2021 +0200

gdi32: Use NtGdiArcInternal for ArcTo implementation.

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    | 13 +++++++++++
 dlls/gdi32/painting.c | 61 +++++++++++++++++++--------------------------------
 2 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 2fc74d7685b..98269cb7582 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -54,3 +54,16 @@ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
     return NtGdiArcInternal( NtGdiArc, hdc, left, top, right, bottom,
                              xstart, ystart, xend, yend );
 }
+
+/***********************************************************************
+ *           ArcTo    (GDI32.@)
+ */
+BOOL WINAPI ArcTo( HDC hdc, INT left, INT top, INT right, INT bottom,
+                   INT xstart, INT ystart, INT xend, INT yend )
+{
+    TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
+           right, bottom, xstart, ystart, xend, yend );
+
+    return NtGdiArcInternal( NtGdiArcTo, hdc, left, top, right, bottom,
+                             xstart, ystart, xend, yend );
+}
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index b235480dacb..4fc7f98d9b8 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -293,6 +293,29 @@ BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right,
         physdev = GET_DC_PHYSDEV( dc, pArc );
         ret = physdev->funcs->pArc( physdev, left, top, right, bottom, xstart, ystart, xend, yend );
         break;
+
+    case NtGdiArcTo:
+        {
+            double width   = abs( right - left );
+            double height  = abs( bottom - top );
+            double xradius = width / 2;
+            double yradius = height / 2;
+            double xcenter = right > left ? left + xradius : right + xradius;
+            double ycenter = bottom > top ? top + yradius : bottom + yradius;
+
+            physdev = GET_DC_PHYSDEV( dc, pArcTo );
+            ret = physdev->funcs->pArcTo( physdev, left, top, right, bottom,
+                                          xstart, ystart, xend, yend );
+            if (ret)
+            {
+                double angle = atan2(((yend - ycenter) / height),
+                                     ((xend - xcenter) / width));
+                dc->cur_pos.x = GDI_ROUND( xcenter + (cos( angle ) * xradius) );
+                dc->cur_pos.y = GDI_ROUND( ycenter + (sin( angle ) * yradius) );
+            }
+            break;
+        }
+
     default:
         WARN( "invalid arc type %u\n", type );
         ret = FALSE;
@@ -302,44 +325,6 @@ BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right,
     return ret;
 }
 
-/***********************************************************************
- *           ArcTo    (GDI32.@)
- */
-BOOL WINAPI ArcTo( HDC hdc,
-                     INT left,   INT top,
-                     INT right,  INT bottom,
-                     INT xstart, INT ystart,
-                     INT xend,   INT yend )
-{
-    double width = abs( right - left ),
-        height = abs( bottom - top ),
-        xradius = width/2,
-        yradius = height/2,
-        xcenter = right > left ? left+xradius : right+xradius,
-        ycenter = bottom > top ? top+yradius : bottom+yradius,
-        angle;
-    PHYSDEV physdev;
-    BOOL result;
-    DC * dc = get_dc_ptr( hdc );
-
-    TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top, right, bottom, xstart, ystart, xend, yend );
-
-    if(!dc) return FALSE;
-    update_dc( dc );
-    physdev = GET_DC_PHYSDEV( dc, pArcTo );
-    result = physdev->funcs->pArcTo( physdev, left, top, right, bottom, xstart, ystart, xend, yend );
-
-    if (result)
-    {
-        angle = atan2(((yend-ycenter)/height),
-                      ((xend-xcenter)/width));
-        dc->cur_pos.x = GDI_ROUND( xcenter + (cos( angle ) * xradius) );
-        dc->cur_pos.y = GDI_ROUND( ycenter + (sin( angle ) * yradius) );
-    }
-    release_dc_ptr( dc );
-    return result;
-}
-
 
 /***********************************************************************
  *           Pie   (GDI32.@)




More information about the wine-cvs mailing list