[PATCH 4/5] gdiplus/metafile: Implement playback for EmfPlusRecordTypeFillPie

Nikolay Sivov <[email protected]>
Newsgroups gmane.comp.emulators.wine.patches
Message-ID <[email protected]>
Signed-off-by: Nikolay Sivov <[email protected]>
---
 dlls/gdiplus/metafile.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c
index 051f33e1a8..3a9c8a8219 100644
--- a/dlls/gdiplus/metafile.c
+++ b/dlls/gdiplus/metafile.c
@@ -476,6 +476,19 @@ typedef struct EmfPlusFillEllipse
     } RectData;
 } EmfPlusFillEllipse;
 
+typedef struct EmfPlusFillPie
+{
+    EmfPlusRecordHeader Header;
+    DWORD BrushId;
+    float StartAngle;
+    float SweepAngle;
+    union
+    {
+        EmfPlusRect rect;
+        EmfPlusRectF rectF;
+    } RectData;
+} EmfPlusFillPie;
+
 typedef struct EmfPlusFont
 {
     DWORD Version;
@@ -2917,6 +2930,47 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
             GdipDeleteBrush((GpBrush *)solidfill);
             return stat;
         }
+        case EmfPlusRecordTypeFillPie:
+        {
+            EmfPlusFillPie *fill = (EmfPlusFillPie *)header;
+            GpSolidFill *solidfill = NULL;
+            GpBrush *brush;
+
+            if (dataSize <= FIELD_OFFSET(EmfPlusFillPie, RectData) - sizeof(EmfPlusRecordHeader))
+                return InvalidParameter;
+            dataSize -= FIELD_OFFSET(EmfPlusFillPie, RectData) - sizeof(EmfPlusRecordHeader);
+
+            if (dataSize != (flags & 0x4000 ? sizeof(EmfPlusRect) : sizeof(EmfPlusRectF)))
+                return InvalidParameter;
+
+            if (flags & 0x8000) /* S */
+            {
+                stat = GdipCreateSolidFill(fill->BrushId, (GpSolidFill **)&solidfill);
+                if (stat != Ok)
+                    return stat;
+                brush = (GpBrush *)solidfill;
+            }
+            else
+            {
+                if (fill->BrushId >= EmfPlusObjectTableSize ||
+                        real_metafile->objtable[fill->BrushId].type != ObjectTypeBrush)
+                    return InvalidParameter;
+
+                brush = real_metafile->objtable[fill->BrushId].u.brush;
+            }
+
+            if (flags & 0x4000) /* C */
+                stat = GdipFillPieI(real_metafile->playback_graphics, brush, fill->RectData.rect.X,
+                    fill->RectData.rect.Y, fill->RectData.rect.Width, fill->RectData.rect.Height,
+                    fill->StartAngle, fill->SweepAngle);
+            else
+                stat = GdipFillPie(real_metafile->playback_graphics, brush, fill->RectData.rectF.X,
+                    fill->RectData.rectF.Y, fill->RectData.rectF.Width, fill->RectData.rectF.Height,
+                    fill->StartAngle, fill->SweepAngle);
+
+            GdipDeleteBrush((GpBrush *)solidfill);
+            return stat;
+        }
         case EmfPlusRecordTypeDrawPath:
         {
             EmfPlusDrawPath *draw = (EmfPlusDrawPath *)header;
-- 
2.14.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.