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

Commit ecfe5ae

Browse files
authored
Move layer clip culling to Paint() method to fix child caching (#22336)
1 parent 8bb47c5 commit ecfe5ae

39 files changed

+323
-296
lines changed

flow/layers/backdrop_filter_layer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void BackdropFilterLayer::Preroll(PrerollContext* context,
1818

1919
void BackdropFilterLayer::Paint(PaintContext& context) const {
2020
TRACE_EVENT0("flutter", "BackdropFilterLayer::Paint");
21-
FML_DCHECK(needs_painting());
21+
FML_DCHECK(needs_painting(context));
2222

2323
Layer::AutoSaveLayer save = Layer::AutoSaveLayer::Create(
2424
context,

flow/layers/backdrop_filter_layer_unittests.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ TEST_F(BackdropFilterLayerTest, PaintingEmptyLayerDies) {
2222

2323
layer->Preroll(preroll_context(), SkMatrix());
2424
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
25-
EXPECT_FALSE(layer->needs_painting());
25+
EXPECT_FALSE(layer->needs_painting(paint_context()));
2626
EXPECT_FALSE(layer->needs_system_composite());
2727

2828
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
29-
"needs_painting\\(\\)");
29+
"needs_painting\\(context\\)");
3030
}
3131

3232
TEST_F(BackdropFilterLayerTest, PaintBeforePrerollDies) {
@@ -38,7 +38,7 @@ TEST_F(BackdropFilterLayerTest, PaintBeforePrerollDies) {
3838

3939
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
4040
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
41-
"needs_painting\\(\\)");
41+
"needs_painting\\(context\\)");
4242
}
4343
#endif
4444

@@ -53,7 +53,7 @@ TEST_F(BackdropFilterLayerTest, EmptyFilter) {
5353

5454
layer->Preroll(preroll_context(), initial_transform);
5555
EXPECT_EQ(layer->paint_bounds(), child_bounds);
56-
EXPECT_TRUE(layer->needs_painting());
56+
EXPECT_TRUE(layer->needs_painting(paint_context()));
5757
EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
5858

5959
layer->Paint(paint_context());
@@ -79,7 +79,7 @@ TEST_F(BackdropFilterLayerTest, SimpleFilter) {
7979

8080
layer->Preroll(preroll_context(), initial_transform);
8181
EXPECT_EQ(layer->paint_bounds(), child_bounds);
82-
EXPECT_TRUE(layer->needs_painting());
82+
EXPECT_TRUE(layer->needs_painting(paint_context()));
8383
EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
8484

8585
layer->Paint(paint_context());
@@ -114,9 +114,9 @@ TEST_F(BackdropFilterLayerTest, MultipleChildren) {
114114
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
115115
EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
116116
EXPECT_EQ(layer->paint_bounds(), children_bounds);
117-
EXPECT_TRUE(mock_layer1->needs_painting());
118-
EXPECT_TRUE(mock_layer2->needs_painting());
119-
EXPECT_TRUE(layer->needs_painting());
117+
EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
118+
EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
119+
EXPECT_TRUE(layer->needs_painting(paint_context()));
120120
EXPECT_EQ(mock_layer1->parent_matrix(), initial_transform);
121121
EXPECT_EQ(mock_layer2->parent_matrix(), initial_transform);
122122

@@ -158,10 +158,10 @@ TEST_F(BackdropFilterLayerTest, Nested) {
158158
EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
159159
EXPECT_EQ(layer1->paint_bounds(), children_bounds);
160160
EXPECT_EQ(layer2->paint_bounds(), mock_layer2->paint_bounds());
161-
EXPECT_TRUE(mock_layer1->needs_painting());
162-
EXPECT_TRUE(mock_layer2->needs_painting());
163-
EXPECT_TRUE(layer1->needs_painting());
164-
EXPECT_TRUE(layer2->needs_painting());
161+
EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
162+
EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
163+
EXPECT_TRUE(layer1->needs_painting(paint_context()));
164+
EXPECT_TRUE(layer2->needs_painting(paint_context()));
165165
EXPECT_EQ(mock_layer1->parent_matrix(), initial_transform);
166166
EXPECT_EQ(mock_layer2->parent_matrix(), initial_transform);
167167

flow/layers/checkerboard_layertree_unittests.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ TEST_F(CheckerBoardLayerTest, ClipRectSaveLayerNotCheckBoard) {
4343
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
4444
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
4545
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
46-
EXPECT_TRUE(mock_layer->needs_painting());
47-
EXPECT_TRUE(layer->needs_painting());
46+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
47+
EXPECT_TRUE(layer->needs_painting(paint_context()));
4848
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);
4949
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
5050
EXPECT_EQ(mock_layer->parent_mutators(),
@@ -93,8 +93,8 @@ TEST_F(CheckerBoardLayerTest, ClipRectSaveLayerCheckBoard) {
9393
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
9494
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
9595
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
96-
EXPECT_TRUE(mock_layer->needs_painting());
97-
EXPECT_TRUE(layer->needs_painting());
96+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
97+
EXPECT_TRUE(layer->needs_painting(paint_context()));
9898
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);
9999
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
100100
EXPECT_EQ(mock_layer->parent_mutators(),
@@ -136,8 +136,8 @@ TEST_F(CheckerBoardLayerTest, ClipPathSaveLayerNotCheckBoard) {
136136
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
137137
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
138138
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
139-
EXPECT_TRUE(mock_layer->needs_painting());
140-
EXPECT_TRUE(layer->needs_painting());
139+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
140+
EXPECT_TRUE(layer->needs_painting(paint_context()));
141141
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
142142
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
143143
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_path)}));
@@ -177,8 +177,8 @@ TEST_F(CheckerBoardLayerTest, ClipPathSaveLayerCheckBoard) {
177177
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
178178
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
179179
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
180-
EXPECT_TRUE(mock_layer->needs_painting());
181-
EXPECT_TRUE(layer->needs_painting());
180+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
181+
EXPECT_TRUE(layer->needs_painting(paint_context()));
182182
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
183183
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
184184
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_path)}));
@@ -218,8 +218,8 @@ TEST_F(CheckerBoardLayerTest, ClipRRectSaveLayerNotCheckBoard) {
218218
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
219219
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
220220
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
221-
EXPECT_TRUE(mock_layer->needs_painting());
222-
EXPECT_TRUE(layer->needs_painting());
221+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
222+
EXPECT_TRUE(layer->needs_painting(paint_context()));
223223
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
224224
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
225225
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_rrect)}));
@@ -259,8 +259,8 @@ TEST_F(CheckerBoardLayerTest, ClipRRectSaveLayerCheckBoard) {
259259
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
260260
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
261261
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
262-
EXPECT_TRUE(mock_layer->needs_painting());
263-
EXPECT_TRUE(layer->needs_painting());
262+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
263+
EXPECT_TRUE(layer->needs_painting(paint_context()));
264264
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
265265
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
266266
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_rrect)}));
@@ -296,7 +296,7 @@ TEST_F(CheckerBoardLayerTest, PhysicalSaveLayerNotCheckBoard) {
296296
EXPECT_EQ(layer->paint_bounds(),
297297
PhysicalShapeLayer::ComputeShadowBounds(layer_path.getBounds(),
298298
initial_elevation, 1.0f));
299-
EXPECT_TRUE(layer->needs_painting());
299+
EXPECT_TRUE(layer->needs_painting(paint_context()));
300300
EXPECT_FALSE(layer->needs_system_composite());
301301
EXPECT_EQ(layer->elevation(), initial_elevation);
302302

@@ -340,7 +340,7 @@ TEST_F(CheckerBoardLayerTest, PhysicalSaveLayerCheckBoard) {
340340
EXPECT_EQ(layer->paint_bounds(),
341341
PhysicalShapeLayer::ComputeShadowBounds(layer_path.getBounds(),
342342
initial_elevation, 1.0f));
343-
EXPECT_TRUE(layer->needs_painting());
343+
EXPECT_TRUE(layer->needs_painting(paint_context()));
344344
EXPECT_FALSE(layer->needs_system_composite());
345345
EXPECT_EQ(layer->elevation(), initial_elevation);
346346

flow/layers/clip_path_layer.cc

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,18 @@ void ClipPathLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
2121

2222
SkRect previous_cull_rect = context->cull_rect;
2323
SkRect clip_path_bounds = clip_path_.getBounds();
24-
children_inside_clip_ = context->cull_rect.intersect(clip_path_bounds);
25-
if (children_inside_clip_) {
26-
TRACE_EVENT_INSTANT0("flutter", "children inside clip rect");
27-
28-
Layer::AutoPrerollSaveLayerState save =
29-
Layer::AutoPrerollSaveLayerState::Create(context, UsesSaveLayer());
30-
context->mutators_stack.PushClipPath(clip_path_);
31-
SkRect child_paint_bounds = SkRect::MakeEmpty();
32-
PrerollChildren(context, matrix, &child_paint_bounds);
33-
34-
if (child_paint_bounds.intersect(clip_path_bounds)) {
35-
set_paint_bounds(child_paint_bounds);
36-
}
37-
context->mutators_stack.Pop();
24+
context->cull_rect.intersect(clip_path_bounds);
25+
Layer::AutoPrerollSaveLayerState save =
26+
Layer::AutoPrerollSaveLayerState::Create(context, UsesSaveLayer());
27+
context->mutators_stack.PushClipPath(clip_path_);
28+
29+
SkRect child_paint_bounds = SkRect::MakeEmpty();
30+
PrerollChildren(context, matrix, &child_paint_bounds);
31+
if (child_paint_bounds.intersect(clip_path_bounds)) {
32+
set_paint_bounds(child_paint_bounds);
3833
}
34+
35+
context->mutators_stack.Pop();
3936
context->cull_rect = previous_cull_rect;
4037
}
4138

@@ -54,12 +51,7 @@ void ClipPathLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
5451

5552
void ClipPathLayer::Paint(PaintContext& context) const {
5653
TRACE_EVENT0("flutter", "ClipPathLayer::Paint");
57-
FML_DCHECK(needs_painting());
58-
59-
if (!children_inside_clip_) {
60-
TRACE_EVENT_INSTANT0("flutter", "children not inside clip rect, skipping");
61-
return;
62-
}
54+
FML_DCHECK(needs_painting(context));
6355

6456
SkAutoCanvasRestore save(context.internal_nodes_canvas, true);
6557
context.internal_nodes_canvas->clipPath(clip_path_,

flow/layers/clip_path_layer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class ClipPathLayer : public ContainerLayer {
2828
private:
2929
SkPath clip_path_;
3030
Clip clip_behavior_;
31-
bool children_inside_clip_ = false;
3231

3332
FML_DISALLOW_COPY_AND_ASSIGN(ClipPathLayer);
3433
};

flow/layers/clip_path_layer_unittests.cc

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,52 @@ TEST_F(ClipPathLayerTest, PaintingEmptyLayerDies) {
2828
EXPECT_EQ(preroll_context()->cull_rect, kGiantRect); // Untouched
2929
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
3030
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
31-
EXPECT_FALSE(layer->needs_painting());
31+
EXPECT_FALSE(layer->needs_painting(paint_context()));
3232

3333
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
34-
"needs_painting\\(\\)");
34+
"needs_painting\\(context\\)");
3535
}
3636

3737
TEST_F(ClipPathLayerTest, PaintBeforePrerollDies) {
3838
const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
3939
const SkPath layer_path = SkPath().addRect(layer_bounds);
4040
auto layer = std::make_shared<ClipPathLayer>(layer_path, Clip::hardEdge);
4141
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
42-
EXPECT_FALSE(layer->needs_painting());
42+
EXPECT_FALSE(layer->needs_painting(paint_context()));
4343

4444
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
45-
"needs_painting\\(\\)");
45+
"needs_painting\\(context\\)");
4646
}
4747

