Vincent Povirk : gdiplus: Select the font into the appropriate hdc in GdipMeasureString.
Alexandre Julliard
julliard at winehq.org
Fri Mar 18 11:30:19 CDT 2011
Module: wine
Branch: master
Commit: 314ec7178d8ef68e75670096b1cbd0fa3733c3aa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=314ec7178d8ef68e75670096b1cbd0fa3733c3aa
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Fri Mar 18 09:47:58 2011 -0500
gdiplus: Select the font into the appropriate hdc in GdipMeasureString.
---
dlls/gdiplus/graphics.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 479f26e..7d2dbcd 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -4427,7 +4427,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
{
HFONT oldfont;
struct measure_string_args args;
- HDC temp_hdc=NULL;
+ HDC temp_hdc=NULL, hdc;
TRACE("(%p, %s, %i, %p, %s, %p, %p, %p, %p)\n", graphics,
debugstr_wn(string, length), length, font, debugstr_rectf(rect), format,
@@ -4438,9 +4438,11 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
if(!graphics->hdc)
{
- temp_hdc = CreateCompatibleDC(0);
+ hdc = temp_hdc = CreateCompatibleDC(0);
if (!temp_hdc) return OutOfMemory;
}
+ else
+ hdc = graphics->hdc;
if(linesfilled) *linesfilled = 0;
if(codepointsfitted) *codepointsfitted = 0;
@@ -4448,7 +4450,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
if(format)
TRACE("may be ignoring some format flags: attr %x\n", format->attr);
- oldfont = SelectObject(graphics->hdc, CreateFontIndirectW(&font->lfw));
+ oldfont = SelectObject(hdc, CreateFontIndirectW(&font->lfw));
bounds->X = rect->X;
bounds->Y = rect->Y;
@@ -4459,10 +4461,10 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
args.codepointsfitted = codepointsfitted;
args.linesfilled = linesfilled;
- gdip_format_string(graphics->hdc ? graphics->hdc : temp_hdc, string, length, font, rect, format,
+ gdip_format_string(hdc, string, length, font, rect, format,
measure_string_callback, &args);
- DeleteObject(SelectObject(graphics->hdc, oldfont));
+ DeleteObject(SelectObject(hdc, oldfont));
if (temp_hdc)
DeleteDC(temp_hdc);
More information about the wine-cvs
mailing list