[PATCH 3/4] gdiplus/metafile: Support hatch brushes for recording

Nikolay Sivov nsivov at codeweavers.com
Wed Nov 1 06:28:59 CDT 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/gdiplus/metafile.c | 45 +++++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 14 deletions(-)

diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c
index c30e718549..b5ddd95c86 100644
--- a/dlls/gdiplus/metafile.c
+++ b/dlls/gdiplus/metafile.c
@@ -3761,28 +3761,45 @@ static GpStatus METAFILE_AddPathObject(GpMetafile *metafile, GpPath *path, DWORD
 
 static GpStatus METAFILE_PrepareBrushData(GpBrush *brush, DWORD *size)
 {
-    if (brush->bt == BrushTypeSolidColor)
+    switch (brush->bt)
     {
-        *size = FIELD_OFFSET(EmfPlusBrush, BrushData.solid) + sizeof(EmfPlusSolidBrushData);
-        return Ok;
+    case BrushTypeSolidColor:
+        *size = FIELD_OFFSET(EmfPlusBrush, BrushData) + sizeof(EmfPlusSolidBrushData);
+        break;
+    case BrushTypeHatchFill:
+        *size = FIELD_OFFSET(EmfPlusBrush, BrushData) + sizeof(EmfPlusHatchBrushData);
+        break;
+    default:
+        FIXME("unsupported brush type: %d\n", brush->bt);
+        return NotImplemented;
     }
 
-    FIXME("unsupported brush type: %d\n", brush->bt);
-    return NotImplemented;
+    return Ok;
 }
 
 static void METAFILE_FillBrushData(GpBrush *brush, EmfPlusBrush *data)
 {
-    if (brush->bt == BrushTypeSolidColor)
-    {
-        GpSolidFill *solid = (GpSolidFill*)brush;
+    data->Version = VERSION_MAGIC2;
+    data->Type = brush->bt;
 
-        data->Version = VERSION_MAGIC2;
-        data->Type = solid->brush.bt;
-        data->BrushData.solid.SolidColor.Blue = solid->color & 0xff;
-        data->BrushData.solid.SolidColor.Green = (solid->color >> 8) & 0xff;
-        data->BrushData.solid.SolidColor.Red = (solid->color >> 16) & 0xff;
-        data->BrushData.solid.SolidColor.Alpha = solid->color >> 24;
+    switch (brush->bt)
+    {
+    case BrushTypeSolidColor:
+    {
+        GpSolidFill *solid = (GpSolidFill *)brush;
+        memcpy(&data->BrushData.solid.SolidColor, &solid->color, sizeof(solid->color));
+        break;
+    }
+    case BrushTypeHatchFill:
+    {
+        GpHatch *hatch = (GpHatch *)brush;
+        data->BrushData.hatch.HatchStyle = hatch->hatchstyle;
+        memcpy(&data->BrushData.hatch.ForeColor, &hatch->forecol, sizeof(hatch->forecol));
+        memcpy(&data->BrushData.hatch.BackColor, &hatch->backcol, sizeof(hatch->backcol));
+        break;
+    }
+    default:
+        FIXME("unsupported brush type: %d\n", brush->bt);
     }
 }
 
-- 
2.14.2




More information about the wine-patches mailing list