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

Commit 80d06a6

Browse files
committed
Move many FUCHSIA_OS to cc; cleanup declarations
1 parent 69635fd commit 80d06a6

Some content is hidden

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

43 files changed

+225
-244
lines changed

flow/layers/backdrop_filter_layer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
#include "flutter/flow/layers/backdrop_filter_layer.h"
66

7+
#include "flutter/fml/trace_event.h"
8+
79
namespace flutter {
810

911
BackdropFilterLayer::BackdropFilterLayer(sk_sp<SkImageFilter> filter)
1012
: filter_(std::move(filter)) {}
1113

12-
BackdropFilterLayer::~BackdropFilterLayer() = default;
13-
1414
void BackdropFilterLayer::Paint(PaintContext& context) const {
1515
TRACE_EVENT0("flutter", "BackdropFilterLayer::Paint");
1616
FML_DCHECK(needs_painting());
1717

1818
Layer::AutoSaveLayer save = Layer::AutoSaveLayer::Create(
1919
context,
2020
SkCanvas::SaveLayerRec{&paint_bounds(), nullptr, filter_.get(), 0});
21-
PaintChildren(context);
21+
ContainerLayer::Paint(context);
2222
}
2323

2424
} // namespace flutter

flow/layers/backdrop_filter_layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace flutter {
1414
class BackdropFilterLayer : public ContainerLayer {
1515
public:
1616
BackdropFilterLayer(sk_sp<SkImageFilter> filter);
17-
~BackdropFilterLayer() override;
17+
~BackdropFilterLayer() override = default;
1818

1919
void Paint(PaintContext& context) const override;
2020

flow/layers/child_scene_layer.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "flutter/flow/layers/child_scene_layer.h"
66

77
#include "flutter/flow/view_holder.h"
8+
#include "flutter/fml/trace_event.h"
89

910
namespace flutter {
1011

flow/layers/child_scene_layer.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ class ChildSceneLayer : public Layer {
2424
~ChildSceneLayer() override = default;
2525

2626
void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
27-
28-
void Paint(PaintContext& context) const override;
29-
3027
void UpdateScene(SceneUpdateContext& context) override;
28+
void Paint(PaintContext& context) const override;
3129

3230
private:
3331
zx_koid_t layer_id_ = ZX_KOID_INVALID;

flow/layers/clip_path_layer.cc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
#include "flutter/flow/layers/clip_path_layer.h"
66

7-
#if defined(OS_FUCHSIA)
8-
9-
#include "lib/ui/scenic/cpp/commands.h"
7+
#include "flutter/fml/trace_event.h"
108

11-
#endif // defined(OS_FUCHSIA)
9+
#if defined(OS_FUCHSIA)
10+
#include "flutter/flow/scene_update_context.h" //nogncheck
11+
#endif // defined(OS_FUCHSIA)
1212

1313
namespace flutter {
1414

@@ -17,18 +17,17 @@ ClipPathLayer::ClipPathLayer(const SkPath& clip_path, Clip clip_behavior)
1717
FML_DCHECK(clip_behavior != Clip::none);
1818
}
1919

20-
ClipPathLayer::~ClipPathLayer() = default;
21-
2220
void ClipPathLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
2321
SkRect previous_cull_rect = context->cull_rect;
2422
SkRect clip_path_bounds = clip_path_.getBounds();
2523
if (context->cull_rect.intersect(clip_path_bounds)) {
2624
context->mutators_stack.PushClipPath(clip_path_);
27-
SkRect child_paint_bounds = SkRect::MakeEmpty();
28-
PrerollChildren(context, matrix, &child_paint_bounds);
25+
ContainerLayer::Preroll(context, matrix);
2926

30-
if (child_paint_bounds.intersect(clip_path_bounds)) {
31-
set_paint_bounds(child_paint_bounds);
27+
if (clip_path_bounds.intersect(paint_bounds())) {
28+
set_paint_bounds(clip_path_bounds);
29+
} else {
30+
set_paint_bounds(SkRect::MakeEmpty());
3231
}
3332
context->mutators_stack.Pop();
3433
}
@@ -42,7 +41,7 @@ void ClipPathLayer::UpdateScene(SceneUpdateContext& context) {
4241

4342
// TODO(liyuqian): respect clip_behavior_
4443
SceneUpdateContext::Clip clip(context, clip_path_.getBounds());
45-
UpdateSceneChildren(context);
44+
ContainerLayer::UpdateScene(context);
4645
}
4746

4847
#endif // defined(OS_FUCHSIA)
@@ -58,7 +57,7 @@ void ClipPathLayer::Paint(PaintContext& context) const {
5857
if (clip_behavior_ == Clip::antiAliasWithSaveLayer) {
5958
context.internal_nodes_canvas->saveLayer(paint_bounds(), nullptr);
6059
}
61-
PaintChildren(context);
60+
ContainerLayer::Paint(context);
6261
if (clip_behavior_ == Clip::antiAliasWithSaveLayer) {
6362
context.internal_nodes_canvas->restore();
6463
}

flow/layers/clip_path_layer.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ namespace flutter {
1212
class ClipPathLayer : public ContainerLayer {
1313
public:
1414
ClipPathLayer(const SkPath& clip_path, Clip clip_behavior = Clip::antiAlias);
15-
~ClipPathLayer() override;
15+
~ClipPathLayer() override = default;
1616

1717
void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
18-
19-
void Paint(PaintContext& context) const override;
20-
2118
#if defined(OS_FUCHSIA)
2219
void UpdateScene(SceneUpdateContext& context) override;
2320
#endif // defined(OS_FUCHSIA)
21+
void Paint(PaintContext& context) const override;
2422

2523
private:
2624
SkPath clip_path_;

flow/layers/clip_rect_layer.cc

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,30 @@
44

55
#include "flutter/flow/layers/clip_rect_layer.h"
66

7+
#include "flutter/fml/trace_event.h"
8+
9+
#if defined(OS_FUCHSIA)
10+
#include "flutter/flow/scene_update_context.h" //nogncheck
11+
#endif // defined(OS_FUCHSIA)
12+
713
namespace flutter {
814

915
ClipRectLayer::ClipRectLayer(const SkRect& clip_rect, Clip clip_behavior)
1016
: clip_rect_(clip_rect), clip_behavior_(clip_behavior) {
1117
FML_DCHECK(clip_behavior != Clip::none);
1218
}
1319

14-
ClipRectLayer::~ClipRectLayer() = default;
15-
1620
void ClipRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
1721
SkRect previous_cull_rect = context->cull_rect;
18-
if (context->cull_rect.intersect(clip_rect_)) {
19-
context->mutators_stack.PushClipRect(clip_rect_);
20-
SkRect child_paint_bounds = SkRect::MakeEmpty();
21-
PrerollChildren(context, matrix, &child_paint_bounds);
22+
SkRect clip_rect_bounds = clip_rect_;
23+
if (context->cull_rect.intersect(clip_rect_bounds)) {
24+
context->mutators_stack.PushClipRect(clip_rect_bounds);
25+
ContainerLayer::Preroll(context, matrix);
2226

23-
if (child_paint_bounds.intersect(clip_rect_)) {
24-
set_paint_bounds(child_paint_bounds);
27+
if (clip_rect_bounds.intersect(paint_bounds())) {
28+
set_paint_bounds(clip_rect_bounds);
29+
} else {
30+
set_paint_bounds(SkRect::MakeEmpty());
2531
}
2632
context->mutators_stack.Pop();
2733
}
@@ -35,7 +41,7 @@ void ClipRectLayer::UpdateScene(SceneUpdateContext& context) {
3541

3642
// TODO(liyuqian): respect clip_behavior_
3743
SceneUpdateContext::Clip clip(context, clip_rect_);
38-
UpdateSceneChildren(context);
44+
ContainerLayer::UpdateScene(context);
3945
}
4046

4147
#endif // defined(OS_FUCHSIA)
@@ -51,7 +57,7 @@ void ClipRectLayer::Paint(PaintContext& context) const {
5157
if (clip_behavior_ == Clip::antiAliasWithSaveLayer) {
5258
context.internal_nodes_canvas->saveLayer(clip_rect_, nullptr);
5359
}
54-
PaintChildren(context);
60+
ContainerLayer::Paint(context);
5561
if (clip_behavior_ == Clip::antiAliasWithSaveLayer) {
5662
context.internal_nodes_canvas->restore();
5763
}

flow/layers/clip_rect_layer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ namespace flutter {
1212
class ClipRectLayer : public ContainerLayer {
1313
public:
1414
ClipRectLayer(const SkRect& clip_rect, Clip clip_behavior);
15-
~ClipRectLayer() override;
15+
~ClipRectLayer() override = default;
1616

1717
void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
18-
void Paint(PaintContext& context) const override;
19-
2018
#if defined(OS_FUCHSIA)
2119
void UpdateScene(SceneUpdateContext& context) override;
2220
#endif // defined(OS_FUCHSIA)
21+
void Paint(PaintContext& context) const override;
2322

2423
private:
2524
SkRect clip_rect_;

flow/layers/clip_rrect_layer.cc

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,30 @@
44

55
#include "flutter/flow/layers/clip_rrect_layer.h"
66

7+
#include "flutter/fml/trace_event.h"
8+
9+
#if defined(OS_FUCHSIA)
10+
#include "flutter/flow/scene_update_context.h" //nogncheck
11+
#endif // defined(OS_FUCHSIA)
12+
713
namespace flutter {
814

915
ClipRRectLayer::ClipRRectLayer(const SkRRect& clip_rrect, Clip clip_behavior)
1016
: clip_rrect_(clip_rrect), clip_behavior_(clip_behavior) {
1117
FML_DCHECK(clip_behavior != Clip::none);
1218
}
1319

14-
ClipRRectLayer::~ClipRRectLayer() = default;
15-
1620
void ClipRRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
1721
SkRect previous_cull_rect = context->cull_rect;
1822
SkRect clip_rrect_bounds = clip_rrect_.getBounds();
1923
if (context->cull_rect.intersect(clip_rrect_bounds)) {
2024
context->mutators_stack.PushClipRRect(clip_rrect_);
21-
SkRect child_paint_bounds = SkRect::MakeEmpty();
22-
PrerollChildren(context, matrix, &child_paint_bounds);
25+
ContainerLayer::Preroll(context, matrix);
2326

24-
if (child_paint_bounds.intersect(clip_rrect_bounds)) {
25-
set_paint_bounds(child_paint_bounds);
27+
if (clip_rrect_bounds.intersect(paint_bounds())) {
28+
set_paint_bounds(clip_rrect_bounds);
29+
} else {
30+
set_paint_bounds(SkRect::MakeEmpty());
2631
}
2732
context->mutators_stack.Pop();
2833
}
@@ -36,7 +41,7 @@ void ClipRRectLayer::UpdateScene(SceneUpdateContext& context) {
3641

3742
// TODO(liyuqian): respect clip_behavior_
3843
SceneUpdateContext::Clip clip(context, clip_rrect_.getBounds());
39-
UpdateSceneChildren(context);
44+
ContainerLayer::UpdateScene(context);
4045
}
4146

4247
#endif // defined(OS_FUCHSIA)
@@ -52,7 +57,7 @@ void ClipRRectLayer::Paint(PaintContext& context) const {
5257
if (clip_behavior_ == Clip::antiAliasWithSaveLayer) {
5358
context.internal_nodes_canvas->saveLayer(paint_bounds(), nullptr);
5459
}
55-
PaintChildren(context);
60+
ContainerLayer::Paint(context);
5661
if (clip_behavior_ == Clip::antiAliasWithSaveLayer) {
5762
context.internal_nodes_canvas->restore();
5863
}

flow/layers/clip_rrect_layer.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ namespace flutter {
1212
class ClipRRectLayer : public ContainerLayer {
1313
public:
1414
ClipRRectLayer(const SkRRect& clip_rrect, Clip clip_behavior);
15-
~ClipRRectLayer() override;
15+
~ClipRRectLayer() override = default;
1616

1717
void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
18-
19-
void Paint(PaintContext& context) const override;
20-
2118
#if defined(OS_FUCHSIA)
2219
void UpdateScene(SceneUpdateContext& context) override;
2320
#endif // defined(OS_FUCHSIA)
21+
void Paint(PaintContext& context) const override;
2422

2523
private:
2624
SkRRect clip_rrect_;

flow/layers/color_filter_layer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
#include "flutter/flow/layers/color_filter_layer.h"
66

7+
#include "flutter/fml/trace_event.h"
8+
79
namespace flutter {
810

911
ColorFilterLayer::ColorFilterLayer(sk_sp<SkColorFilter> filter)
1012
: filter_(std::move(filter)) {}
1113

12-
ColorFilterLayer::~ColorFilterLayer() = default;
13-
1414
void ColorFilterLayer::Paint(PaintContext& context) const {
1515
TRACE_EVENT0("flutter", "ColorFilterLayer::Paint");
1616
FML_DCHECK(needs_painting());
@@ -20,7 +20,7 @@ void ColorFilterLayer::Paint(PaintContext& context) const {
2020

2121
Layer::AutoSaveLayer save =
2222
Layer::AutoSaveLayer::Create(context, paint_bounds(), &paint);
23-
PaintChildren(context);
23+
ContainerLayer::Paint(context);
2424
}
2525

2626
} // namespace flutter

flow/layers/color_filter_layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace flutter {
1414
class ColorFilterLayer : public ContainerLayer {
1515
public:
1616
ColorFilterLayer(sk_sp<SkColorFilter> filter);
17-
~ColorFilterLayer() override;
17+
~ColorFilterLayer() override = default;
1818

1919
void Paint(PaintContext& context) const override;
2020

flow/layers/container_layer.cc

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
#include "flutter/flow/layers/container_layer.h"
66

7-
namespace flutter {
8-
9-
ContainerLayer::ContainerLayer() {}
7+
#include "flutter/fml/trace_event.h"
108

11-
ContainerLayer::~ContainerLayer() = default;
9+
namespace flutter {
1210

1311
void ContainerLayer::Add(std::shared_ptr<Layer> layer) {
1412
layers_.emplace_back(std::move(layer));
@@ -17,45 +15,33 @@ void ContainerLayer::Add(std::shared_ptr<Layer> layer) {
1715
void ContainerLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
1816
TRACE_EVENT0("flutter", "ContainerLayer::Preroll");
1917

20-
SkRect child_paint_bounds = SkRect::MakeEmpty();
21-
PrerollChildren(context, matrix, &child_paint_bounds);
22-
set_paint_bounds(child_paint_bounds);
23-
}
24-
25-
void ContainerLayer::Paint(PaintContext& context) const {
26-
FML_DCHECK(needs_painting());
27-
28-
PaintChildren(context);
29-
}
30-
31-
void ContainerLayer::PrerollChildren(PrerollContext* context,
32-
const SkMatrix& child_matrix,
33-
SkRect* child_paint_bounds) {
3418
// Platform views have no children, so context->has_platform_view should
3519
// always be false.
3620
FML_DCHECK(!context->has_platform_view);
21+
22+
SkRect child_paint_bounds = SkRect::MakeEmpty();
3723
bool child_has_platform_view = false;
3824
for (auto& layer : layers_) {
3925
// Reset context->has_platform_view to false so that layers aren't treated
4026
// as if they have a platform view based on one being previously found in a
4127
// sibling tree.
4228
context->has_platform_view = false;
4329

44-
layer->Preroll(context, child_matrix);
45-
30+
layer->Preroll(context, matrix);
4631
if (layer->needs_system_composite()) {
4732
set_needs_system_composite(true);
4833
}
49-
child_paint_bounds->join(layer->paint_bounds());
34+
child_paint_bounds.join(layer->paint_bounds());
5035

5136
child_has_platform_view =
5237
child_has_platform_view || context->has_platform_view;
5338
}
5439

5540
context->has_platform_view = child_has_platform_view;
41+
set_paint_bounds(child_paint_bounds);
5642
}
5743

58-
void ContainerLayer::PaintChildren(PaintContext& context) const {
44+
void ContainerLayer::Paint(PaintContext& context) const {
5945
FML_DCHECK(needs_painting());
6046

6147
// Intentionally not tracing here as there should be no self-time
@@ -70,10 +56,6 @@ void ContainerLayer::PaintChildren(PaintContext& context) const {
7056
#if defined(OS_FUCHSIA)
7157

7258
void ContainerLayer::UpdateScene(SceneUpdateContext& context) {
73-
UpdateSceneChildren(context);
74-
}
75-
76-
void ContainerLayer::UpdateSceneChildren(SceneUpdateContext& context) {
7759
FML_DCHECK(needs_system_composite());
7860

7961
// Update all of the Layers which are part of the container. This may cause

0 commit comments

Comments
 (0)