Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1c34b80

Browse files
author
jonahwilliams
committed
Merge branch 'main' of github.com:flutter/engine into compute_uv_vertex_stage
2 parents 7fdfd0b + 62c9f17 commit 1c34b80

File tree

6 files changed

+72
-13
lines changed

6 files changed

+72
-13
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ vars = {
1414
'flutter_git': 'https://flutter.googlesource.com',
1515
'skia_git': 'https://skia.googlesource.com',
1616
'llvm_git': 'https://llvm.googlesource.com',
17-
'skia_revision': '3b32e3280b673a8f182f95f12b05f2b6151b242b',
17+
'skia_revision': 'e6de04b82b57a7bbde7e0b55f32d76cd8f988117',
1818

1919
# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
2020
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.

ci/licenses_golden/licenses_skia

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: d6eda98283b16f0ad3d8c2ff62f1b6c6
1+
Signature: 4a4bb13ba6043f49616f5d53097ac2b5
22

33
====================================================================================================
44
LIBRARY: etc1

impeller/aiks/aiks_unittests.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3145,6 +3145,29 @@ TEST_P(AiksTest, DrawAtlasPlusWideGamut) {
31453145
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
31463146
}
31473147

3148+
// https://github.com/flutter/flutter/issues/146648
3149+
TEST_P(AiksTest, StrokedPathWithMoveToThenCloseDrawnCorrectly) {
3150+
Path path = PathBuilder{}
3151+
.MoveTo({0, 400})
3152+
.LineTo({0, 0})
3153+
.LineTo({400, 0})
3154+
// MoveTo implicitly adds a contour, ensure that close doesn't
3155+
// add another nearly-empty contour.
3156+
.MoveTo({0, 400})
3157+
.Close()
3158+
.TakePath();
3159+
3160+
Canvas canvas;
3161+
canvas.Translate({50, 50, 0});
3162+
canvas.DrawPath(path, {
3163+
.color = Color::Blue(),
3164+
.stroke_width = 10,
3165+
.stroke_cap = Cap::kRound,
3166+
.style = Paint::Style::kStroke,
3167+
});
3168+
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
3169+
}
3170+
31483171
} // namespace testing
31493172
} // namespace impeller
31503173

impeller/geometry/path_builder.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ PathBuilder& PathBuilder::MoveTo(Point point, bool relative) {
3838
}
3939

