gdiplus: GdipDrawString is not supposed to use the layout rectangle for clipping.

Dmitry Timoshkov dmitry at baikal.ru
Tue Apr 3 01:02:55 CDT 2012


There is a dedicated clip region in the graphics object.

This patch makes samples like
http://www.jose.it-berater.org/smfforum/index.php?topic=1826.0
display the text.

http://www.masm32.com/board/index.php?PHPSESSID=680ca0145288000bad5f8cbb854384ca&topic=11385.0
confirms that only X and Y are used as text origin.
---
 dlls/gdiplus/graphics.c |   16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 2c6c4b2..4b9f453 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -5129,8 +5129,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
 {
     HRGN rgn = NULL;
     HFONT gdifont;
-    GpPointF pt[3], rectcpy[4];
-    POINT corners[4];
+    GpPointF pt[3];
     REAL rel_width, rel_height;
     INT save_state;
     REAL offsety = 0.0;
@@ -5184,24 +5183,11 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
     rel_height = sqrt((pt[2].Y-pt[0].Y)*(pt[2].Y-pt[0].Y)+
                       (pt[2].X-pt[0].X)*(pt[2].X-pt[0].X));
 
-    rectcpy[3].X = rectcpy[0].X = rect->X;
-    rectcpy[1].Y = rectcpy[0].Y = rect->Y + offsety;
-    rectcpy[2].X = rectcpy[1].X = rect->X + rect->Width;
-    rectcpy[3].Y = rectcpy[2].Y = rect->Y + offsety + rect->Height;
-    transform_and_round_points(graphics, corners, rectcpy, 4);
-
     scaled_rect.X = 0.0;
     scaled_rect.Y = 0.0;
     scaled_rect.Width = rel_width * rect->Width;
     scaled_rect.Height = rel_height * rect->Height;
 
-    if (roundr(scaled_rect.Width) != 0 && roundr(scaled_rect.Height) != 0)
-    {
-        /* FIXME: If only the width or only the height is 0, we should probably still clip */
-        rgn = CreatePolygonRgn(corners, 4, ALTERNATE);
-        SelectClipRgn(hdc, rgn);
-    }
-
     get_font_hfont(graphics, font, &gdifont);
     SelectObject(hdc, gdifont);
 
-- 
1.7.9.4




More information about the wine-patches mailing list