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

Commit 6ea69a0

Browse files
authored
Revert "Wire up Opacity on Fuchsia, round 2 (#14024)" (#14543)
This reverts commit d117ac9.
1 parent fa1adf4 commit 6ea69a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+487
-668
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ FILE: ../../../flutter/flow/layers/color_filter_layer_unittests.cc
4848
FILE: ../../../flutter/flow/layers/container_layer.cc
4949
FILE: ../../../flutter/flow/layers/container_layer.h
5050
FILE: ../../../flutter/flow/layers/container_layer_unittests.cc
51-
FILE: ../../../flutter/flow/layers/elevated_container_layer.cc
52-
FILE: ../../../flutter/flow/layers/elevated_container_layer.h
53-
FILE: ../../../flutter/flow/layers/fuchsia_system_composited_layer.cc
54-
FILE: ../../../flutter/flow/layers/fuchsia_system_composited_layer.h
5551
FILE: ../../../flutter/flow/layers/layer.cc
5652
FILE: ../../../flutter/flow/layers/layer.h
5753
FILE: ../../../flutter/flow/layers/layer_tree.cc

flow/BUILD.gn

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ source_set("flow") {
2828
"layers/color_filter_layer.h",
2929
"layers/container_layer.cc",
3030
"layers/container_layer.h",
31-
"layers/elevated_container_layer.cc",
32-
"layers/elevated_container_layer.h",
3331
"layers/layer.cc",
3432
"layers/layer.h",
3533
"layers/layer_tree.cc",
@@ -78,8 +76,6 @@ source_set("flow") {
7876
sources += [
7977
"layers/child_scene_layer.cc",
8078
"layers/child_scene_layer.h",
81-
"layers/fuchsia_system_composited_layer.cc",
82-
"layers/fuchsia_system_composited_layer.h",
8379
"scene_update_context.cc",
8480
"scene_update_context.h",
8581
"view_holder.cc",

flow/layers/child_scene_layer.cc

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,10 @@ 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-
24-
// An alpha "hole punch" is required if the frame behind us is not opaque.
25-
if (!context->is_opaque) {
26-
set_paint_bounds(
27-
SkRect::MakeXYWH(offset_.fX, offset_.fY, size_.fWidth, size_.fHeight));
28-
}
2923
}
3024

3125
void ChildSceneLayer::Paint(PaintContext& context) const {
32-
TRACE_EVENT0("flutter", "ChildSceneLayer::Paint");
33-
FML_DCHECK(needs_painting());
34-
35-
// If we are being rendered into our own frame using the system compositor,
36-
// then it is neccesary to "punch a hole" in the canvas/frame behind us so
37-
// that group opacity looks correct.
38-
SkPaint paint;
39-
paint.setColor(SK_ColorTRANSPARENT);
40-
paint.setBlendMode(SkBlendMode::kSrc);
41-
context.leaf_nodes_canvas->drawRect(paint_bounds(), paint);
26+
FML_NOTREACHED() << "This layer never needs painting.";
4227
}
4328

4429
void ChildSceneLayer::UpdateScene(SceneUpdateContext& context) {

flow/layers/container_layer.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ namespace flutter {
99
ContainerLayer::ContainerLayer() {}
1010

1111
void ContainerLayer::Add(std::shared_ptr<Layer> layer) {
12-
layers_.emplace_back(std::move(layer));
12+
layer->set_parent(this);
13+
layers_.push_back(std::move(layer));
1314
}
1415

1516
void ContainerLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {

flow/layers/container_layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ContainerLayer : public Layer {
1414
public:
1515
ContainerLayer();
1616

17-
virtual void Add(std::shared_ptr<Layer> layer);
17+
void Add(std::shared_ptr<Layer> layer);
1818

1919
void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
2020
void Paint(PaintContext& context) const override;

flow/layers/elevated_container_layer.cc

Lines changed: 0 additions & 49 deletions
This file was deleted.

flow/layers/elevated_container_layer.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

flow/layers/fuchsia_system_composited_layer.cc

Lines changed: 0 additions & 55 deletions
This file was deleted.

flow/layers/fuchsia_system_composited_layer.h

Lines changed: 0 additions & 37 deletions
This file was deleted.

flow/layers/layer.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
namespace flutter {
1111

1212
Layer::Layer()
13-
: paint_bounds_(SkRect::MakeEmpty()),
14-
unique_id_(NextUniqueID()),
15-
needs_system_composite_(false) {}
13+
: parent_(nullptr),
14+
needs_system_composite_(false),
15+
paint_bounds_(SkRect::MakeEmpty()),
16+
unique_id_(NextUniqueID()) {}
1617

1718
Layer::~Layer() = default;
1819

flow/layers/layer.h

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ static constexpr SkRect kGiantRect = SkRect::MakeLTRB(-1E9F, -1E9F, 1E9F, 1E9F);
4242
// This should be an exact copy of the Clip enum in painting.dart.
4343
enum Clip { none, hardEdge, antiAlias, antiAliasWithSaveLayer };
4444

45+
class ContainerLayer;
46+
4547
struct PrerollContext {
4648
RasterCache* raster_cache;
4749
GrContext* gr_context;
@@ -51,21 +53,13 @@ struct PrerollContext {
5153
SkRect cull_rect;
5254
bool surface_needs_readback;
5355

54-
// These allow us to paint in the end of subtree Preroll.
56+
// The following allows us to paint in the end of subtree preroll
5557
const Stopwatch& raster_time;
5658
const Stopwatch& ui_time;
5759
TextureRegistry& texture_registry;
5860
const bool checkerboard_offscreen_layers;
59-
60-
// These allow us to make use of the scene metrics during Preroll.
61-
float frame_physical_depth;
62-
float frame_device_pixel_ratio;
63-
64-
// These allow us to track properties like elevation, opacity, and the
65-
// prescence of a platform view during Preroll.
6661
float total_elevation = 0.0f;
6762
bool has_platform_view = false;
68-
bool is_opaque = true;
6963
};
7064

7165
// Represents a single composited layer. Created on the UI thread but then
@@ -123,10 +117,6 @@ class Layer {
123117
TextureRegistry& texture_registry;
124118
const RasterCache* raster_cache;
125119
const bool checkerboard_offscreen_layers;
126-
127-
// These allow us to make use of the scene metrics during Paint.
128-
float frame_physical_depth;
129-
float frame_device_pixel_ratio;
130120
};
131121

132122
// Calls SkCanvas::saveLayer and restores the layer upon destruction. Also
@@ -163,6 +153,10 @@ class Layer {
163153
virtual void UpdateScene(SceneUpdateContext& context);
164154
#endif
165155

156+
ContainerLayer* parent() const { return parent_; }
157+
158+
void set_parent(ContainerLayer* parent) { parent_ = parent; }
159+
166160
bool needs_system_composite() const { return needs_system_composite_; }
167161
void set_needs_system_composite(bool value) {
168162
needs_system_composite_ = value;
@@ -181,9 +175,10 @@ class Layer {
181175
uint64_t unique_id() const { return unique_id_; }
182176

183177
private:
178+
ContainerLayer* parent_;
179+
bool needs_system_composite_;
184180
SkRect paint_bounds_;
185181
uint64_t unique_id_;
186-
bool needs_system_composite_;
187182

188183
static uint64_t NextUniqueID();
189184

0 commit comments

Comments
 (0)