Commit 4ed1b4f5 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Allow recording metafiles with a NULL frame.

parent 1e67fcce
......@@ -195,7 +195,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
HDC record_dc;
REAL dpix, dpiy;
REAL framerect_factor_x, framerect_factor_y;
RECT rc;
RECT rc, *lprc;
GpStatus stat;
TRACE("(%p %d %p %d %p %p)\n", hdc, type, frameRect, frameUnit, desc, metafile);
......@@ -203,15 +203,11 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
if (!hdc || type < EmfTypeEmfOnly || type > EmfTypeEmfPlusDual || !metafile)
return InvalidParameter;
if (!frameRect)
{
FIXME("not implemented for NULL rect\n");
return NotImplemented;
}
dpix = (REAL)GetDeviceCaps(hdc, HORZRES) / GetDeviceCaps(hdc, HORZSIZE) * 25.4;
dpiy = (REAL)GetDeviceCaps(hdc, VERTRES) / GetDeviceCaps(hdc, VERTSIZE) * 25.4;
if (frameRect)
{
switch (frameUnit)
{
case MetafileFrameUnitPixel:
......@@ -242,7 +238,12 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
rc.right = rc.left + framerect_factor_x * frameRect->Width;
rc.bottom = rc.top + framerect_factor_y * frameRect->Height;
record_dc = CreateEnhMetaFileW(hdc, NULL, &rc, desc);
lprc = &rc;
}
else
lprc = NULL;
record_dc = CreateEnhMetaFileW(hdc, NULL, lprc, desc);
if (!record_dc)
return GenericError;
......
......@@ -876,7 +876,7 @@ static void test_nullframerect(void) {
hdc = CreateCompatibleDC(0);
stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, NULL, MetafileFrameUnitPixel, description, &metafile);
todo_wine expect(Ok, stat);
expect(Ok, stat);
DeleteDC(hdc);
......@@ -917,10 +917,10 @@ static void test_nullframerect(void) {
stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit);
expect(Ok, stat);
expect(UnitPixel, unit);
expectf_(25.0, bounds.X, 0.05);
expectf_(25.0, bounds.Y, 0.05);
expectf_(75.0, bounds.Width, 0.05);
expectf_(75.0, bounds.Height, 0.05);
todo_wine expectf_(25.0, bounds.X, 0.05);
todo_wine expectf_(25.0, bounds.Y, 0.05);
todo_wine expectf_(75.0, bounds.Width, 0.05);
todo_wine expectf_(75.0, bounds.Height, 0.05);
stat = GdipDisposeImage((GpImage*)metafile);
expect(Ok, stat);
......@@ -966,8 +966,8 @@ static void test_nullframerect(void) {
expect(UnitPixel, unit);
expectf_(25.0, bounds.X, 0.05);
expectf_(25.0, bounds.Y, 0.05);
expectf_(50.0, bounds.Width, 0.05);
expectf_(50.0, bounds.Height, 0.05);
todo_wine expectf_(50.0, bounds.Width, 0.05);
todo_wine expectf_(50.0, bounds.Height, 0.05);
stat = GdipDisposeImage((GpImage*)metafile);
expect(Ok, stat);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment