gdiplus: Don't rely on an HDC in GdipMeasureCharacterRanges.
This commit is contained in:
parent
cb21d1caf4
commit
867f3d39e7
|
@ -3834,6 +3834,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
|
||||||
int i;
|
int i;
|
||||||
HFONT oldfont;
|
HFONT oldfont;
|
||||||
struct measure_ranges_args args;
|
struct measure_ranges_args args;
|
||||||
|
HDC temp_hdc=NULL;
|
||||||
|
|
||||||
TRACE("(%p %s %d %p %s %p %d %p)\n", graphics, debugstr_w(string),
|
TRACE("(%p %s %d %p %s %p %d %p)\n", graphics, debugstr_w(string),
|
||||||
length, font, debugstr_rectf(layoutRect), stringFormat, regionCount, regions);
|
length, font, debugstr_rectf(layoutRect), stringFormat, regionCount, regions);
|
||||||
|
@ -3846,8 +3847,8 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
|
||||||
|
|
||||||
if(!graphics->hdc)
|
if(!graphics->hdc)
|
||||||
{
|
{
|
||||||
FIXME("graphics object has no HDC\n");
|
temp_hdc = graphics->hdc = CreateCompatibleDC(0);
|
||||||
return NotImplemented;
|
if (!temp_hdc) return OutOfMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stringFormat->attr)
|
if (stringFormat->attr)
|
||||||
|
@ -3869,6 +3870,12 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
|
||||||
|
|
||||||
DeleteObject(SelectObject(graphics->hdc, oldfont));
|
DeleteObject(SelectObject(graphics->hdc, oldfont));
|
||||||
|
|
||||||
|
if (temp_hdc)
|
||||||
|
{
|
||||||
|
graphics->hdc = NULL;
|
||||||
|
DeleteDC(temp_hdc);
|
||||||
|
}
|
||||||
|
|
||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue