diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c index 0a60561cded..31a3eda4bdd 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 d1f83981a26..0adeef478eb 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,