gdiplus: GdipDrawString is not supposed to use the layout rectangle for clipping. Take 2.
Dmitry Timoshkov
dmitry at baikal.ru
Tue Apr 3 01:12:45 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.
(This version of the patch gets rid of local region altogether).
---
dlls/gdiplus/graphics.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 2c6c4b2..8c3b41a 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -5127,10 +5127,8 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect,
GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush)
{
- 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 +5182,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);
@@ -5220,7 +5205,6 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
gdip_format_string(hdc, string, length, font, &scaled_rect, format,
draw_string_callback, &args);
- DeleteObject(rgn);
DeleteObject(gdifont);
RestoreDC(hdc, save_state);
--
1.7.9.4
More information about the wine-patches
mailing list