diff --git a/impeller/entity/entity_unittests.cc b/impeller/entity/entity_unittests.cc index c5f9d52168bad..a69a5cab934fe 100644 --- a/impeller/entity/entity_unittests.cc +++ b/impeller/entity/entity_unittests.cc @@ -66,7 +66,7 @@ TEST_F(EntityTest, TriangleInsideASquare) { ASSERT_TRUE(OpenPlaygroundHere(entity)); } -TEST_F(EntityTest, DISABLED_BadCubicCurveTest) { +TEST_F(EntityTest, CubicCurveTest) { // Compare with https://fiddle.skia.org/c/b3625f26122c9de7afe7794fcf25ead3 Path path = PathBuilder{} @@ -88,7 +88,7 @@ TEST_F(EntityTest, DISABLED_BadCubicCurveTest) { ASSERT_TRUE(OpenPlaygroundHere(entity)); } -TEST_F(EntityTest, DISABLED_BadCubicCurveAndOverlapTest) { +TEST_F(EntityTest, CubicCurveAndOverlapTest) { // Compare with https://fiddle.skia.org/c/7a05a3e186c65a8dfb732f68020aae06 Path path = PathBuilder{} diff --git a/impeller/renderer/tessellator.cc b/impeller/renderer/tessellator.cc index 3bbcfa30428e7..d98225d54f6d5 100644 --- a/impeller/renderer/tessellator.cc +++ b/impeller/renderer/tessellator.cc @@ -61,12 +61,25 @@ bool Tessellator::Tessellate(const Path::Polyline& contours, /// Feed contour information to the tessellator. /// static_assert(sizeof(Point) == 2 * sizeof(float)); - ::tessAddContour(tessellator.get(), // the C tessellator - kVertexSize, // - contours.points.data(), // - sizeof(Point), // - contours.points.size() // - ); + size_t start_point_index = 0; + for (size_t end_point_index : contours.breaks) { + end_point_index = std::min(end_point_index, contours.points.size()); + ::tessAddContour(tessellator.get(), // the C tessellator + kVertexSize, // + contours.points.data() + start_point_index, // + sizeof(Point), // + end_point_index - start_point_index // + ); + start_point_index = end_point_index; + } + if (start_point_index < contours.points.size()) { + ::tessAddContour(tessellator.get(), // the C tessellator + kVertexSize, // + contours.points.data() + start_point_index, // + sizeof(Point), // + contours.points.size() - start_point_index // + ); + } //---------------------------------------------------------------------------- /// Let's tessellate.