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

Commit 3cb79e4

Browse files
committed
LayerRCI GetPaintBounds from Layer; Remove unnecessary mock layer
1 parent 9b68847 commit 3cb79e4

21 files changed

+121
-108
lines changed

flow/layers/backdrop_filter_layer_unittests.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ TEST_F(BackdropFilterLayerTest, PaintingEmptyLayerDies) {
2929

3030
parent->Preroll(preroll_context(), SkMatrix());
3131
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
32-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
32+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
3333
EXPECT_FALSE(layer->needs_painting(paint_context()));
3434

3535
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
@@ -45,7 +45,7 @@ TEST_F(BackdropFilterLayerTest, PaintBeforePrerollDies) {
4545
layer->Add(mock_layer);
4646

4747
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
48-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
48+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
4949
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
5050
"needs_painting\\(context\\)");
5151
}
@@ -65,7 +65,7 @@ TEST_F(BackdropFilterLayerTest, EmptyFilter) {
6565

6666
parent->Preroll(preroll_context(), initial_transform);
6767
EXPECT_EQ(layer->paint_bounds(), child_bounds);
68-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
68+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
6969
EXPECT_TRUE(layer->needs_painting(paint_context()));
7070
EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
7171

@@ -95,7 +95,7 @@ TEST_F(BackdropFilterLayerTest, SimpleFilter) {
9595

9696
parent->Preroll(preroll_context(), initial_transform);
9797
EXPECT_EQ(layer->paint_bounds(), child_bounds);
98-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
98+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
9999
EXPECT_TRUE(layer->needs_painting(paint_context()));
100100
EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
101101

@@ -125,7 +125,7 @@ TEST_F(BackdropFilterLayerTest, NonSrcOverBlend) {
125125

126126
parent->Preroll(preroll_context(), initial_transform);
127127
EXPECT_EQ(layer->paint_bounds(), child_bounds);
128-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
128+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
129129
EXPECT_TRUE(layer->needs_painting(paint_context()));
130130
EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
131131

@@ -168,7 +168,7 @@ TEST_F(BackdropFilterLayerTest, MultipleChildren) {
168168
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
169169
EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
170170
EXPECT_EQ(layer->paint_bounds(), children_bounds);
171-
EXPECT_EQ(layer->child_paint_bounds(), children_bounds);
171+
EXPECT_EQ(*(layer->child_paint_bounds()), children_bounds);
172172
EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
173173
EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
174174
EXPECT_TRUE(layer->needs_painting(paint_context()));

flow/layers/cacheable_layer.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ AutoCache::AutoCache(RasterCacheItem* raster_cache_item,
1616
matrix_(matrix) {
1717
if (IsCacheEnabled()) {
1818
raster_cache_item->PrerollSetup(context, matrix);
19-
current_index_ = context_->raster_cached_entries->size();
2019
}
2120
}
2221

flow/layers/cacheable_layer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class AutoCache {
2525

2626
private:
2727
inline bool IsCacheEnabled();
28-
int current_index_;
2928
RasterCacheItem* raster_cache_item_ = nullptr;
3029
PrerollContext* context_ = nullptr;
3130
const SkMatrix& matrix_;

flow/layers/clip_path_layer_unittests.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ TEST_F(ClipPathLayerTest, PaintingEmptyLayerDies) {
3333
EXPECT_EQ(preroll_context()->cull_rect, kGiantRect); // Untouched
3434
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
3535
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
36-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
36+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
3737
EXPECT_FALSE(layer->needs_painting(paint_context()));
3838

3939
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
@@ -45,7 +45,7 @@ TEST_F(ClipPathLayerTest, PaintBeforePrerollDies) {
4545
const SkPath layer_path = SkPath().addRect(layer_bounds);
4646
auto layer = std::make_shared<ClipPathLayer>(layer_path, Clip::hardEdge);
4747
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
48-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
48+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
4949
EXPECT_FALSE(layer->needs_painting(paint_context()));
5050

5151
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
@@ -70,7 +70,7 @@ TEST_F(ClipPathLayerTest, PaintingCulledLayerDies) {
7070
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
7171
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
7272
EXPECT_EQ(layer->paint_bounds(), child_bounds);
73-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
73+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
7474
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
7575
EXPECT_TRUE(layer->needs_painting(paint_context()));
7676
EXPECT_EQ(mock_layer->parent_cull_rect(), kEmptyRect);
@@ -108,7 +108,7 @@ TEST_F(ClipPathLayerTest, ChildOutsideBounds) {
108108
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
109109
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
110110
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
111-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
111+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
112112
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
113113
EXPECT_TRUE(layer->needs_painting(paint_context()));
114114
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);
@@ -144,7 +144,7 @@ TEST_F(ClipPathLayerTest, FullyContainedChild) {
144144
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
145145
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
146146
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
147-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
147+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
148148
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
149149
EXPECT_TRUE(layer->needs_painting(paint_context()));
150150
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
@@ -187,7 +187,7 @@ TEST_F(ClipPathLayerTest, PartiallyContainedChild) {
187187
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
188188
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
189189
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
190-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
190+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
191191
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
192192
EXPECT_TRUE(layer->needs_painting(paint_context()));
193193
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);

flow/layers/clip_rect_layer_unittests.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ TEST_F(ClipRectLayerTest, PaintingEmptyLayerDies) {
3030
EXPECT_EQ(preroll_context()->cull_rect, kGiantRect); // Untouched
3131
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
3232
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
33-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
33+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
3434
EXPECT_FALSE(layer->needs_painting(paint_context()));
3535

3636
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
@@ -41,7 +41,7 @@ TEST_F(ClipRectLayerTest, PaintBeforePrerollDies) {
4141
const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
4242
auto layer = std::make_shared<ClipRectLayer>(layer_bounds, Clip::hardEdge);
4343
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
44-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
44+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
4545
EXPECT_FALSE(layer->needs_painting(paint_context()));
4646

4747
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
@@ -65,7 +65,7 @@ TEST_F(ClipRectLayerTest, PaintingCulledLayerDies) {
6565
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
6666
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
6767
EXPECT_EQ(layer->paint_bounds(), child_bounds);
68-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
68+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
6969
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
7070
EXPECT_TRUE(layer->needs_painting(paint_context()));
7171
EXPECT_EQ(mock_layer->parent_cull_rect(), kEmptyRect);
@@ -103,7 +103,7 @@ TEST_F(ClipRectLayerTest, ChildOutsideBounds) {
103103
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
104104
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
105105
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
106-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
106+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
107107
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
108108
EXPECT_TRUE(layer->needs_painting(paint_context()));
109109
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);
@@ -139,7 +139,7 @@ TEST_F(ClipRectLayerTest, FullyContainedChild) {
139139
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
140140
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
141141
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
142-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
142+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
143143
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
144144
EXPECT_TRUE(layer->needs_painting(paint_context()));
145145
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
@@ -182,7 +182,7 @@ TEST_F(ClipRectLayerTest, PartiallyContainedChild) {
182182
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
183183
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
184184
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
185-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
185+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
186186
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
187187
EXPECT_TRUE(layer->needs_painting(paint_context()));
188188
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);

flow/layers/clip_rrect_layer_unittests.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ TEST_F(ClipRRectLayerTest, PaintingEmptyLayerDies) {
3232
EXPECT_EQ(preroll_context()->cull_rect, kGiantRect); // Untouched
3333
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
3434
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
35-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
35+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
3636
EXPECT_FALSE(layer->needs_painting(paint_context()));
3737

3838
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
@@ -44,7 +44,7 @@ TEST_F(ClipRRectLayerTest, PaintBeforePrerollDies) {
4444
const SkRRect layer_rrect = SkRRect::MakeRect(layer_bounds);
4545
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::hardEdge);
4646
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
47-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
47+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
4848
EXPECT_FALSE(layer->needs_painting(paint_context()));
4949

5050
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
@@ -70,7 +70,7 @@ TEST_F(ClipRRectLayerTest, PaintingCulledLayerDies) {
7070
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
7171
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
7272
EXPECT_EQ(layer->paint_bounds(), child_bounds);
73-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
73+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
7474
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
7575
EXPECT_TRUE(layer->needs_painting(paint_context()));
7676
EXPECT_EQ(mock_layer->parent_cull_rect(), kEmptyRect);
@@ -108,7 +108,7 @@ TEST_F(ClipRRectLayerTest, ChildOutsideBounds) {
108108
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
109109
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
110110
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
111-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
111+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
112112
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
113113
EXPECT_TRUE(layer->needs_painting(paint_context()));
114114
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);
@@ -144,7 +144,7 @@ TEST_F(ClipRRectLayerTest, FullyContainedChild) {
144144
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
145145
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
146146
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
147-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
147+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
148148
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
149149
EXPECT_TRUE(layer->needs_painting(paint_context()));
150150
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
@@ -187,7 +187,7 @@ TEST_F(ClipRRectLayerTest, PartiallyContainedChild) {
187187
EXPECT_TRUE(preroll_context()->mutators_stack.is_empty()); // Untouched
188188
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
189189
EXPECT_EQ(layer->paint_bounds(), child_intersect_bounds);
190-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
190+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
191191
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
192192
EXPECT_TRUE(layer->needs_painting(paint_context()));
193193
EXPECT_EQ(mock_layer->parent_cull_rect(), intersect_bounds);

flow/layers/color_filter_layer_unittests.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ TEST_F(ColorFilterLayerTest, PaintingEmptyLayerDies) {
2828

2929
layer->Preroll(preroll_context(), SkMatrix());
3030
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
31-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
31+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
3232
EXPECT_FALSE(layer->needs_painting(paint_context()));
3333

3434
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
@@ -43,7 +43,7 @@ TEST_F(ColorFilterLayerTest, PaintBeforePrerollDies) {
4343
layer->Add(mock_layer);
4444

4545
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
46-
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
46+
EXPECT_EQ(*(layer->child_paint_bounds()), kEmptyRect);
4747
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
4848
"needs_painting\\(context\\)");
4949
}
@@ -60,7 +60,7 @@ TEST_F(ColorFilterLayerTest, EmptyFilter) {
6060

6161
layer->Preroll(preroll_context(), initial_transform);
6262
EXPECT_EQ(layer->paint_bounds(), child_bounds);
63-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
63+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
6464
EXPECT_TRUE(layer->needs_painting(paint_context()));
6565
EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
6666

@@ -90,7 +90,7 @@ TEST_F(ColorFilterLayerTest, SimpleFilter) {
9090

9191
layer->Preroll(preroll_context(), initial_transform);
9292
EXPECT_EQ(layer->paint_bounds(), child_bounds);
93-
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
93+
EXPECT_EQ(*(layer->child_paint_bounds()), child_bounds);
9494
EXPECT_TRUE(layer->needs_painting(paint_context()));
9595
EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
9696

@@ -129,7 +129,7 @@ TEST_F(ColorFilterLayerTest, MultipleChildren) {
129129
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
130130
EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
131131
EXPECT_EQ(layer->paint_bounds(), children_bounds);
132-
EXPECT_EQ(layer->child_paint_bounds(), children_bounds);
132+
EXPECT_EQ(*(layer->child_paint_bounds()), children_bounds);
133133
EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
134134
EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
135135
EXPECT_TRUE(layer->needs_painting(paint_context()));
@@ -177,9 +177,9 @@ TEST_F(ColorFilterLayerTest, Nested) {
177177
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
178178
EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
179179
EXPECT_EQ(layer1->paint_bounds(), children_bounds);
180-
EXPECT_EQ(layer1->child_paint_bounds(), children_bounds);
180+
EXPECT_EQ(*(layer1->child_paint_bounds()), children_bounds);
181181
EXPECT_EQ(layer2->paint_bounds(), mock_layer2->paint_bounds());
182-
EXPECT_EQ(layer2->child_paint_bounds(), mock_layer2->paint_bounds());
182+
EXPECT_EQ(*(layer2->child_paint_bounds()), mock_layer2->paint_bounds());
183183
EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
184184
EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
185185
EXPECT_TRUE(layer1->needs_painting(paint_context()));
@@ -391,7 +391,7 @@ TEST_F(ColorFilterLayerTest, OpacityInheritance) {
391391
PrerollContext* context = preroll_context();
392392
context->subtree_can_inherit_opacity = false;
393393
color_filter_layer->Preroll(preroll_context(), initial_transform);
394-
// ColorFilterLayer can always inherit opacity whether or not their
394+
// ColorFilterLayers can always inherit opacity whether or not their
395395
// children are compatible.
396396
EXPECT_TRUE(context->subtree_can_inherit_opacity);
397397

flow/layers/container_layer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ class ContainerLayer : public Layer {
3232

3333
const ContainerLayer* as_container_layer() const override { return this; }
3434

35-
const SkRect& child_paint_bounds() const { return child_paint_bounds_; }
35+
const SkRect* child_paint_bounds() const override {
36+
return &child_paint_bounds_;
37+
}
3638

3739
protected:
3840
void PrerollChildren(PrerollContext* context,

flow/layers/container_layer_unittests.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ TEST_F(ContainerLayerTest, PaintingEmptyLayerDies) {
3434

3535
layer->Preroll(preroll_context(), SkMatrix());
3636
EXPECT_EQ(layer->paint_bounds(), SkRect::MakeEmpty());
37-
EXPECT_EQ(layer->child_paint_bounds(), SkRect::MakeEmpty());
37+
EXPECT_EQ(*(layer->child_paint_bounds()), SkRect::MakeEmpty());
3838
EXPECT_FALSE(layer->needs_painting(paint_context()));
3939

4040
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
@@ -49,7 +49,7 @@ TEST_F(ContainerLayerTest, PaintBeforePrerollDies) {
4949
layer->Add(mock_layer);
5050

5151
EXPECT_EQ(layer->paint_bounds(), SkRect::MakeEmpty());
52-
EXPECT_EQ(layer->child_paint_bounds(), SkRect::MakeEmpty());
52+
EXPECT_EQ(*(layer->child_paint_bounds()), SkRect::MakeEmpty());
5353
EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
5454
"needs_painting\\(context\\)");
5555
}
@@ -69,7 +69,7 @@ TEST_F(ContainerLayerTest, Simple) {
6969
EXPECT_FALSE(preroll_context()->has_platform_view);
7070
EXPECT_EQ(mock_layer->paint_bounds(), child_path.getBounds());
7171
EXPECT_EQ(layer->paint_bounds(), child_path.getBounds());
72-
EXPECT_EQ(layer->child_paint_bounds(), layer->paint_bounds());
72+
EXPECT_EQ(*(layer->child_paint_bounds()), layer->paint_bounds());
7373
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
7474
EXPECT_TRUE(layer->needs_painting(paint_context()));
7575
EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
@@ -104,7 +104,7 @@ TEST_F(ContainerLayerTest, Multiple) {
104104
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
105105
EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
106106
EXPECT_EQ(layer->paint_bounds(), expected_total_bounds);
107-
EXPECT_EQ(layer->child_paint_bounds(), layer->paint_bounds());
107+
EXPECT_EQ(*(layer->child_paint_bounds()), layer->paint_bounds());
108108
EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
109109
EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
110110
EXPECT_TRUE(layer->needs_painting(paint_context()));
@@ -141,7 +141,7 @@ TEST_F(ContainerLayerTest, MultipleWithEmpty) {
141141
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
142142
EXPECT_EQ(mock_layer2->paint_bounds(), SkPath().getBounds());
143143
EXPECT_EQ(layer->paint_bounds(), child_path1.getBounds());
144-
EXPECT_EQ(layer->child_paint_bounds(), layer->paint_bounds());
144+
EXPECT_EQ(*(layer->child_paint_bounds()), layer->paint_bounds());
145145
EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
146146
EXPECT_FALSE(mock_layer2->needs_painting(paint_context()));
147147
EXPECT_TRUE(layer->needs_painting(paint_context()));
@@ -179,7 +179,7 @@ TEST_F(ContainerLayerTest, NeedsSystemComposite) {
179179
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
180180
EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
181181
EXPECT_EQ(layer->paint_bounds(), expected_total_bounds);
182-
EXPECT_EQ(layer->child_paint_bounds(), layer->paint_bounds());
182+
EXPECT_EQ(*(layer->child_paint_bounds()), layer->paint_bounds());
183183
EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
184184
EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
185185
EXPECT_TRUE(layer->needs_painting(paint_context()));
@@ -206,11 +206,11 @@ TEST_F(ContainerLayerTest, RasterCacheTest) {
206206
const SkPaint child_paint2(SkColors::kGreen);
207207
const SkPaint paint;
208208
auto cacheable_container_layer1 =
209-
std::make_shared<MockCacheableContainerLayer>();
209+
MockCacheableContainerLayer::CacheLayerOrChildren();
210210
auto cacheable_container_layer2 =
211-
std::make_shared<MockCacheableContainerLayer2>();
211+
MockCacheableContainerLayer::CacheLayerOnly();
212212
auto cacheable_container_layer11 =
213-
std::make_shared<MockCacheableContainerLayer>();
213+
MockCacheableContainerLayer::CacheLayerOrChildren();
214214

215215
auto cacheable_layer111 =
216216
std::make_shared<MockCacheableLayer>(child_path3, paint);

0 commit comments

Comments
 (0)