Module: wine Branch: master Commit: 3f35a11426dacc21403d78285310da661f93fcd4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=3f35a11426dacc21403d782853...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Mon Aug 27 14:12:01 2012 +0900
gdiplus: get_log_fontW helper requires a valid graphics object.
---
dlls/gdiplus/graphicspath.c | 31 +++++++++++++++++++++++-------- 1 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 80d9244..16f5e2d 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -946,6 +946,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT LOGFONTW lfw; HANDLE hfont; HDC dc; + GpGraphics *graphics; GpPath *backup; struct format_string_args args; int i; @@ -966,26 +967,40 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT scaled_layout_rect.Width = layoutRect->Width * native_height / emSize; scaled_layout_rect.Height = layoutRect->Height * native_height / emSize;
+ if ((status = GdipClonePath(path, &backup)) != Ok) + return status; + + dc = CreateCompatibleDC(0); + status = GdipCreateFromHDC(dc, &graphics); + if (status != Ok) + { + DeleteDC(dc); + GdipDeletePath(backup); + return status; + } + status = GdipCreateFont(family, native_height, style, UnitPixel, &font); if (status != Ok) + { + GdipDeleteGraphics(graphics); + DeleteDC(dc); + GdipDeletePath(backup); return status; + }
- get_log_fontW(font, NULL, &lfw); + get_log_fontW(font, graphics, &lfw); GdipDeleteFont(font); + GdipDeleteGraphics(graphics); + hfont = CreateFontIndirectW(&lfw); if (!hfont) { WARN("Failed to create font\n"); + DeleteDC(dc); + GdipDeletePath(backup); return GenericError; }
- if ((status = GdipClonePath(path, &backup)) != Ok) - { - DeleteObject(hfont); - return status; - } - - dc = CreateCompatibleDC(0); SelectObject(dc, hfont);
GetTextMetricsW(dc, &textmetric);