Assert that arc end caps on canvases with root surface transformations are drawn correctly. (flutter/engine#14359)

Verifies that the Skia commit https://skia-review.googlesource.com/c/skia/+/259174 has been pulled into the engine. This should have happened in the roll https://github.com/flutter/engine/pull/14345.

Fixes https://github.com/flutter/flutter/issues/46691
Fixes b/142280381
This commit is contained in:
Chinmay Garde
2019-12-11 15:17:34 -08:00
committed by GitHub
parent 17e3cf8e55
commit 439b705342
5 changed files with 70 additions and 0 deletions

View File

@@ -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

View File

@@ -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",

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -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();
}

View File

@@ -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