[15/17] gdiplus: Delete GDI objects once they are not needed anymore.
Dmitry Timoshkov
dmitry at baikal.ru
Wed Aug 8 23:02:08 CDT 2012
---
dlls/gdiplus/graphics.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 85234c8..68e2ff1 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -5136,7 +5136,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush)
{
HRGN rgn = NULL;
- HFONT gdifont;
+ HFONT gdifont, oldfont;
GpPointF pt[3], rectcpy[4];
POINT corners[4];
REAL rel_width, rel_height;
@@ -5212,10 +5212,14 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
/* FIXME: If only the width or only the height is 0, we should probably still clip */
rgn = CreatePolygonRgn(corners, 4, ALTERNATE);
SelectClipRgn(hdc, rgn);
+ DeleteObject(rgn);
}
get_font_hfont(graphics, font, &gdifont);
- SelectObject(hdc, gdifont);
+ oldfont = SelectObject(hdc, gdifont);
+ GetTextMetricsW(hdc, &textmetric);
+ SelectObject(hdc, oldfont);
+ DeleteObject(gdifont);
args.graphics = graphics;
args.brush = brush;
@@ -5226,15 +5230,11 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
args.rel_width = rel_width;
args.rel_height = rel_height;
- GetTextMetricsW(hdc, &textmetric);
args.ascent = textmetric.tmAscent / rel_height;
gdip_format_string(hdc, string, length, font, &scaled_rect, format,
draw_string_callback, &args);
- DeleteObject(rgn);
- DeleteObject(gdifont);
-
RestoreDC(hdc, save_state);
DeleteDC(temp_hdc);
--
1.7.11.4
More information about the wine-patches
mailing list