mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 17:13:37 +00:00
gdiplus/metafile: Implement ResetClip() recording.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Esme Povirk <esme@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
33d2f6b7ec
commit
24278c4fc7
|
@ -118,6 +118,7 @@ extern GpStatus METAFILE_FillPie(GpMetafile *metafile, GpBrush *brush, const GpR
|
|||
extern GpStatus METAFILE_DrawArc(GpMetafile *metafile, GpPen *pen, const GpRectF *rect,
|
||||
REAL startAngle, REAL sweepAngle) DECLSPEC_HIDDEN;
|
||||
extern GpStatus METAFILE_OffsetClip(GpMetafile *metafile, REAL dx, REAL dy) DECLSPEC_HIDDEN;
|
||||
extern GpStatus METAFILE_ResetClip(GpMetafile *metafile) DECLSPEC_HIDDEN;
|
||||
|
||||
extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
|
||||
REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -5809,6 +5809,8 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
|
|||
|
||||
GpStatus WINGDIPAPI GdipResetClip(GpGraphics *graphics)
|
||||
{
|
||||
GpStatus stat;
|
||||
|
||||
TRACE("(%p)\n", graphics);
|
||||
|
||||
if(!graphics)
|
||||
|
@ -5817,6 +5819,13 @@ GpStatus WINGDIPAPI GdipResetClip(GpGraphics *graphics)
|
|||
if(graphics->busy)
|
||||
return ObjectBusy;
|
||||
|
||||
if (is_metafile_graphics(graphics))
|
||||
{
|
||||
stat = METAFILE_ResetClip((GpMetafile *)graphics->image);
|
||||
if (stat != Ok)
|
||||
return stat;
|
||||
}
|
||||
|
||||
return GdipSetInfinite(graphics->clip);
|
||||
}
|
||||
|
||||
|
|
|
@ -5227,3 +5227,24 @@ GpStatus METAFILE_OffsetClip(GpMetafile *metafile, REAL dx, REAL dy)
|
|||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus METAFILE_ResetClip(GpMetafile *metafile)
|
||||
{
|
||||
EmfPlusRecordHeader *record;
|
||||
GpStatus stat;
|
||||
|
||||
if (metafile->metafile_type == MetafileTypeEmf)
|
||||
{
|
||||
FIXME("stub!\n");
|
||||
return NotImplemented;
|
||||
}
|
||||
|
||||
stat = METAFILE_AllocateRecord(metafile, EmfPlusRecordTypeResetClip,
|
||||
sizeof(*record), (void **)&record);
|
||||
if (stat != Ok)
|
||||
return stat;
|
||||
|
||||
METAFILE_WriteRecords(metafile);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
|
|
@ -3755,6 +3755,54 @@ static void test_offsetclip(void)
|
|||
expect(Ok, stat);
|
||||
}
|
||||
|
||||
static void test_resetclip(void)
|
||||
{
|
||||
static const GpRectF frame = { 0.0f, 0.0f, 100.0f, 100.0f };
|
||||
static const emfplus_record reset_clip_records[] =
|
||||
{
|
||||
{ EMR_HEADER },
|
||||
{ EmfPlusRecordTypeHeader },
|
||||
{ EmfPlusRecordTypeResetClip },
|
||||
{ EmfPlusRecordTypeResetClip },
|
||||
{ EmfPlusRecordTypeEndOfFile },
|
||||
{ EMR_EOF },
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
GpMetafile *metafile;
|
||||
GpGraphics *graphics;
|
||||
HENHMETAFILE hemf;
|
||||
GpStatus stat;
|
||||
HDC hdc;
|
||||
|
||||
hdc = CreateCompatibleDC(0);
|
||||
stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile);
|
||||
expect(Ok, stat);
|
||||
DeleteDC(hdc);
|
||||
|
||||
stat = GdipGetImageGraphicsContext((GpImage *)metafile, &graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipResetClip(graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipResetClip(graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeleteGraphics(graphics);
|
||||
expect(Ok, stat);
|
||||
sync_metafile(&metafile, "reset_clip.emf");
|
||||
|
||||
stat = GdipGetHemfFromMetafile(metafile, &hemf);
|
||||
expect(Ok, stat);
|
||||
|
||||
check_emfplus(hemf, reset_clip_records, "reset clip");
|
||||
DeleteEnhMetaFile(hemf);
|
||||
|
||||
stat = GdipDisposeImage((GpImage*)metafile);
|
||||
expect(Ok, stat);
|
||||
}
|
||||
|
||||
START_TEST(metafile)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -3813,6 +3861,7 @@ START_TEST(metafile)
|
|||
test_fillellipse();
|
||||
test_drawrectangle();
|
||||
test_offsetclip();
|
||||
test_resetclip();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue