Henri Verbeet : d2d1: Fix the segment count for open figures.

Alexandre Julliard julliard at winehq.org
Wed Jun 7 16:24:09 CDT 2017


Module: wine
Branch: master
Commit: 4dcdc80ad58673f3aba48130d975c8b8d171d01b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4dcdc80ad58673f3aba48130d975c8b8d171d01b

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Jun  7 21:31:53 2017 +0200

d2d1: Fix the segment count for open figures.

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

---

 dlls/d2d1/geometry.c   | 2 +-
 dlls/d2d1/tests/d2d1.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index 0a60561..31a3eda 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -2105,7 +2105,6 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_BeginFigure(ID2D1GeometrySink *i
     }
 
     geometry->u.path.state = D2D_GEOMETRY_STATE_FIGURE;
-    ++geometry->u.path.segment_count;
 }
 
 static void STDMETHODCALLTYPE d2d_geometry_sink_AddLines(ID2D1GeometrySink *iface,
@@ -2196,6 +2195,7 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_EndFigure(ID2D1GeometrySink *ifa
     figure->vertex_types[figure->vertex_count - 1] = D2D_VERTEX_TYPE_LINE;
     if (figure_end == D2D1_FIGURE_END_CLOSED)
     {
+        ++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;
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index d1f8398..0adeef4 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -2528,6 +2528,9 @@ static void test_path_geometry(void)
     hr = ID2D1GeometrySink_Close(sink);
     ok(SUCCEEDED(hr), "Failed to close geometry sink, hr %#x.\n", hr);
     ID2D1GeometrySink_Release(sink);
+    hr = ID2D1PathGeometry_GetSegmentCount(geometry, &count);
+    ok(SUCCEEDED(hr), "Failed to get segment count, hr %#x.\n", hr);
+    ok(count == 2, "Got unexpected segment count %u.\n", count);
 
     geometry_sink_init(&simplify_sink);
     hr = ID2D1PathGeometry_Simplify(geometry, D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES,




More information about the wine-cvs mailing list