gdi32: Stay within the clipping area when painting text background.

David Hedberg dhedberg at codeweavers.com
Sun Jan 30 06:47:55 CST 2011


---
 dlls/gdi32/font.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index b4aa9bc..024840c 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -2030,7 +2030,19 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
                 rc.right = x + width.x;
                 rc.top = y - tm.tmAscent;
                 rc.bottom = y + tm.tmDescent;
-                dc->funcs->pExtTextOut(dc->physDev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
+
+                if(flags & ETO_CLIPPED)
+                {
+                    rc.left = max(lprect->left, rc.left);
+                    rc.right = min(lprect->right, rc.right);
+                    rc.top = max(lprect->top, rc.top);
+                    rc.bottom = min(lprect->bottom, rc.bottom);
+
+                    if(rc.left < rc.right && rc.top < rc.bottom)
+                        dc->funcs->pExtTextOut(dc->physDev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
+                }
+                else
+                    dc->funcs->pExtTextOut(dc->physDev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
             }
         }
     }
-- 
1.7.1




More information about the wine-patches mailing list