Commit 9b04f1c6 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus/metafile: Implement FillPie() recording.

parent 2a7940c9
...@@ -113,6 +113,8 @@ extern void METAFILE_Free(GpMetafile *metafile) DECLSPEC_HIDDEN; ...@@ -113,6 +113,8 @@ extern void METAFILE_Free(GpMetafile *metafile) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_DrawEllipse(GpMetafile *metafile, GpPen *pen, GpRectF *rect) DECLSPEC_HIDDEN; extern GpStatus METAFILE_DrawEllipse(GpMetafile *metafile, GpPen *pen, GpRectF *rect) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_FillEllipse(GpMetafile *metafile, GpBrush *brush, GpRectF *rect) DECLSPEC_HIDDEN; extern GpStatus METAFILE_FillEllipse(GpMetafile *metafile, GpBrush *brush, GpRectF *rect) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_DrawRectangles(GpMetafile *metafile, GpPen *pen, const GpRectF *rects, INT count) DECLSPEC_HIDDEN; extern GpStatus METAFILE_DrawRectangles(GpMetafile *metafile, GpPen *pen, const GpRectF *rects, INT count) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_FillPie(GpMetafile *metafile, GpBrush *brush, const GpRectF *rect,
REAL startAngle, REAL sweepAngle) DECLSPEC_HIDDEN;
extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1, extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN; REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN;
......
...@@ -4402,6 +4402,7 @@ GpStatus WINGDIPAPI GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, ...@@ -4402,6 +4402,7 @@ GpStatus WINGDIPAPI GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x,
{ {
GpStatus stat; GpStatus stat;
GpPath *path; GpPath *path;
GpRectF rect;
TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f)\n", TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f)\n",
graphics, brush, x, y, width, height, startAngle, sweepAngle); graphics, brush, x, y, width, height, startAngle, sweepAngle);
...@@ -4412,6 +4413,15 @@ GpStatus WINGDIPAPI GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, ...@@ -4412,6 +4413,15 @@ GpStatus WINGDIPAPI GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (is_metafile_graphics(graphics))
{
rect.X = x;
rect.Y = y;
rect.Width = width;
rect.Height = height;
return METAFILE_FillPie((GpMetafile *)graphics->image, brush, &rect, startAngle, sweepAngle);
}
stat = GdipCreatePath(FillModeAlternate, &path); stat = GdipCreatePath(FillModeAlternate, &path);
if (stat == Ok) if (stat == Ok)
......
...@@ -4896,6 +4896,59 @@ GpStatus METAFILE_FillEllipse(GpMetafile *metafile, GpBrush *brush, GpRectF *rec ...@@ -4896,6 +4896,59 @@ GpStatus METAFILE_FillEllipse(GpMetafile *metafile, GpBrush *brush, GpRectF *rec
return Ok; return Ok;
} }
GpStatus METAFILE_FillPie(GpMetafile *metafile, GpBrush *brush, const GpRectF *rect,
REAL startAngle, REAL sweepAngle)
{
BOOL is_int_rect, inline_color;
EmfPlusFillPie *record;
DWORD brush_id = -1;
GpStatus stat;
if (metafile->metafile_type == MetafileTypeEmf)
{
FIXME("stub!\n");
return NotImplemented;
}
inline_color = brush->bt == BrushTypeSolidColor;
if (!inline_color)
{
stat = METAFILE_AddBrushObject(metafile, brush, &brush_id);
if (stat != Ok) return stat;
}
is_int_rect = is_integer_rect(rect);
stat = METAFILE_AllocateRecord(metafile, FIELD_OFFSET(EmfPlusFillPie, RectData) +
is_int_rect ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF), (void **)&record);
if (stat != Ok) return stat;
record->Header.Type = EmfPlusRecordTypeFillPie;
if (inline_color)
{
record->Header.Flags = 0x8000;
record->BrushId = ((GpSolidFill *)brush)->color;
}
else
record->BrushId = brush_id;
record->StartAngle = startAngle;
record->SweepAngle = sweepAngle;
if (is_int_rect)
{
record->Header.Flags |= 0x4000;
record->RectData.rect.X = (SHORT)rect->X;
record->RectData.rect.Y = (SHORT)rect->Y;
record->RectData.rect.Width = (SHORT)rect->Width;
record->RectData.rect.Height = (SHORT)rect->Height;
}
else
memcpy(&record->RectData.rectF, rect, sizeof(*rect));
METAFILE_WriteRecords(metafile);
return Ok;
}
static GpStatus METAFILE_AddFontObject(GpMetafile *metafile, GDIPCONST GpFont *font, DWORD *id) static GpStatus METAFILE_AddFontObject(GpMetafile *metafile, GDIPCONST GpFont *font, DWORD *id)
{ {
EmfPlusObject *object_record; EmfPlusObject *object_record;
......
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