fonts: don't call LineTo with the gdi lock

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Sep 5 07:46:03 CDT 2005


On Sun, Aug 28, 2005 at 12:04:41PM +0100, Huw D M Davies wrote:
>         Huw Davies <huw at codeweavers.com>
>         Don't call LineTo while holding the gdi lock

Is this one better?
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/gdi/font.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/font.c,v
retrieving revision 1.15
diff -u -p -r1.15 font.c
--- dlls/gdi/font.c	23 Aug 2005 09:38:59 -0000	1.15
+++ dlls/gdi/font.c	5 Sep 2005 12:43:52 -0000
@@ -2020,9 +2020,18 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x,
             pts[1].x = x + xwidth;
             pts[1].y = y - ywidth;
             DPtoLP(hdc, pts, 2);
-            MoveToEx(hdc, pts[0].x - underlinePos * sinEsc, pts[0].y - underlinePos * cosEsc, &oldpt);
-            LineTo(hdc, pts[1].x - underlinePos * sinEsc, pts[1].y - underlinePos * cosEsc);
-            MoveToEx(hdc, oldpt.x, oldpt.y, NULL);
+            oldpt.x = dc->CursPosX;
+            oldpt.y = dc->CursPosY;
+            dc->CursPosX = pts[0].x - underlinePos * sinEsc;
+            dc->CursPosY = pts[0].y - underlinePos * cosEsc;
+            if(dc->funcs->pMoveTo)
+                dc->funcs->pMoveTo(dc->physDev, dc->CursPosX, dc->CursPosY);
+            if(dc->funcs->pLineTo)
+                dc->funcs->pLineTo(dc->physDev, pts[1].x - underlinePos * sinEsc, pts[1].y - underlinePos * cosEsc);
+            dc->CursPosX = oldpt.x;
+            dc->CursPosY = oldpt.y;
+            if(dc->funcs->pMoveTo)
+                dc->funcs->pMoveTo(dc->physDev, dc->CursPosX, dc->CursPosY);
             DeleteObject(SelectObject(hdc, hpen));
         }
 
@@ -2036,9 +2045,18 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x,
             pts[1].x = x + xwidth;
             pts[1].y = y - ywidth;
             DPtoLP(hdc, pts, 2);
-            MoveToEx(hdc, pts[0].x - strikeoutPos * sinEsc, pts[0].y - strikeoutPos * cosEsc, &oldpt);
-            LineTo(hdc, pts[1].x - strikeoutPos * sinEsc, pts[1].y - strikeoutPos * cosEsc);
-            MoveToEx(hdc, oldpt.x, oldpt.y, NULL);
+            oldpt.x = dc->CursPosX;
+            oldpt.y = dc->CursPosY;
+            dc->CursPosX = pts[0].x - strikeoutPos * sinEsc;
+            dc->CursPosY = pts[0].y - strikeoutPos * cosEsc;
+            if(dc->funcs->pMoveTo)
+                dc->funcs->pMoveTo(dc->physDev, dc->CursPosX, dc->CursPosY);
+            if(dc->funcs->pLineTo)
+                dc->funcs->pLineTo(dc->physDev, pts[1].x - strikeoutPos * sinEsc, pts[1].y - strikeoutPos * cosEsc);
+            dc->CursPosX = oldpt.x;
+            dc->CursPosY = oldpt.y;
+            if(dc->funcs->pMoveTo)
+                dc->funcs->pMoveTo(dc->physDev, dc->CursPosX, dc->CursPosY);
             DeleteObject(SelectObject(hdc, hpen));
         }
     }



More information about the wine-patches mailing list