gdiplus: Implement GdipGetMetafileDownLevelRasterizationLimit.

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:24 -05:00 committed by Alexandre Julliard
parent 11af7a02bf
commit 6c06196497
5 changed files with 50 additions and 1 deletions

View File

@ -298,7 +298,7 @@
298 stdcall GdipGetLogFontA(ptr ptr ptr) 298 stdcall GdipGetLogFontA(ptr ptr ptr)
299 stdcall GdipGetLogFontW(ptr ptr ptr) 299 stdcall GdipGetLogFontW(ptr ptr ptr)
300 stdcall GdipGetMatrixElements(ptr ptr) 300 stdcall GdipGetMatrixElements(ptr ptr)
301 stub GdipGetMetafileDownLevelRasterizationLimit 301 stdcall GdipGetMetafileDownLevelRasterizationLimit(ptr ptr)
302 stdcall GdipGetMetafileHeaderFromEmf(ptr ptr) 302 stdcall GdipGetMetafileHeaderFromEmf(ptr ptr)
303 stdcall GdipGetMetafileHeaderFromFile(wstr ptr) 303 stdcall GdipGetMetafileHeaderFromFile(wstr ptr)
304 stdcall GdipGetMetafileHeaderFromMetafile(ptr ptr) 304 stdcall GdipGetMetafileHeaderFromMetafile(ptr ptr)

View File

@ -407,6 +407,7 @@ struct GpMetafile{
BOOL auto_frame; /* If true, determine the frame automatically */ BOOL auto_frame; /* If true, determine the frame automatically */
GpPointF auto_frame_min, auto_frame_max; GpPointF auto_frame_min, auto_frame_max;
DWORD next_object_id; DWORD next_object_id;
UINT limit_dpi;
/* playback */ /* playback */
GpGraphics *playback_graphics; GpGraphics *playback_graphics;

View File

@ -810,6 +810,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
(*metafile)->comment_data = NULL; (*metafile)->comment_data = NULL;
(*metafile)->comment_data_size = 0; (*metafile)->comment_data_size = 0;
(*metafile)->comment_data_length = 0; (*metafile)->comment_data_length = 0;
(*metafile)->limit_dpi = 96;
(*metafile)->hemf = NULL; (*metafile)->hemf = NULL;
list_init(&(*metafile)->containers); list_init(&(*metafile)->containers);
@ -4006,11 +4007,32 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream *stream,
return Ok; return Ok;
} }
GpStatus WINGDIPAPI GdipGetMetafileDownLevelRasterizationLimit(GDIPCONST GpMetafile *metafile,
UINT *limitDpi)
{
TRACE("(%p,%p)\n", metafile, limitDpi);
if (!metafile || !limitDpi)
return InvalidParameter;
if (!metafile->record_dc)
return WrongState;
*limitDpi = metafile->limit_dpi;
return Ok;
}
GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile, GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile,
UINT limitDpi) UINT limitDpi)
{ {
TRACE("(%p,%u)\n", metafile, limitDpi); TRACE("(%p,%u)\n", metafile, limitDpi);
if (!metafile)
return InvalidParameter;
metafile->limit_dpi = limitDpi;
return Ok; return Ok;
} }

View File

@ -379,6 +379,7 @@ static void test_empty(void)
static const GpRectF frame = {0.0, 0.0, 100.0, 100.0}; static const GpRectF frame = {0.0, 0.0, 100.0, 100.0};
static const GpPointF dst_points[3] = {{0.0,0.0},{100.0,0.0},{0.0,100.0}}; static const GpPointF dst_points[3] = {{0.0,0.0},{100.0,0.0},{0.0,100.0}};
static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0}; static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0};
UINT limit_dpi;
hdc = CreateCompatibleDC(0); hdc = CreateCompatibleDC(0);
@ -408,6 +409,25 @@ static void test_empty(void)
if (stat != Ok) if (stat != Ok)
return; return;
stat = GdipGetMetafileDownLevelRasterizationLimit(metafile, NULL);
expect(InvalidParameter, stat);
stat = GdipGetMetafileDownLevelRasterizationLimit(NULL, &limit_dpi);
expect(InvalidParameter, 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, 255);
expect(Ok, stat);
limit_dpi = 0xdeadbeef;
stat = GdipGetMetafileDownLevelRasterizationLimit(metafile, &limit_dpi);
expect(Ok, stat);
ok(limit_dpi == 255, "limit_dpi was %d\n", limit_dpi);
stat = GdipGetHemfFromMetafile(metafile, &hemf); stat = GdipGetHemfFromMetafile(metafile, &hemf);
expect(InvalidParameter, stat); expect(InvalidParameter, stat);
@ -420,6 +440,11 @@ static void test_empty(void)
stat = GdipDeleteGraphics(graphics); stat = GdipDeleteGraphics(graphics);
expect(Ok, stat); expect(Ok, stat);
limit_dpi = 0xdeadbeef;
stat = GdipGetMetafileDownLevelRasterizationLimit(metafile, &limit_dpi);
expect(WrongState, stat);
expect(0xdeadbeef, limit_dpi);
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");

View File

@ -545,6 +545,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR*, GDIPCONST Wm
GpMetafile**); GpMetafile**);
GpStatus WINGDIPAPI GdipCreateMetafileFromFile(GDIPCONST WCHAR*,GpMetafile**); GpStatus WINGDIPAPI GdipCreateMetafileFromFile(GDIPCONST WCHAR*,GpMetafile**);
GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream*,GpMetafile**); GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream*,GpMetafile**);
GpStatus WINGDIPAPI GdipGetMetafileDownLevelRasterizationLimit(GDIPCONST GpMetafile*,UINT*);
GpStatus WINGDIPAPI GdipGetHemfFromMetafile(GpMetafile*,HENHMETAFILE*); GpStatus WINGDIPAPI GdipGetHemfFromMetafile(GpMetafile*,HENHMETAFILE*);
GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile*,EmfPlusRecordType,UINT,UINT,GDIPCONST BYTE*); GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile*,EmfPlusRecordType,UINT,UINT,GDIPCONST BYTE*);
GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile*,UINT); GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile*,UINT);