Module: wine Branch: master Commit: 9b04f1c660806d2b5babc19d3c0ec017f1c8b40f URL: https://source.winehq.org/git/wine.git/?a=commit;h=9b04f1c660806d2b5babc19d3...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Tue Mar 23 19:08:12 2021 +0300
gdiplus/metafile: Implement FillPie() 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
---
dlls/gdiplus/gdiplus_private.h | 2 ++ dlls/gdiplus/graphics.c | 10 ++++++++ dlls/gdiplus/metafile.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index a617ca4803e..b0e4d967894 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -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_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_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, REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN; diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 2c18ced3e92..922c6591c87 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -4402,6 +4402,7 @@ GpStatus WINGDIPAPI GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, { GpStatus stat; GpPath *path; + GpRectF rect;
TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f)\n", graphics, brush, x, y, width, height, startAngle, sweepAngle); @@ -4412,6 +4413,15 @@ GpStatus WINGDIPAPI GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, if(graphics->busy) 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);
if (stat == Ok) diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index eafcdaee963..a483b3a5e6d 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -4896,6 +4896,59 @@ GpStatus METAFILE_FillEllipse(GpMetafile *metafile, GpBrush *brush, GpRectF *rec 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) { EmfPlusObject *object_record;