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

Commit ad8ccf4

Browse files
authored
[Fuchsia] Move physical shape layer compositing to Flutter (#17005)
* [fuchsia] Add labels to Scenic nodes. * [fuchsia] Skip creating Scenic nodes for identity Transforms. * [fuchsia] Assign elevation to Scenic nodes based on paint order. * [fuchsia] Create Scenic OpacityNodes at leaf nodes. * [fuchsia] Composite PhysicalShapeLayers using Skia, except when they need to float above child views. In that case, they will still need to be pulled into separate Scenic nodes to be composited on top of the child view[s]. * [fuchsia] Add tests for Fuchsia-specific layer behavior. Inspect commands going to Scenic and make sure they match what is expected. Also, restructure code to need less member variables, and other cleanups based on review feedback.
1 parent c490cb9 commit ad8ccf4

19 files changed

+935
-130
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ FILE: ../../../flutter/flow/layers/color_filter_layer_unittests.cc
4949
FILE: ../../../flutter/flow/layers/container_layer.cc
5050
FILE: ../../../flutter/flow/layers/container_layer.h
5151
FILE: ../../../flutter/flow/layers/container_layer_unittests.cc
52+
FILE: ../../../flutter/flow/layers/fuchsia_layer_unittests.cc
5253
FILE: ../../../flutter/flow/layers/image_filter_layer.cc
5354
FILE: ../../../flutter/flow/layers/image_filter_layer.h
5455
FILE: ../../../flutter/flow/layers/image_filter_layer_unittests.cc

flow/BUILD.gn

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ source_set("flow") {
8888

8989
if (using_fuchsia_sdk) {
9090
public_deps += [
91+
"$fuchsia_sdk_root/fidl:fuchsia.ui.app",
9192
"$fuchsia_sdk_root/fidl:fuchsia.ui.gfx",
9293
"$fuchsia_sdk_root/pkg:scenic_cpp",
9394
]
@@ -159,6 +160,10 @@ executable("flow_unittests") {
159160
"texture_unittests.cc",
160161
]
161162

163+
if (is_fuchsia) {
164+
sources += [ "layers/fuchsia_layer_unittests.cc" ]
165+
}
166+
162167
deps = [
163168
":flow",
164169
":flow_fixtures",
@@ -170,6 +175,10 @@ executable("flow_unittests") {
170175
"//third_party/googletest:gtest",
171176
"//third_party/skia",
172177
]
178+
179+
if (is_fuchsia) {
180+
deps += [ "//build/fuchsia/pkg:sys_cpp_testing" ]
181+
}
173182
}
174183

175184
if (is_fuchsia) {

flow/layers/child_scene_layer.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ChildSceneLayer::ChildSceneLayer(zx_koid_t layer_id,
2020
void ChildSceneLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
2121
TRACE_EVENT0("flutter", "ChildSceneLayer::Preroll");
2222
set_needs_system_composite(true);
23+
context->child_scene_layer_exists_below = true;
2324

2425
// An alpha "hole punch" is required if the frame behind us is not opaque.
2526
if (!context->is_opaque) {
@@ -49,7 +50,9 @@ void ChildSceneLayer::UpdateScene(SceneUpdateContext& context) {
4950
auto* view_holder = ViewHolder::FromId(layer_id_);
5051
FML_DCHECK(view_holder);
5152

52-
view_holder->UpdateScene(context, offset_, size_, hit_testable_);
53+
view_holder->UpdateScene(context, offset_, size_,
54+
SkScalarRoundToInt(context.alphaf() * 255),
55+
hit_testable_);
5356
}
5457

5558
} // namespace flutter

0 commit comments

Comments
 (0)