4848
TEST_F(ClipPathLayerTest, PaintingCulledLayerDies) {
4949
const SkMatrix initial_matrix = SkMatrix::Translate(0.5f, 1.0f);
5050
const SkRect child_bounds = SkRect::MakeXYWH(1.0, 2.0, 2.0, 2.0);
5151
const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
52+
const SkRect distant_bounds = SkRect::MakeXYWH(100.0, 100.0, 10.0, 10.0);
5253
const SkPath child_path = SkPath().addRect(child_bounds);
5354
const SkPath layer_path = SkPath().addRect(layer_bounds);
5455
auto mock_layer = std::make_shared<MockLayer>(child_path);
5556
auto layer = std::make_shared<ClipPathLayer>(layer_path, Clip::hardEdge);
5657
layer->Add(mock_layer);
5758

58-
preroll_context()->cull_rect = kEmptyRect; // Cull everything
59+
preroll_context()->cull_rect = distant_bounds; // Cull these children
5960

6061
layer->Preroll(preroll_context(), initial_matrix);
61-
EXPECT_EQ(preroll_context()->cull_rect, kEmptyRect); // Untouched
62+
EXPECT_EQ(preroll_context()->cull_rect, distant_bounds); // Untouched
6263
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
63-
EXPECT_EQ(mock_layer->paint_bounds(), kEmptyRect);
64-
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
65-
EXPECT_FALSE(mock_layer->needs_painting());
66-
EXPECT_FALSE(layer->needs_painting());
67-
EXPECT_EQ(mock_layer->parent_cull_rect(), kEmptyRect);
68-
EXPECT_EQ(mock_layer->parent_matrix(), SkMatrix());
69-
EXPECT_EQ(mock_layer->parent_mutators(), std::vector<Mutator>());
64+
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
65+
EXPECT_EQ(layer->paint_bounds(), child_bounds);
66+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
67+
EXPECT_TRUE(layer->needs_painting(paint_context()));
68+
EXPECT_EQ(mock_layer->parent_cull_rect(), distant_bounds);
69+
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
70+
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_path)}));
7071

