gdiplus: Only clip strings if rectangle width and height are positive.

Vincent Povirk madewokherd at gmail.com
Tue Aug 13 17:23:20 CDT 2013


For bug 33378.

Yes, this is almost byte-for-byte identical to what Rafał Mużyło sent
earlier, but that's mostly because I told him this was how it should
be done.
-------------- next part --------------
From d91e46ddbaef27eb4f19792f48bf84984ec89b1a Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 13 Aug 2013 16:52:18 -0500
Subject: [PATCH] gdiplus: Only clip strings if rectangle width and height are
 positive.

---
 dlls/gdiplus/graphics.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 76af444..79e4c7c 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -5000,7 +5000,8 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
     if (scaled_rect.Height >= 1 << 23) scaled_rect.Height = 1 << 23;
 
     if (!(format_flags & StringFormatFlagsNoClip) &&
-        scaled_rect.Width != 1 << 23 && scaled_rect.Height != 1 << 23)
+        scaled_rect.Width != 1 << 23 && scaled_rect.Height != 1 << 23 &&
+        rect->Width > 0.0 && rect->Height > 0.0)
     {
         /* FIXME: If only the width or only the height is 0, we should probably still clip */
         rgn = CreatePolygonRgn(corners, 4, ALTERNATE);
-- 
1.8.1.2


More information about the wine-patches mailing list