Giovanni Mascellani : d2d1: Do not fill hollow figures.

Alexandre Julliard julliard at winehq.org
Thu Jan 30 16:10:23 CST 2020


Module: wine
Branch: master
Commit: b728b2ff5f0870bc4ae0023dc79f13855f41cff4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b728b2ff5f0870bc4ae0023dc79f13855f41cff4

Author: Giovanni Mascellani <gio at debian.org>
Date:   Thu Jan 30 17:54:40 2020 +0330

d2d1: Do not fill hollow figures.

Signed-off-by: Giovanni Mascellani <gio at debian.org>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d2d1/device.c     |  1 +
 dlls/d2d1/geometry.c   | 14 ++++++++++----
 dlls/d2d1/tests/d2d1.c |  8 ++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 64b3041b2c..0d10ac3e13 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -942,6 +942,7 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t
     if (geometry->fill.bezier_vertex_count)
     {
         buffer_desc.ByteWidth = geometry->fill.bezier_vertex_count * sizeof(*geometry->fill.bezier_vertices);
+        buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER;
         buffer_data.pSysMem = geometry->fill.bezier_vertices;
 
         if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb)))
diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index 2a1fbf5f7c..6e1c648707 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -1548,6 +1548,9 @@ static BOOL d2d_cdt_insert_segments(struct d2d_cdt *cdt, struct d2d_geometry *ge
     {
         figure = &geometry->u.path.figures[i];
 
+        if (figure->flags & D2D_FIGURE_FLAG_HOLLOW)
+            continue;
+
         /* Degenerate figure. */
         if (figure->vertex_count < 2)
             continue;
@@ -2011,6 +2014,8 @@ static HRESULT d2d_path_geometry_triangulate(struct d2d_geometry *geometry)
 
     for (i = 0, vertex_count = 0; i < geometry->u.path.figure_count; ++i)
     {
+        if (geometry->u.path.figures[i].flags & D2D_FIGURE_FLAG_HOLLOW)
+            continue;
         vertex_count += geometry->u.path.figures[i].vertex_count;
     }
 
@@ -2025,6 +2030,8 @@ static HRESULT d2d_path_geometry_triangulate(struct d2d_geometry *geometry)
 
     for (i = 0, j = 0; i < geometry->u.path.figure_count; ++i)
     {
+        if (geometry->u.path.figures[i].flags & D2D_FIGURE_FLAG_HOLLOW)
+            continue;
         memcpy(&vertices[j], geometry->u.path.figures[i].vertices,
                 geometry->u.path.figures[i].vertex_count * sizeof(*vertices));
         j += geometry->u.path.figures[i].vertex_count;
@@ -2455,9 +2462,6 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_BeginFigure(ID2D1GeometrySink *i
         return;
     }
 
-    if (figure_begin != D2D1_FIGURE_BEGIN_FILLED)
-        FIXME("Ignoring figure_begin %#x.\n", figure_begin);
-
     if (!d2d_path_geometry_add_figure(geometry))
     {
         ERR("Failed to add figure.\n");
@@ -2620,7 +2624,7 @@ static BOOL d2d_geometry_get_bezier_segment_idx(struct d2d_geometry *geometry, s
     {
         struct d2d_figure *figure = &geometry->u.path.figures[idx->figure_idx];
 
-        if (!figure->bezier_control_count)
+        if (!figure->bezier_control_count || figure->flags & D2D_FIGURE_FLAG_HOLLOW)
             continue;
 
         for (; idx->vertex_idx < figure->vertex_count; ++idx->vertex_idx)
@@ -2816,6 +2820,8 @@ static HRESULT d2d_geometry_resolve_beziers(struct d2d_geometry *geometry)
 
     for (i = 0; i < geometry->u.path.figure_count; ++i)
     {
+        if (geometry->u.path.figures[i].flags & D2D_FIGURE_FLAG_HOLLOW)
+            continue;
         geometry->fill.bezier_vertex_count += 3 * geometry->u.path.figures[i].bezier_control_count;
     }
 
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 52618858d2..b15ac4f25b 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -7480,13 +7480,13 @@ static void test_fill_geometry(void)
     ID2D1TransformedGeometry_Release(transformed_geometry[0]);
 
     match = compare_figure(surface,   0,   0, 160, 160, 0xff652e89, 0, "gMgB");
-    todo_wine ok(match, "Figure does not match.\n");
+    ok(match, "Figure does not match.\n");
     match = compare_figure(surface, 160,   0, 320, 160, 0xff652e89, 0, "gJAD");
-    todo_wine ok(match, "Figure does not match.\n");
+    ok(match, "Figure does not match.\n");
     match = compare_figure(surface,   0, 160, 160, 320, 0xff652e89, 0, "gJAD");
-    todo_wine ok(match, "Figure does not match.\n");
+    ok(match, "Figure does not match.\n");
     match = compare_figure(surface, 160, 160, 320, 320, 0xff652e89, 0, "gKAG");
-    todo_wine ok(match, "Figure does not match.\n");
+    ok(match, "Figure does not match.\n");
 
     ID2D1SolidColorBrush_Release(brush);
     ID2D1RenderTarget_Release(rt);




More information about the wine-cvs mailing list