72+
paint_context().internal_nodes_canvas->clipRect(distant_bounds, false);
73+
EXPECT_FALSE(mock_layer->needs_painting(paint_context()));
74+
EXPECT_FALSE(layer->needs_painting(paint_context()));
7175
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
72-
"needs_painting\\(\\)");
76+
"needs_painting\\(context\\)");
7377
}
7478
#endif
7579

@@ -96,8 +100,8 @@ TEST_F(ClipPathLayerTest, ChildOutsideBounds) {
96100
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
97101
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
98102
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
99-
EXPECT_TRUE(mock_layer->needs_painting());
100-
EXPECT_TRUE(layer->needs_painting());
103+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
104+
EXPECT_TRUE(layer->needs_painting(paint_context()));
101105
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);
102106
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
103107
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_path)}));
@@ -131,8 +135,8 @@ TEST_F(ClipPathLayerTest, FullyContainedChild) {
131135
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
132136
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
133137
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
134-
EXPECT_TRUE(mock_layer->needs_painting());
135-
EXPECT_TRUE(layer->needs_painting());
138+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
139+
EXPECT_TRUE(layer->needs_painting(paint_context()));
136140
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
137141
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
138142
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_path)}));
@@ -173,8 +177,8 @@ TEST_F(ClipPathLayerTest, PartiallyContainedChild) {
173177
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
174178
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
175179
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
176-
EXPECT_TRUE(mock_layer->needs_painting());
177-
EXPECT_TRUE(layer->needs_painting());
180+
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
181+
EXPECT_TRUE(layer->needs_painting(paint_context()));
178182
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);
179183
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
180184
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_path)}));

