Vincent Povirk : gdiplus: Don' t rely on an HDC in GdipMeasureCharacterRanges.

Alexandre Julliard julliard at winehq.org
Mon Nov 1 11:54:32 CDT 2010


Module: wine
Branch: master
Commit: 867f3d39e7859104bc415234a86fae773a51809f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=867f3d39e7859104bc415234a86fae773a51809f

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Sat Oct 30 13:28:15 2010 -0500

gdiplus: Don't rely on an HDC in GdipMeasureCharacterRanges.

---

 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 8e203f3..da2d966 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -3834,6 +3834,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
     int i;
     HFONT oldfont;
     struct measure_ranges_args args;
+    HDC temp_hdc=NULL;
 
     TRACE("(%p %s %d %p %s %p %d %p)\n", graphics, debugstr_w(string),
             length, font, debugstr_rectf(layoutRect), stringFormat, regionCount, regions);
@@ -3846,8 +3847,8 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(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 (stringFormat->attr)
@@ -3869,6 +3870,12 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
 
     DeleteObject(SelectObject(graphics->hdc, oldfont));
 
+    if (temp_hdc)
+    {
+        graphics->hdc = NULL;
+        DeleteDC(temp_hdc);
+    }
+
     return stat;
 }
 




More information about the wine-cvs mailing list