Signed-off-by: Shawn M. Chapla schapla@codeweavers.com --- dlls/gdiplus/tests/metafile.c | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c index 47978d64d8b..e047c9a4212 100644 --- a/dlls/gdiplus/tests/metafile.c +++ b/dlls/gdiplus/tests/metafile.c @@ -1374,6 +1374,64 @@ static void test_nullframerect(void) {
stat = GdipDisposeImage((GpImage*)metafile); expect(Ok, stat); + + hdc = CreateCompatibleDC(0); + + stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, NULL, MetafileFrameUnitMillimeter, + description, &metafile); + expect(Ok, stat); + + DeleteDC(hdc); + + stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics); + expect(Ok, stat); + + stat = GdipGetDC(graphics, &metafile_dc); + expect(Ok, stat); + + if (stat != Ok) + { + GdipDeleteGraphics(graphics); + GdipDisposeImage((GpImage*)metafile); + return; + } + + hbrush = CreateSolidBrush(0xff0000); + + holdbrush = SelectObject(metafile_dc, hbrush); + + Rectangle(metafile_dc, 25, 25, 75, 75); + + SelectObject(metafile_dc, holdbrush); + + DeleteObject(hbrush); + + stat = GdipReleaseDC(graphics, metafile_dc); + expect(Ok, stat); + + stat = GdipCreateSolidFill((ARGB)0xff0000ff, (GpSolidFill**)&brush); + expect(Ok, stat); + + stat = GdipFillRectangleI(graphics, brush, 20, 40, 10, 70); + expect(Ok, stat); + + stat = GdipDeleteBrush(brush); + expect(Ok, stat); + + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); + expect(Ok, stat); + expect(UnitPixel, unit); + todo_wine expectf_(20.0, bounds.X, 0.05); + todo_wine expectf_(25.0, bounds.Y, 0.05); + todo_wine expectf_(55.0, bounds.Width, 1.00); + todo_wine expectf_(55.0, bounds.Width, 0.05); + todo_wine expectf_(85.0, bounds.Height, 0.05); + + stat = GdipDisposeImage((GpImage*)metafile); + expect(Ok, stat); }
static const emfplus_record pagetransform_records[] = {
Signed-off-by: Shawn M. Chapla schapla@codeweavers.com --- dlls/gdiplus/metafile.c | 22 +++++++++++++--------- dlls/gdiplus/tests/metafile.c | 8 ++++---- 2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index e0ff6cae7a4..350642e0208 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -1652,20 +1652,24 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) BYTE* buffer; UINT buffer_size;
+ gdi_bounds_rc = header.u.EmfHeader.rclBounds; + if (gdi_bounds_rc.right > gdi_bounds_rc.left && + gdi_bounds_rc.bottom > gdi_bounds_rc.top) + { + GpPointF *af_min = &metafile->auto_frame_min; + GpPointF *af_max = &metafile->auto_frame_max; + + af_min->X = fmin(af_min->X, gdi_bounds_rc.left); + af_min->Y = fmin(af_min->Y, gdi_bounds_rc.top); + af_max->X = fmax(af_max->X, gdi_bounds_rc.right); + af_max->Y = fmax(af_max->Y, gdi_bounds_rc.bottom); + } + bounds_rc.left = floorf(metafile->auto_frame_min.X * x_scale); bounds_rc.top = floorf(metafile->auto_frame_min.Y * y_scale); bounds_rc.right = ceilf(metafile->auto_frame_max.X * x_scale); bounds_rc.bottom = ceilf(metafile->auto_frame_max.Y * y_scale);
- gdi_bounds_rc = header.u.EmfHeader.rclBounds; - if (gdi_bounds_rc.right > gdi_bounds_rc.left && gdi_bounds_rc.bottom > gdi_bounds_rc.top) - { - bounds_rc.left = min(bounds_rc.left, gdi_bounds_rc.left); - bounds_rc.top = min(bounds_rc.top, gdi_bounds_rc.top); - bounds_rc.right = max(bounds_rc.right, gdi_bounds_rc.right); - bounds_rc.bottom = max(bounds_rc.bottom, gdi_bounds_rc.bottom); - } - buffer_size = GetEnhMetaFileBits(metafile->hemf, 0, NULL); buffer = heap_alloc(buffer_size); if (buffer) diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c index e047c9a4212..33fff3f98cf 100644 --- a/dlls/gdiplus/tests/metafile.c +++ b/dlls/gdiplus/tests/metafile.c @@ -1424,11 +1424,11 @@ static void test_nullframerect(void) { stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); expect(Ok, stat); expect(UnitPixel, unit); - todo_wine expectf_(20.0, bounds.X, 0.05); - todo_wine expectf_(25.0, bounds.Y, 0.05); - todo_wine expectf_(55.0, bounds.Width, 1.00); + expectf_(20.0, bounds.X, 0.05); + expectf_(25.0, bounds.Y, 0.05); + expectf_(55.0, bounds.Width, 1.00); todo_wine expectf_(55.0, bounds.Width, 0.05); - todo_wine expectf_(85.0, bounds.Height, 0.05); + expectf_(85.0, bounds.Height, 0.05);
stat = GdipDisposeImage((GpImage*)metafile); expect(Ok, stat);
Signed-off-by: Esme Povirk esme@codeweavers.com