diff --git a/impeller/aiks/aiks_path_unittests.cc b/impeller/aiks/aiks_path_unittests.cc index 9d5cc3936e858..a1f85dee47484 100644 --- a/impeller/aiks/aiks_path_unittests.cc +++ b/impeller/aiks/aiks_path_unittests.cc @@ -398,5 +398,37 @@ TEST_P(AiksTest, CanRenderClips) { ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); } +TEST_P(AiksTest, CanRenderOverlappingMultiContourPath) { + Canvas canvas; + + Paint paint; + paint.color = Color::Red(); + + PathBuilder::RoundingRadii radii; + radii.top_left = {50, 50}; + radii.top_right = {50, 50}; + radii.bottom_right = {50, 50}; + radii.bottom_left = {50, 50}; + + const Scalar kTriangleHeight = 100; + canvas.Translate(Vector2(200, 200)); + // Form a path similar to the Material drop slider value indicator. + auto path = + PathBuilder{} + .MoveTo({0, kTriangleHeight}) + .LineTo({-kTriangleHeight / 2.0f, 0}) + .LineTo({kTriangleHeight / 2.0f, 0}) + .Close() + .AddRoundedRect( + Rect::MakeXYWH(-kTriangleHeight / 2.0f, -kTriangleHeight / 2.0f, + kTriangleHeight, kTriangleHeight), + radii) + .TakePath(); + + canvas.DrawPath(path, paint); + + ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); +} + } // namespace testing } // namespace impeller diff --git a/impeller/tessellator/tessellator.cc b/impeller/tessellator/tessellator.cc index 8ef6986a35287..e771c6dff9e84 100644 --- a/impeller/tessellator/tessellator.cc +++ b/impeller/tessellator/tessellator.cc @@ -205,6 +205,7 @@ std::vector Tessellator::TessellateConvex(const Path& path, output.emplace_back(output.back()); output.emplace_back(first_point); output.emplace_back(first_point); + output.emplace_back(first_point); } else { output.emplace_back(first_point); } diff --git a/impeller/tessellator/tessellator_unittests.cc b/impeller/tessellator/tessellator_unittests.cc index 2892a0ded85f6..7bbe1e314633c 100644 --- a/impeller/tessellator/tessellator_unittests.cc +++ b/impeller/tessellator/tessellator_unittests.cc @@ -126,8 +126,8 @@ TEST(TessellatorTest, TessellateConvex) { 1.0); std::vector expected = {{0, 0}, {10, 0}, {0, 10}, {10, 10}, - {10, 10}, {20, 20}, {20, 20}, {30, 20}, - {20, 30}, {30, 30}}; + {10, 10}, {20, 20}, {20, 20}, {20, 20}, + {30, 20}, {20, 30}, {30, 30}}; EXPECT_EQ(pts, expected); } } diff --git a/testing/impeller_golden_tests_output.txt b/testing/impeller_golden_tests_output.txt index aeb18abee22e6..b7453ed0ee3a7 100644 --- a/testing/impeller_golden_tests_output.txt +++ b/testing/impeller_golden_tests_output.txt @@ -284,6 +284,9 @@ impeller_Play_AiksTest_CanRenderNestedClips_Vulkan.png impeller_Play_AiksTest_CanRenderOffscreenCheckerboard_Metal.png impeller_Play_AiksTest_CanRenderOffscreenCheckerboard_OpenGLES.png impeller_Play_AiksTest_CanRenderOffscreenCheckerboard_Vulkan.png +impeller_Play_AiksTest_CanRenderOverlappingMultiContourPath_Metal.png +impeller_Play_AiksTest_CanRenderOverlappingMultiContourPath_OpenGLES.png +impeller_Play_AiksTest_CanRenderOverlappingMultiContourPath_Vulkan.png impeller_Play_AiksTest_CanRenderRadialGradientManyColors_Metal.png impeller_Play_AiksTest_CanRenderRadialGradientManyColors_OpenGLES.png impeller_Play_AiksTest_CanRenderRadialGradientManyColors_Vulkan.png