Flutter Engine
The Flutter Engine
shader_mask_layer_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/flow/layers/shader_mask_layer.h"
6
7#include "flutter/flow/layers/layer_tree.h"
8#include "flutter/flow/layers/opacity_layer.h"
9#include "flutter/flow/raster_cache.h"
10#include "flutter/flow/raster_cache_util.h"
11#include "flutter/flow/testing/layer_test.h"
12#include "flutter/flow/testing/mock_layer.h"
13#include "flutter/fml/macros.h"
14#include "gtest/gtest.h"
15
16// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
17// NOLINTBEGIN(bugprone-unchecked-optional-access)
18
19namespace flutter {
20namespace testing {
21
23
24static std::shared_ptr<DlColorSource> MakeFilter(DlColor color) {
25 DlColor colors[] = {
26 color.withAlpha(0x7f),
27 color,
28 };
29 float stops[] = {
30 0,
31 1,
32 };
34 2, colors, stops, DlTileMode::kRepeat);
35}
36
37#ifndef NDEBUG
38TEST_F(ShaderMaskLayerTest, PaintingEmptyLayerDies) {
39 auto layer =
40 std::make_shared<ShaderMaskLayer>(nullptr, kEmptyRect, DlBlendMode::kSrc);
41
42 layer->Preroll(preroll_context());
43 EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
44 EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
45 EXPECT_FALSE(layer->needs_painting(paint_context()));
46
47 EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
48 "needs_painting\\(context\\)");
49}
50
51TEST_F(ShaderMaskLayerTest, PaintBeforePrerollDies) {
52 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
53 const SkPath child_path = SkPath().addRect(child_bounds);
54 auto mock_layer = std::make_shared<MockLayer>(child_path);
55 auto layer =
56 std::make_shared<ShaderMaskLayer>(nullptr, kEmptyRect, DlBlendMode::kSrc);
57 layer->Add(mock_layer);
58
59 EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
60 EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
61 EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
62 "needs_painting\\(context\\)");
63}
64#endif
65
66TEST_F(ShaderMaskLayerTest, EmptyFilter) {
67 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
68 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
69 const SkRect layer_bounds = SkRect::MakeLTRB(2.0f, 4.0f, 6.5f, 6.5f);
70 const SkPath child_path = SkPath().addRect(child_bounds);
71 const DlPaint child_paint = DlPaint(DlColor::kYellow());
72 auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
73 auto layer = std::make_shared<ShaderMaskLayer>(nullptr, layer_bounds,
75 layer->Add(mock_layer);
76
77 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
78 layer->Preroll(preroll_context());
79 EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
80 EXPECT_EQ(layer->paint_bounds(), child_bounds);
81 EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
82 EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
83 EXPECT_TRUE(layer->needs_painting(paint_context()));
84 EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
85
86 DlPaint filter_paint;
87 filter_paint.setBlendMode(DlBlendMode::kSrc);
88 filter_paint.setColorSource(nullptr);
89
90 layer->Paint(display_list_paint_context());
91 DisplayListBuilder expected_builder;
92 /* (ShaderMask)layer::Paint */ {
93 expected_builder.Save();
94 {
95 expected_builder.SaveLayer(&child_bounds);
96 {
97 /* mock_layer::Paint */ {
98 expected_builder.DrawPath(child_path, child_paint);
99 }
100 expected_builder.Translate(layer_bounds.fLeft, layer_bounds.fTop);
101 expected_builder.DrawRect(
102 SkRect::MakeWH(layer_bounds.width(), layer_bounds.height()),
103 filter_paint);
104 }
105 expected_builder.Restore();
106 }
107 expected_builder.Restore();
108 }
109 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
110}
111
112TEST_F(ShaderMaskLayerTest, SimpleFilter) {
113 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
114 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
115 const SkRect layer_bounds = SkRect::MakeLTRB(2.0f, 4.0f, 6.5f, 6.5f);
116 const SkPath child_path = SkPath().addRect(child_bounds);
117 const DlPaint child_paint = DlPaint(DlColor::kYellow());
118 auto dl_filter = MakeFilter(DlColor::kBlue());
119 auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
120 auto layer = std::make_shared<ShaderMaskLayer>(dl_filter, layer_bounds,
122 layer->Add(mock_layer);
123
124 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
125 layer->Preroll(preroll_context());
126 EXPECT_EQ(layer->paint_bounds(), child_bounds);
127 EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
128 EXPECT_TRUE(layer->needs_painting(paint_context()));
129 EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
130
131 DlPaint filter_paint;
132 filter_paint.setBlendMode(DlBlendMode::kSrc);
133 filter_paint.setColorSource(dl_filter);
134
135 layer->Paint(display_list_paint_context());
136 DisplayListBuilder expected_builder;
137 /* (ShaderMask)layer::Paint */ {
138 expected_builder.Save();
139 {
140 expected_builder.SaveLayer(&child_bounds);
141 {
142 /* mock_layer::Paint */ {
143 expected_builder.DrawPath(child_path, child_paint);
144 }
145 expected_builder.Translate(layer_bounds.fLeft, layer_bounds.fTop);
146 expected_builder.DrawRect(
147 SkRect::MakeWH(layer_bounds.width(), layer_bounds.height()),
148 filter_paint);
149 }
150 expected_builder.Restore();
151 }
152 expected_builder.Restore();
153 }
154 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
155}
156
157TEST_F(ShaderMaskLayerTest, MultipleChildren) {
158 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
159 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
160 const SkRect layer_bounds = SkRect::MakeLTRB(2.0f, 4.0f, 6.5f, 6.5f);
161 const SkPath child_path1 = SkPath().addRect(child_bounds);
162 const SkPath child_path2 =
163 SkPath().addRect(child_bounds.makeOffset(3.0f, 0.0f));
164 const DlPaint child_paint1 = DlPaint(DlColor::kYellow());
165 const DlPaint child_paint2 = DlPaint(DlColor::kCyan());
166 auto dl_filter = MakeFilter(DlColor::kBlue());
167 auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
168 auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
169 auto layer = std::make_shared<ShaderMaskLayer>(dl_filter, layer_bounds,
171 layer->Add(mock_layer1);
172 layer->Add(mock_layer2);
173
174 SkRect children_bounds = child_path1.getBounds();
175 children_bounds.join(child_path2.getBounds());
176 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
177 layer->Preroll(preroll_context());
178 EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
179 EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
180 EXPECT_EQ(layer->paint_bounds(), children_bounds);
181 EXPECT_EQ(layer->child_paint_bounds(), children_bounds);
182 EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
183 EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
184 EXPECT_TRUE(layer->needs_painting(paint_context()));
185 EXPECT_EQ(mock_layer1->parent_matrix(), initial_transform);
186 EXPECT_EQ(mock_layer2->parent_matrix(), initial_transform);
187
188 DlPaint filter_paint;
189 filter_paint.setBlendMode(DlBlendMode::kSrc);
190 filter_paint.setColorSource(dl_filter);
191
192 layer->Paint(display_list_paint_context());
193 DisplayListBuilder expected_builder;
194 /* (ShaderMask)layer::Paint */ {
195 expected_builder.Save();
196 {
197 expected_builder.SaveLayer(&children_bounds);
198 {
199 /* mock_layer1::Paint */ {
200 expected_builder.DrawPath(child_path1, child_paint1);
201 }
202 /* mock_layer2::Paint */ {
203 expected_builder.DrawPath(child_path2, child_paint2);
204 }
205 expected_builder.Translate(layer_bounds.fLeft, layer_bounds.fTop);
206 expected_builder.DrawRect(
207 SkRect::MakeWH(layer_bounds.width(), layer_bounds.height()),
208 filter_paint);
209 }
210 expected_builder.Restore();
211 }
212 expected_builder.Restore();
213 }
214 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
215}
216
218 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
219 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 7.5f, 8.5f);
220 const SkRect layer_bounds = SkRect::MakeLTRB(2.0f, 4.0f, 20.5f, 20.5f);
221 const SkPath child_path1 = SkPath().addRect(child_bounds);
222 const SkPath child_path2 =
223 SkPath().addRect(child_bounds.makeOffset(3.0f, 0.0f));
224 const DlPaint child_paint1 = DlPaint(DlColor::kYellow());
225 const DlPaint child_paint2 = DlPaint(DlColor::kCyan());
226 auto dl_filter1 = MakeFilter(DlColor::kGreen());
227 auto dl_filter2 = MakeFilter(DlColor::kMagenta());
228 auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
229 auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
230 auto layer1 = std::make_shared<ShaderMaskLayer>(dl_filter1, layer_bounds,
232 auto layer2 = std::make_shared<ShaderMaskLayer>(dl_filter2, layer_bounds,
234 layer2->Add(mock_layer2);
235 layer1->Add(mock_layer1);
236 layer1->Add(layer2);
237
238 SkRect children_bounds = child_path1.getBounds();
239 children_bounds.join(child_path2.getBounds());
240 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
241 layer1->Preroll(preroll_context());
242 EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
243 EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
244 EXPECT_EQ(layer1->paint_bounds(), children_bounds);
245 EXPECT_EQ(layer1->child_paint_bounds(), children_bounds);
246 EXPECT_EQ(layer2->paint_bounds(), mock_layer2->paint_bounds());
247 EXPECT_EQ(layer2->child_paint_bounds(), mock_layer2->paint_bounds());
248 EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
249 EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
250 EXPECT_TRUE(layer1->needs_painting(paint_context()));
251 EXPECT_TRUE(layer2->needs_painting(paint_context()));
252 EXPECT_EQ(mock_layer1->parent_matrix(), initial_transform);
253 EXPECT_EQ(mock_layer2->parent_matrix(), initial_transform);
254
255 DlPaint filter_paint1, filter_paint2;
256 filter_paint1.setBlendMode(DlBlendMode::kSrc);
257 filter_paint2.setBlendMode(DlBlendMode::kSrc);
258 filter_paint1.setColorSource(dl_filter1);
259 filter_paint2.setColorSource(dl_filter2);
260
261 layer1->Paint(display_list_paint_context());
262 DisplayListBuilder expected_builder;
263 /* (ShaderMask)layer1::Paint */ {
264 expected_builder.Save();
265 {
266 expected_builder.SaveLayer(&children_bounds);
267 {
268 /* mock_layer1::Paint */ {
269 expected_builder.DrawPath(child_path1, child_paint1);
270 }
271 /* (ShaderMask)layer2::Paint */ {
272 expected_builder.Save();
273 {
274 expected_builder.SaveLayer(&child_path2.getBounds());
275 {
276 /* mock_layer2::Paint */ {
277 expected_builder.DrawPath(child_path2, child_paint2);
278 }
279 expected_builder.Translate(layer_bounds.fLeft, layer_bounds.fTop);
280 expected_builder.DrawRect(
281 SkRect::MakeWH(layer_bounds.width(), layer_bounds.height()),
282 filter_paint2);
283 }
284 expected_builder.Restore();
285 }
286 expected_builder.Restore();
287 }
288 expected_builder.Translate(layer_bounds.fLeft, layer_bounds.fTop);
289 expected_builder.DrawRect(
290 SkRect::MakeWH(layer_bounds.width(), layer_bounds.height()),
291 filter_paint1);
292 }
293 expected_builder.Restore();
294 }
295 expected_builder.Restore();
296 }
297 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
298}
299
300TEST_F(ShaderMaskLayerTest, Readback) {
301 const SkRect layer_bounds = SkRect::MakeLTRB(2.0f, 4.0f, 20.5f, 20.5f);
302 auto dl_filter = MakeFilter(DlColor::kBlue());
303 auto layer = std::make_shared<ShaderMaskLayer>(dl_filter, layer_bounds,
305
306 // ShaderMaskLayer does not read from surface
307 preroll_context()->surface_needs_readback = false;
308 layer->Preroll(preroll_context());
309 EXPECT_FALSE(preroll_context()->surface_needs_readback);
310
311 // ShaderMaskLayer blocks child with readback
312 auto mock_layer = std::make_shared<MockLayer>(SkPath(), DlPaint());
313 mock_layer->set_fake_reads_surface(true);
314 layer->Add(mock_layer);
315 preroll_context()->surface_needs_readback = false;
316 layer->Preroll(preroll_context());
317 EXPECT_FALSE(preroll_context()->surface_needs_readback);
318}
319
320TEST_F(ShaderMaskLayerTest, LayerCached) {
321 auto dl_filter = MakeFilter(DlColor::kBlue());
323 const SkRect layer_bounds = SkRect::MakeLTRB(2.0f, 4.0f, 20.5f, 20.5f);
324 auto initial_transform = SkMatrix::Translate(50.0, 25.5);
325 const SkPath child_path = SkPath().addRect(SkRect::MakeWH(5.0f, 5.0f));
326 auto mock_layer = std::make_shared<MockLayer>(child_path);
327 auto layer = std::make_shared<ShaderMaskLayer>(dl_filter, layer_bounds,
329 layer->Add(mock_layer);
330
331 SkMatrix cache_ctm = initial_transform;
332 DisplayListBuilder cache_canvas;
333 cache_canvas.Transform(cache_ctm);
334
335 use_mock_raster_cache();
336 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
337 const auto* cacheable_shader_masker_item = layer->raster_cache_item();
338
339 EXPECT_EQ(raster_cache()->GetLayerCachedEntriesCount(), (size_t)0);
340 EXPECT_EQ(cacheable_shader_masker_item->cache_state(),
342 EXPECT_FALSE(cacheable_shader_masker_item->GetId().has_value());
343
344 // frame 1.
345 layer->Preroll(preroll_context());
346 LayerTree::TryToRasterCache(cacheable_items(), &paint_context());
347
348 EXPECT_EQ(raster_cache()->GetLayerCachedEntriesCount(), (size_t)0);
349 EXPECT_EQ(cacheable_shader_masker_item->cache_state(),
351 EXPECT_FALSE(cacheable_shader_masker_item->GetId().has_value());
352
353 // frame 2.
354 layer->Preroll(preroll_context());
355 LayerTree::TryToRasterCache(cacheable_items(), &paint_context());
356 EXPECT_EQ(raster_cache()->GetLayerCachedEntriesCount(), (size_t)0);
357 EXPECT_EQ(cacheable_shader_masker_item->cache_state(),
359 EXPECT_FALSE(cacheable_shader_masker_item->GetId().has_value());
360
361 // frame 3.
362 layer->Preroll(preroll_context());
363 LayerTree::TryToRasterCache(cacheable_items(), &paint_context());
364 EXPECT_EQ(raster_cache()->GetLayerCachedEntriesCount(), (size_t)1);
365 EXPECT_EQ(cacheable_shader_masker_item->cache_state(),
366 RasterCacheItem::CacheState::kCurrent);
367
368 EXPECT_TRUE(raster_cache()->Draw(
369 cacheable_shader_masker_item->GetId().value(), cache_canvas, &paint));
370}
371
372TEST_F(ShaderMaskLayerTest, OpacityInheritance) {
373 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
374 const SkPath child_path = SkPath().addRect(child_bounds);
375 auto mock_layer = MockLayer::Make(child_path);
376 const SkRect mask_rect = SkRect::MakeLTRB(10, 10, 20, 20);
377 auto shader_mask_layer =
378 std::make_shared<ShaderMaskLayer>(nullptr, mask_rect, DlBlendMode::kSrc);
379 shader_mask_layer->Add(mock_layer);
380
381 // ShaderMaskLayers can always support opacity despite incompatible children
382 PrerollContext* context = preroll_context();
383 shader_mask_layer->Preroll(context);
384 EXPECT_EQ(context->renderable_state_flags, Layer::kSaveLayerRenderFlags);
385
386 int opacity_alpha = 0x7F;
387 SkPoint offset = SkPoint::Make(10, 10);
388 auto opacity_layer = std::make_shared<OpacityLayer>(opacity_alpha, offset);
389 opacity_layer->Add(shader_mask_layer);
390 opacity_layer->Preroll(context);
391 EXPECT_TRUE(opacity_layer->children_can_accept_opacity());
392
393 DisplayListBuilder expected_builder;
394 /* OpacityLayer::Paint() */ {
395 expected_builder.Save();
396 {
397 expected_builder.Translate(offset.fX, offset.fY);
398 /* ShaderMaskLayer::Paint() */ {
399 DlPaint sl_paint = DlPaint(DlColor(opacity_alpha << 24));
400 expected_builder.SaveLayer(&child_path.getBounds(), &sl_paint);
401 {
402 /* child layer paint */ {
403 expected_builder.DrawPath(child_path, DlPaint());
404 }
405 expected_builder.Translate(mask_rect.fLeft, mask_rect.fTop);
406 expected_builder.DrawRect(
407 SkRect::MakeWH(mask_rect.width(), mask_rect.height()),
408 DlPaint().setBlendMode(DlBlendMode::kSrc));
409 }
410 expected_builder.Restore();
411 }
412 }
413 expected_builder.Restore();
414 }
415
416 opacity_layer->Paint(display_list_paint_context());
417 EXPECT_TRUE(DisplayListsEQ_Verbose(expected_builder.Build(), display_list()));
418}
419
420TEST_F(ShaderMaskLayerTest, SimpleFilterWithRasterCacheLayerNotCached) {
421 use_mock_raster_cache(); // Ensure non-fractional alignment.
422
423 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
424 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
425 const SkRect layer_bounds = SkRect::MakeLTRB(2.0f, 4.0f, 6.5f, 6.5f);
426 const SkPath child_path = SkPath().addRect(child_bounds);
427 const DlPaint child_paint = DlPaint(DlColor::kYellow());
428 auto dl_filter = MakeFilter(DlColor::kBlue());
429 auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
430 auto layer = std::make_shared<ShaderMaskLayer>(dl_filter, layer_bounds,
432 layer->Add(mock_layer);
433
434 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
435 layer->Preroll(preroll_context());
436
437 DlPaint filter_paint;
438 filter_paint.setBlendMode(DlBlendMode::kSrc);
439 filter_paint.setColorSource(dl_filter);
440
441 layer->Paint(display_list_paint_context());
442 DisplayListBuilder expected_builder;
443 /* (ShaderMask)layer::Paint */ {
444 expected_builder.Save();
445 {
446 // The layer will notice that the CTM is already an integer matrix
447 // and will not perform an Integral CTM operation.
448 // expected_builder.TransformReset();
449 // expected_builder.Transform(SkMatrix());
450 expected_builder.SaveLayer(&child_bounds);
451 {
452 /* mock_layer::Paint */ {
453 expected_builder.DrawPath(child_path, child_paint);
454 }
455 expected_builder.Translate(layer_bounds.fLeft, layer_bounds.fTop);
456 expected_builder.DrawRect(
457 SkRect::MakeWH(layer_bounds.width(), layer_bounds.height()),
458 filter_paint);
459 }
460 expected_builder.Restore();
461 }
462 expected_builder.Restore();
463 }
464 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
465}
466
467} // namespace testing
468} // namespace flutter
469
470// NOLINTEND(bugprone-unchecked-optional-access)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Definition: SkMatrix.h:91
Definition: SkPath.h:59
const SkRect & getBounds() const
Definition: SkPath.cpp:430
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
Definition: SkPath.cpp:864
void DrawRect(const SkRect &rect, const DlPaint &paint) override
Definition: dl_builder.cc:1116
void Translate(SkScalar tx, SkScalar ty) override
Definition: dl_builder.cc:799
void DrawPath(const SkPath &path, const DlPaint &paint) override
Definition: dl_builder.cc:1204
void SaveLayer(const SkRect *bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr) override
Definition: dl_builder.cc:549
sk_sp< DisplayList > Build()
Definition: dl_builder.cc:67
static std::shared_ptr< DlLinearGradientColorSource > MakeLinear(const SkPoint start_point, const SkPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
DlPaint & setBlendMode(DlBlendMode mode)
Definition: dl_paint.h:86
DlPaint & setColorSource(std::shared_ptr< const DlColorSource > source)
Definition: dl_paint.h:131
static void TryToRasterCache(const std::vector< RasterCacheItem * > &raster_cached_entries, const PaintContext *paint_context, bool ignore_raster_cache=false)
Definition: layer_tree.cc:68
static constexpr int kSaveLayerRenderFlags
Definition: layer.h:132
static std::shared_ptr< MockLayer > Make(const SkPath &path, DlPaint paint=DlPaint())
Definition: mock_layer.h:30
static void Draw(SkCanvas *canvas, const SkRect &rect)
const Paint & paint
Definition: color_source.cc:38
DlColor color
PODArray< SkColor > colors
Definition: SkRecords.h:276
TEST_F(DisplayListTest, Defaults)
LayerTestBase<::testing::Test > LayerTest
Definition: layer_test.h:210
static std::shared_ptr< DlColorSource > MakeFilter(DlColor color)
bool DisplayListsEQ_Verbose(const DisplayList *a, const DisplayList *b)
static constexpr SkRect kEmptyRect
Definition: mock_canvas.h:30
@ kNone
Definition: layer.h:53
flutter::DlColor DlColor
flutter::DlPaint DlPaint
SeparatedVector2 offset
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
constexpr SkRect makeOffset(float dx, float dy) const
Definition: SkRect.h:965
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762
void join(const SkRect &r)
Definition: SkRect.cpp:126
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15
static constexpr DlColor kMagenta()
Definition: dl_color.h:28
static constexpr DlColor kBlue()
Definition: dl_color.h:26
static constexpr DlColor kYellow()
Definition: dl_color.h:29
static constexpr DlColor kGreen()
Definition: dl_color.h:25
static constexpr DlColor kCyan()
Definition: dl_color.h:27
#define EXPECT_TRUE(handle)
Definition: unit_test.h:678