Module: wine Branch: master Commit: 3e86d43030e36ce85b330620be3cca638542906a URL: http://source.winehq.org/git/wine.git/?a=commit;h=3e86d43030e36ce85b330620be...
Author: Vincent Povirk vincent@codeweavers.com Date: Sat Oct 30 13:35:43 2010 -0500
gdiplus: Don't rely on an HDC in GdipMeasureString.
---
dlls/gdiplus/graphics.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index da2d966..5ec54ad 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3918,6 +3918,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, { HFONT oldfont; struct measure_string_args args; + HDC temp_hdc=NULL;
TRACE("(%p, %s, %i, %p, %s, %p, %p, %p, %p)\n", graphics, debugstr_wn(string, length), length, font, debugstr_rectf(rect), format, @@ -3928,8 +3929,8 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
if(!graphics->hdc) { - FIXME("graphics object has no HDC\n"); - return NotImplemented; + temp_hdc = graphics->hdc = CreateCompatibleDC(0); + if (!temp_hdc) return OutOfMemory; }
if(linesfilled) *linesfilled = 0; @@ -3954,6 +3955,12 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
DeleteObject(SelectObject(graphics->hdc, oldfont));
+ if (temp_hdc) + { + graphics->hdc = NULL; + DeleteDC(temp_hdc); + } + return Ok; }