gdiplus: Improve GdipSetMetafileDownLevelRasterizationLimit.

Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vincent Povirk 2020-05-17 20:16:25 -05:00 committed by Alexandre Julliard
parent 6c06196497
commit e41058243a
2 changed files with 27 additions and 1 deletions

View File

@ -4028,9 +4028,15 @@ GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metaf
{ {
TRACE("(%p,%u)\n", metafile, limitDpi); TRACE("(%p,%u)\n", metafile, limitDpi);
if (!metafile) if (limitDpi == 0)
limitDpi = 96;
if (!metafile || limitDpi < 10)
return InvalidParameter; return InvalidParameter;
if (!metafile->record_dc)
return WrongState;
metafile->limit_dpi = limitDpi; metafile->limit_dpi = limitDpi;
return Ok; return Ok;

View File

@ -428,6 +428,23 @@ static void test_empty(void)
expect(Ok, stat); expect(Ok, stat);
ok(limit_dpi == 255, "limit_dpi was %d\n", limit_dpi); ok(limit_dpi == 255, "limit_dpi was %d\n", limit_dpi);
stat = GdipSetMetafileDownLevelRasterizationLimit(metafile, 0);
expect(Ok, stat);
limit_dpi = 0xdeadbeef;
stat = GdipGetMetafileDownLevelRasterizationLimit(metafile, &limit_dpi);
expect(Ok, stat);
ok(limit_dpi == 96, "limit_dpi was %d\n", limit_dpi);
stat = GdipSetMetafileDownLevelRasterizationLimit(metafile, 1);
expect(InvalidParameter, stat);
stat = GdipSetMetafileDownLevelRasterizationLimit(metafile, 9);
expect(InvalidParameter, stat);
stat = GdipSetMetafileDownLevelRasterizationLimit(metafile, 10);
expect(Ok, stat);
stat = GdipGetHemfFromMetafile(metafile, &hemf); stat = GdipGetHemfFromMetafile(metafile, &hemf);
expect(InvalidParameter, stat); expect(InvalidParameter, stat);
@ -445,6 +462,9 @@ static void test_empty(void)
expect(WrongState, stat); expect(WrongState, stat);
expect(0xdeadbeef, limit_dpi); expect(0xdeadbeef, limit_dpi);
stat = GdipSetMetafileDownLevelRasterizationLimit(metafile, 200);
expect(WrongState, stat);
check_metafile(metafile, empty_records, "empty metafile", dst_points, &frame, UnitPixel); check_metafile(metafile, empty_records, "empty metafile", dst_points, &frame, UnitPixel);
sync_metafile(&metafile, "empty.emf"); sync_metafile(&metafile, "empty.emf");