[PATCH] d2d: Suppress last empty segment also for D2D1_FIGURE_END_OPEN

Stefan Brüns stefan.bruens at rwth-aachen.de
Thu Dec 30 16:18:54 CST 2021


When the last vertex is coincident with the first vertex, the last
segment should be suppressed for both END_OPEN and END_CLOSED.

When the last, zero length segment is not omitted
d2d_geometry_intersect_self will add invalid segments.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51139
Signed-off-by: Stefan Brüns <stefan.bruens at rwth-aachen.de>
---
 dlls/d2d1/geometry.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index a7074899fda..95aaf199ad2 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -2917,8 +2917,9 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_EndFigure(ID2D1GeometrySink *ifa
     {
         ++geometry->u.path.segment_count;
         figure->flags |= D2D_FIGURE_FLAG_CLOSED;
-        if (!memcmp(&figure->vertices[0], &figure->vertices[figure->vertex_count - 1], sizeof(*figure->vertices)))
-            --figure->vertex_count;
+    }
+    if (!memcmp(&figure->vertices[0], &figure->vertices[figure->vertex_count - 1], sizeof(*figure->vertices))) {
+        --figure->vertex_count;
     }
 
     if (!d2d_geometry_add_figure_outline(geometry, figure, figure_end))
-- 
2.34.1




More information about the wine-devel mailing list