Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ FILE: ../../../flutter/shell/platform/embedder/embedder_task_runner.cc
FILE: ../../../flutter/shell/platform/embedder/embedder_task_runner.h
FILE: ../../../flutter/shell/platform/embedder/embedder_thread_host.cc
FILE: ../../../flutter/shell/platform/embedder/embedder_thread_host.h
FILE: ../../../flutter/shell/platform/embedder/fixtures/arc_end_caps.png
FILE: ../../../flutter/shell/platform/embedder/fixtures/compositor.png
FILE: ../../../flutter/shell/platform/embedder/fixtures/compositor_root_surface_xformation.png
FILE: ../../../flutter/shell/platform/embedder/fixtures/compositor_software.png
Expand Down
1 change: 1 addition & 0 deletions shell/platform/embedder/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ config("embedder_prefix_config") {
test_fixtures("fixtures") {
dart_main = "fixtures/main.dart"
fixtures = [
"fixtures/arc_end_caps.png",
"fixtures/compositor.png",
"fixtures/compositor_root_surface_xformation.png",
"fixtures/compositor_software.png",
Expand Down
Binary file added shell/platform/embedder/fixtures/arc_end_caps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions shell/platform/embedder/fixtures/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -620,3 +620,30 @@ void scene_with_no_container() {
};
window.scheduleFrame();
}

Picture CreateArcEndCapsPicture() {
PictureRecorder baseRecorder = PictureRecorder();
Canvas canvas = Canvas(baseRecorder);

var style = Paint()
..strokeWidth = 12.0
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeJoin = StrokeJoin.miter;

style.color = Color.fromARGB(255, 255, 0, 0);
canvas.drawArc(Rect.fromLTRB(0.0, 0.0, 500.0, 500.0), 1.57, 1.0, false, style);

return baseRecorder.endRecording();

}

@pragma('vm:entry-point')
void arc_end_caps_correct() {
window.onBeginFrame = (Duration duration) {
SceneBuilder builder = SceneBuilder();
builder.addPicture(Offset(0.0, 0.0), CreateArcEndCapsPicture());
window.render(builder.build());
};
window.scheduleFrame();
}
41 changes: 41 additions & 0 deletions shell/platform/embedder/tests/embedder_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3550,5 +3550,46 @@ TEST_F(EmbedderTest, SceneWithNoRootContainerIsAcceptable) {
latch.Wait();
}

// Verifies that https://skia-review.googlesource.com/c/skia/+/259174 is pulled
// into the engine.
TEST_F(EmbedderTest, ArcEndCapsAreDrawnCorrectly) {
auto& context = GetEmbedderContext();

EmbedderConfigBuilder builder(context);
builder.SetOpenGLRendererConfig(SkISize::Make(800, 1024));
builder.SetCompositor();
builder.SetDartEntrypoint("arc_end_caps_correct");

const auto root_surface_transformation = SkMatrix()
.preScale(1.0, -1.0)
.preTranslate(1024.0, -800.0)
.preRotate(90.0);

context.SetRootSurfaceTransformation(root_surface_transformation);

auto engine = builder.LaunchEngine();

fml::AutoResetWaitableEvent latch;
sk_sp<SkImage> scene_image;
context.SetNextSceneCallback([&](sk_sp<SkImage> scene) {
scene_image = std::move(scene);
latch.Signal();
});

ASSERT_TRUE(engine.is_valid());

FlutterWindowMetricsEvent event = {};
event.struct_size = sizeof(event);
event.width = 1024;
event.height = 800;
event.pixel_ratio = 1.0;
ASSERT_EQ(FlutterEngineSendWindowMetricsEvent(engine.get(), &event),
kSuccess);

latch.Wait();

ASSERT_TRUE(ImageMatchesFixture("arc_end_caps.png", scene_image));
}

} // namespace testing
} // namespace flutter