4040
PathBuilder& PathBuilder::Close() {
41-
LineTo(subpath_start_);
41+
// If the subpath start is the same as the current position, this
42+
// is an empty contour and inserting a line segment will just
43+
// confuse the tessellator.
44+
if (subpath_start_ != current_) {
45+
LineTo(subpath_start_);
46+
}
4247
SetContourClosed(true);
4348
AddContourComponent(current_);
4449
return *this;

impeller/geometry/path_unittests.cc

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,26 @@ TEST(PathTest, PathBuilderSetsCorrectContourPropertiesForAddCommands) {
4747
Path path = PathBuilder{}.AddCircle({100, 100}, 50).TakePath();
4848
ContourComponent contour;
4949
path.GetContourComponentAtIndex(0, contour);
50-
ASSERT_POINT_NEAR(contour.destination, Point(100, 50));
51-
ASSERT_TRUE(contour.is_closed);
50+
EXPECT_POINT_NEAR(contour.destination, Point(100, 50));
51+
EXPECT_TRUE(contour.is_closed);
5252
}
5353

5454
{
5555
Path path =
5656
PathBuilder{}.AddOval(Rect::MakeXYWH(100, 100, 100, 100)).TakePath();
5757
ContourComponent contour;
5858
path.GetContourComponentAtIndex(0, contour);
59-
ASSERT_POINT_NEAR(contour.destination, Point(150, 100));
60-
ASSERT_TRUE(contour.is_closed);
59+
EXPECT_POINT_NEAR(contour.destination, Point(150, 100));
60+
EXPECT_TRUE(contour.is_closed);
6161
}
6262

6363
{
6464
Path path =
6565
PathBuilder{}.AddRect(Rect::MakeXYWH(100, 100, 100, 100)).TakePath();
6666
ContourComponent contour;
6767
path.GetContourComponentAtIndex(0, contour);
68-
ASSERT_POINT_NEAR(contour.destination, Point(100, 100));
69-
ASSERT_TRUE(contour.is_closed);
68+
EXPECT_POINT_NEAR(contour.destination, Point(100, 100));
69+
EXPECT_TRUE(contour.is_closed);
7070
}
7171

7272
{
@@ -75,8 +75,8 @@ TEST(PathTest, PathBuilderSetsCorrectContourPropertiesForAddCommands) {
7575
.TakePath();
7676
ContourComponent contour;
7777
path.GetContourComponentAtIndex(0, contour);
78-
ASSERT_POINT_NEAR(contour.destination, Point(110, 100));
79-
ASSERT_TRUE(contour.is_closed);
78+
EXPECT_POINT_NEAR(contour.destination, Point(110, 100));
79+
EXPECT_TRUE(contour.is_closed);
8080
}
8181

8282
{
@@ -86,8 +86,8 @@ TEST(PathTest, PathBuilderSetsCorrectContourPropertiesForAddCommands) {
8686
.TakePath();
8787
ContourComponent contour;
8888
path.GetContourComponentAtIndex(0, contour);
89-
ASSERT_POINT_NEAR(contour.destination, Point(110, 100));
90-
ASSERT_TRUE(contour.is_closed);
89+
EXPECT_POINT_NEAR(contour.destination, Point(110, 100));
90+
EXPECT_TRUE(contour.is_closed);
9191
}
9292

9393
// Open shapes.
@@ -454,6 +454,34 @@ TEST(PathTest, SimplePath) {
454454
});
455455
}
456456

457+
TEST(PathTest, RepeatCloseDoesNotAddNewLines) {
458+
PathBuilder builder;
459+
auto path = builder.LineTo({0, 10})
460+
.LineTo({10, 10})
461+
.Close() // Returns to (0, 0)
462+
.Close() // No Op
463+
.Close() // Still No op
464+
.TakePath();
465+
466+
EXPECT_EQ(path.GetComponentCount(), 5u);
467+
EXPECT_EQ(path.GetComponentCount(Path::ComponentType::kLinear), 3u);
468+
EXPECT_EQ(path.GetComponentCount(Path::ComponentType::kContour), 2u);
469+
}
470+
471+
TEST(PathTest, CloseAfterMoveDoesNotAddNewLines) {
472+
PathBuilder builder;
473+
auto path = builder.LineTo({0, 10})
474+
.LineTo({10, 10})
475+
.MoveTo({30, 30}) // Moves to (30, 30)
476+
.Close() // No Op
477+
.Close() // Still No op
478+
.TakePath();
479+
480+
EXPECT_EQ(path.GetComponentCount(), 4u);
481+
EXPECT_EQ(path.GetComponentCount(Path::ComponentType::kLinear), 2u);
482+
EXPECT_EQ(path.GetComponentCount(Path::ComponentType::kContour), 2u);
483+
}
484+
457485
TEST(PathTest, CanBeCloned) {
458486
PathBuilder builder;
459487
builder.MoveTo({10, 10});

testing/impeller_golden_tests_output.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,9 @@ impeller_Play_AiksTest_SrgbToLinearFilterSubpassCollapseOptimization_Vulkan.png
718718
impeller_Play_AiksTest_StrokedCirclesRenderCorrectly_Metal.png
719719
impeller_Play_AiksTest_StrokedCirclesRenderCorrectly_OpenGLES.png
720720
impeller_Play_AiksTest_StrokedCirclesRenderCorrectly_Vulkan.png
721+
impeller_Play_AiksTest_StrokedPathWithMoveToThenCloseDrawnCorrectly_Metal.png
722+
impeller_Play_AiksTest_StrokedPathWithMoveToThenCloseDrawnCorrectly_OpenGLES.png
723+
impeller_Play_AiksTest_StrokedPathWithMoveToThenCloseDrawnCorrectly_Vulkan.png
721724
impeller_Play_AiksTest_SubpassWithClearColorOptimization_Metal.png
722725
impeller_Play_AiksTest_SubpassWithClearColorOptimization_OpenGLES.png
723726
impeller_Play_AiksTest_SubpassWithClearColorOptimization_Vulkan.png

0 commit comments

Comments
 (0)