flow/layers/clip_rect_layer.cc

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,18 @@ void ClipRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
1616
TRACE_EVENT0("flutter", "ClipRectLayer::Preroll");
1717

1818
SkRect previous_cull_rect = context->cull_rect;
19-
children_inside_clip_ = context->cull_rect.intersect(clip_rect_);
20-
if (children_inside_clip_) {
21-
TRACE_EVENT_INSTANT0("flutter", "children inside clip rect");
22-
23-
Layer::AutoPrerollSaveLayerState save =
24-
Layer::AutoPrerollSaveLayerState::Create(context, UsesSaveLayer());
25-
context->mutators_stack.PushClipRect(clip_rect_);
26-
SkRect child_paint_bounds = SkRect::MakeEmpty();
27-
PrerollChildren(context, matrix, &child_paint_bounds);
28-
29-
if (child_paint_bounds.intersect(clip_rect_)) {
30-
set_paint_bounds(child_paint_bounds);
31-
}
32-
context->mutators_stack.Pop();
19+
context->cull_rect.intersect(clip_rect_);
20+
Layer::AutoPrerollSaveLayerState save =
21+
Layer::AutoPrerollSaveLayerState::Create(context, UsesSaveLayer());
22+
context->mutators_stack.PushClipRect(clip_rect_);
23+
24+
SkRect child_paint_bounds = SkRect::MakeEmpty();
25+
PrerollChildren(context, matrix, &child_paint_bounds);
26+
if (child_paint_bounds.intersect(clip_rect_)) {
27+
set_paint_bounds(child_paint_bounds);
3328
}
29+
30+
context->mutators_stack.Pop();
3431
context->cull_rect = previous_cull_rect;
3532
}
3633

@@ -49,12 +46,7 @@ void ClipRectLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
4946

5047
void ClipRectLayer::Paint(PaintContext& context) const {
5148
TRACE_EVENT0("flutter", "ClipRectLayer::Paint");
52-
FML_DCHECK(needs_painting());
53-
54-
if (!children_inside_clip_) {
55-
TRACE_EVENT_INSTANT0("flutter", "children not inside clip rect, skipping");
56-
return;
57-
}
49+
FML_DCHECK(needs_painting(context));
5850

5951
SkAutoCanvasRestore save(context.internal_nodes_canvas, true);
6052
context.internal_nodes_canvas->clipRect(clip_rect_,

flow/layers/clip_rect_layer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class ClipRectLayer : public ContainerLayer {
2727
private:
2828
SkRect clip_rect_;
2929
Clip clip_behavior_;
30-
bool children_inside_clip_ = false;
3130

3231
FML_DISALLOW_COPY_AND_ASSIGN(ClipRectLayer);
3332
};

0 commit comments

Comments
 (0)