Commit 6c061964 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Implement GdipGetMetafileDownLevelRasterizationLimit.

parent 11af7a02
...@@ -298,7 +298,7 @@ ...@@ -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)
......
...@@ -407,6 +407,7 @@ struct GpMetafile{ ...@@ -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;
......
...@@ -810,6 +810,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF ...@@ -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, ...@@ -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;
} }
......
...@@ -379,6 +379,7 @@ static void test_empty(void) ...@@ -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) ...@@ -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) ...@@ -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");
......
...@@ -545,6 +545,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR*, GDIPCONST Wm ...@@ -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);
......
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