Flutter Engine
The Flutter Engine
backdrop_filter_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/backdrop_filter_layer.h"
6#include "flutter/flow/layers/clip_rect_layer.h"
7
8#include "flutter/flow/layers/clip_rect_layer.h"
9#include "flutter/flow/layers/transform_layer.h"
10#include "flutter/flow/testing/diff_context_test.h"
11#include "flutter/flow/testing/layer_test.h"
12#include "flutter/flow/testing/mock_layer.h"
13#include "flutter/fml/macros.h"
14
15namespace flutter {
16namespace testing {
17
19
20#ifndef NDEBUG
21TEST_F(BackdropFilterLayerTest, PaintingEmptyLayerDies) {
22 auto filter = DlBlurImageFilter(5, 5, DlTileMode::kClamp);
23 auto layer = std::make_shared<BackdropFilterLayer>(filter.shared(),
25 auto parent = std::make_shared<ClipRectLayer>(kEmptyRect, Clip::kHardEdge);
26 parent->Add(layer);
27
28 parent->Preroll(preroll_context());
29 EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
30 EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
31 EXPECT_FALSE(layer->needs_painting(paint_context()));
32
33 EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
34 "needs_painting\\(context\\)");
35}
36
37TEST_F(BackdropFilterLayerTest, PaintBeforePrerollDies) {
38 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
39 const SkPath child_path = SkPath().addRect(child_bounds);
40 auto mock_layer = std::make_shared<MockLayer>(child_path);
41 auto filter = DlBlurImageFilter(5, 5, DlTileMode::kClamp);
42 auto layer = std::make_shared<BackdropFilterLayer>(filter.shared(),
44 layer->Add(mock_layer);
45
46 EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
47 EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
48 EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
49 "needs_painting\\(context\\)");
50}
51#endif
52
54 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
55 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
56 const SkPath child_path = SkPath().addRect(child_bounds);
57 const DlPaint child_paint = DlPaint(DlColor::kYellow());
58 auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
59 auto layer =
60 std::make_shared<BackdropFilterLayer>(nullptr, DlBlendMode::kSrcOver);
61 layer->Add(mock_layer);
62 auto parent = std::make_shared<ClipRectLayer>(child_bounds, Clip::kHardEdge);
63 parent->Add(layer);
64
65 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
66 parent->Preroll(preroll_context());
67 EXPECT_EQ(layer->paint_bounds(), child_bounds);
68 EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
69 EXPECT_TRUE(layer->needs_painting(paint_context()));
70 EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
71
72 parent->Paint(display_list_paint_context());
73 DisplayListBuilder expected_builder;
74 /* (ClipRect)parent::Paint */ {
75 expected_builder.Save();
76 {
77 expected_builder.ClipRect(child_bounds, DlCanvas::ClipOp::kIntersect,
78 false);
79 /* (BackdropFilter)layer::Paint */ {
80 expected_builder.Save();
81 {
82 expected_builder.SaveLayer(&child_bounds, nullptr, nullptr);
83 {
84 /* mock_layer::Paint */ {
85 expected_builder.DrawPath(child_path, child_paint);
86 }
87 }
88 expected_builder.Restore();
89 }
90 expected_builder.Restore();
91 }
92 }
93 expected_builder.Restore();
94 }
95 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
96}
97
99 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
100 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
101 const SkPath child_path = SkPath().addRect(child_bounds);
102 const DlPaint child_paint = DlPaint(DlColor::kYellow());
103 auto layer_filter =
104 std::make_shared<DlBlurImageFilter>(2.5, 3.2, DlTileMode::kClamp);
105 auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
106 auto layer = std::make_shared<BackdropFilterLayer>(layer_filter,
108 layer->Add(mock_layer);
109 auto parent = std::make_shared<ClipRectLayer>(child_bounds, Clip::kHardEdge);
110 parent->Add(layer);
111
112 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
113 parent->Preroll(preroll_context());
114 EXPECT_EQ(layer->paint_bounds(), child_bounds);
115 EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
116 EXPECT_TRUE(layer->needs_painting(paint_context()));
117 EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
118
119 parent->Paint(display_list_paint_context());
120 DisplayListBuilder expected_builder;
121 /* (ClipRect)parent::Paint */ {
122 expected_builder.Save();
123 {
124 expected_builder.ClipRect(child_bounds, DlCanvas::ClipOp::kIntersect,
125 false);
126 /* (BackdropFilter)layer::Paint */ {
127 expected_builder.Save();
128 {
129 expected_builder.SaveLayer(&child_bounds, nullptr,
130 layer_filter.get());
131 {
132 /* mock_layer::Paint */ {
133 expected_builder.DrawPath(child_path, child_paint);
134 }
135 }
136 expected_builder.Restore();
137 }
138 expected_builder.Restore();
139 }
140 }
141 expected_builder.Restore();
142 }
143 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
144}
145
147 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
148 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
149 const SkPath child_path = SkPath().addRect(child_bounds);
150 const DlPaint child_paint = DlPaint(DlColor::kYellow());
151 auto layer_filter =
152 std::make_shared<DlBlurImageFilter>(2.5, 3.2, DlTileMode::kClamp);
153 auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
154 auto layer =
155 std::make_shared<BackdropFilterLayer>(layer_filter, DlBlendMode::kSrc);
156 layer->Add(mock_layer);
157 auto parent = std::make_shared<ClipRectLayer>(child_bounds, Clip::kHardEdge);
158 parent->Add(layer);
159
160 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
161 parent->Preroll(preroll_context());
162 EXPECT_EQ(layer->paint_bounds(), child_bounds);
163 EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
164 EXPECT_TRUE(layer->needs_painting(paint_context()));
165 EXPECT_EQ(mock_layer->parent_matrix(), initial_transform);
166
167 DlPaint filter_paint = DlPaint();
168 filter_paint.setBlendMode(DlBlendMode::kSrc);
169
170 parent->Paint(display_list_paint_context());
171 DisplayListBuilder expected_builder;
172 /* (ClipRect)parent::Paint */ {
173 expected_builder.Save();
174 {
175 expected_builder.ClipRect(child_bounds, DlCanvas::ClipOp::kIntersect,
176 false);
177 /* (BackdropFilter)layer::Paint */ {
178 expected_builder.Save();
179 {
181 expected_builder.SaveLayer(&child_bounds, &save_paint,
182 layer_filter.get());
183 {
184 /* mock_layer::Paint */ {
185 expected_builder.DrawPath(child_path, child_paint);
186 }
187 }
188 expected_builder.Restore();
189 }
190 expected_builder.Restore();
191 }
192 }
193 expected_builder.Restore();
194 }
195 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
196}
197
198TEST_F(BackdropFilterLayerTest, MultipleChildren) {
199 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
200 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 2.5f, 3.5f);
201 const SkPath child_path1 = SkPath().addRect(child_bounds);
202 const SkPath child_path2 =
203 SkPath().addRect(child_bounds.makeOffset(3.0f, 0.0f));
204 const DlPaint child_paint1 = DlPaint(DlColor::kYellow());
205 const DlPaint child_paint2 = DlPaint(DlColor::kCyan());
206 SkRect children_bounds = child_path1.getBounds();
207 children_bounds.join(child_path2.getBounds());
208 auto layer_filter =
209 std::make_shared<DlBlurImageFilter>(2.5, 3.2, DlTileMode::kClamp);
210 auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
211 auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
212 auto layer = std::make_shared<BackdropFilterLayer>(layer_filter,
214 layer->Add(mock_layer1);
215 layer->Add(mock_layer2);
216 auto parent =
217 std::make_shared<ClipRectLayer>(children_bounds, Clip::kHardEdge);
218 parent->Add(layer);
219
220 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
221 parent->Preroll(preroll_context());
222 EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
223 EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
224 EXPECT_EQ(layer->paint_bounds(), children_bounds);
225 EXPECT_EQ(layer->child_paint_bounds(), children_bounds);
226 EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
227 EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
228 EXPECT_TRUE(layer->needs_painting(paint_context()));
229 EXPECT_EQ(mock_layer1->parent_matrix(), initial_transform);
230 EXPECT_EQ(mock_layer2->parent_matrix(), initial_transform);
231
232 parent->Paint(display_list_paint_context());
233 DisplayListBuilder expected_builder;
234 /* (ClipRect)parent::Paint */ {
235 expected_builder.Save();
236 {
237 expected_builder.ClipRect(children_bounds, DlCanvas::ClipOp::kIntersect,
238 false);
239 /* (BackdropFilter)layer::Paint */ {
240 expected_builder.Save();
241 {
242 expected_builder.SaveLayer(&children_bounds, nullptr,
243 layer_filter.get());
244 {
245 /* mock_layer1::Paint */ {
246 expected_builder.DrawPath(child_path1, child_paint1);
247 }
248 /* mock_layer2::Paint */ {
249 expected_builder.DrawPath(child_path2, child_paint2);
250 }
251 }
252 expected_builder.Restore();
253 }
254 expected_builder.Restore();
255 }
256 }
257 expected_builder.Restore();
258 }
259 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
260}
261
263 const SkMatrix initial_transform = SkMatrix::Translate(0.5f, 1.0f);
264 const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 2.5f, 3.5f);
265 const SkPath child_path1 = SkPath().addRect(child_bounds);
266 const SkPath child_path2 =
267 SkPath().addRect(child_bounds.makeOffset(3.0f, 0.0f));
268 const DlPaint child_paint1 = DlPaint(DlColor::kYellow());
269 const DlPaint child_paint2 = DlPaint(DlColor::kCyan());
270 SkRect children_bounds = child_path1.getBounds();
271 children_bounds.join(child_path2.getBounds());
272 auto layer_filter1 =
273 std::make_shared<DlBlurImageFilter>(2.5, 3.2, DlTileMode::kClamp);
274 auto layer_filter2 =
275 std::make_shared<DlBlurImageFilter>(2.7, 3.1, DlTileMode::kDecal);
276 auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
277 auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
278 auto layer1 = std::make_shared<BackdropFilterLayer>(layer_filter1,
280 auto layer2 = std::make_shared<BackdropFilterLayer>(layer_filter2,
282 layer2->Add(mock_layer2);
283 layer1->Add(mock_layer1);
284 layer1->Add(layer2);
285 auto parent =
286 std::make_shared<ClipRectLayer>(children_bounds, Clip::kHardEdge);
287 parent->Add(layer1);
288
289 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
290 parent->Preroll(preroll_context());
291
292 EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
293 EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
294 EXPECT_EQ(layer1->paint_bounds(), children_bounds);
295 EXPECT_EQ(layer2->paint_bounds(), children_bounds);
296 EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
297 EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
298 EXPECT_TRUE(layer1->needs_painting(paint_context()));
299 EXPECT_TRUE(layer2->needs_painting(paint_context()));
300 EXPECT_EQ(mock_layer1->parent_matrix(), initial_transform);
301 EXPECT_EQ(mock_layer2->parent_matrix(), initial_transform);
302
303 parent->Paint(display_list_paint_context());
304 DisplayListBuilder expected_builder;
305 /* (ClipRect)parent::Paint */ {
306 expected_builder.Save();
307 {
308 expected_builder.ClipRect(children_bounds, DlCanvas::ClipOp::kIntersect,
309 false);
310 /* (BackdropFilter)layer1::Paint */ {
311 expected_builder.Save();
312 {
313 expected_builder.SaveLayer(&children_bounds, nullptr,
314 layer_filter1.get());
315 {
316 /* mock_layer1::Paint */ {
317 expected_builder.DrawPath(child_path1, child_paint1);
318 }
319 /* (BackdropFilter)layer2::Paint */ {
320 expected_builder.Save();
321 {
322 expected_builder.SaveLayer(&children_bounds, nullptr,
323 layer_filter2.get());
324 {
325 /* mock_layer2::Paint */ {
326 expected_builder.DrawPath(child_path2, child_paint2);
327 }
328 }
329 expected_builder.Restore();
330 }
331 expected_builder.Restore();
332 }
333 }
334 expected_builder.Restore();
335 }
336 expected_builder.Restore();
337 }
338 }
339 expected_builder.Restore();
340 }
341 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
342}
343
345 std::shared_ptr<DlImageFilter> no_filter;
346 auto layer_filter = DlBlurImageFilter(5, 5, DlTileMode::kClamp);
347 auto initial_transform = SkMatrix();
348
349 // BDF with filter always reads from surface
350 auto layer1 = std::make_shared<BackdropFilterLayer>(layer_filter.shared(),
352 preroll_context()->surface_needs_readback = false;
353 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
354 layer1->Preroll(preroll_context());
355 EXPECT_TRUE(preroll_context()->surface_needs_readback);
356
357 // BDF with no filter does not read from surface itself
358 auto layer2 =
359 std::make_shared<BackdropFilterLayer>(no_filter, DlBlendMode::kSrcOver);
360 preroll_context()->surface_needs_readback = false;
361 layer2->Preroll(preroll_context());
362 EXPECT_FALSE(preroll_context()->surface_needs_readback);
363
364 // BDF with no filter does not block prior readback value
365 preroll_context()->surface_needs_readback = true;
366 layer2->Preroll(preroll_context());
367 EXPECT_TRUE(preroll_context()->surface_needs_readback);
368
369 // BDF with no filter blocks child with readback
370 auto mock_layer = std::make_shared<MockLayer>(SkPath(), DlPaint());
371 mock_layer->set_fake_reads_surface(true);
372 layer2->Add(mock_layer);
373 preroll_context()->surface_needs_readback = false;
374 layer2->Preroll(preroll_context());
375 EXPECT_FALSE(preroll_context()->surface_needs_readback);
376}
377
378TEST_F(BackdropFilterLayerTest, OpacityInheritance) {
379 auto backdrop_filter = DlBlurImageFilter(5, 5, DlTileMode::kClamp);
380 const SkPath mock_path = SkPath().addRect(SkRect::MakeLTRB(0, 0, 10, 10));
381 const DlPaint mock_paint = DlPaint(DlColor::kRed());
382 const SkRect clip_rect = SkRect::MakeLTRB(0, 0, 100, 100);
383
384 auto clip = std::make_shared<ClipRectLayer>(clip_rect, Clip::kHardEdge);
385 auto parent = std::make_shared<OpacityLayer>(128, SkPoint::Make(0, 0));
386 auto layer = std::make_shared<BackdropFilterLayer>(backdrop_filter.shared(),
388 auto child = std::make_shared<MockLayer>(mock_path, mock_paint);
389 layer->Add(child);
390 parent->Add(layer);
391 clip->Add(parent);
392
393 clip->Preroll(preroll_context());
394
395 clip->Paint(display_list_paint_context());
396
397 DisplayListBuilder expected_builder;
398 /* ClipRectLayer::Paint */ {
399 expected_builder.Save();
400 {
401 expected_builder.ClipRect(clip_rect, DlCanvas::ClipOp::kIntersect, false);
402 /* OpacityLayer::Paint */ {
403 // NOP - it hands opacity down to BackdropFilterLayer
404 /* BackdropFilterLayer::Paint */ {
405 DlPaint save_paint;
406 save_paint.setAlpha(128);
407 expected_builder.SaveLayer(&clip_rect, &save_paint, &backdrop_filter);
408 {
409 /* MockLayer::Paint */ {
410 DlPaint child_paint;
411 child_paint.setColor(DlColor::kRed());
412 expected_builder.DrawPath(mock_path, child_paint);
413 }
414 }
415 expected_builder.Restore();
416 }
417 }
418 }
419 expected_builder.Restore();
420 }
421 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
422}
423
425
427 auto filter = DlBlurImageFilter(10, 10, DlTileMode::kClamp);
428
429 {
430 // tests later assume 30px readback area, fail early if that's not the case
432 EXPECT_EQ(filter.get_input_device_bounds(SkIRect::MakeWH(10, 10),
434 &readback);
435 EXPECT_EQ(readback, SkIRect::MakeLTRB(-30, -30, 40, 40));
436 }
437
438 MockLayerTree l1(SkISize::Make(100, 100));
439 l1.root()->Add(std::make_shared<BackdropFilterLayer>(filter.shared(),
441
442 // no clip, effect over entire surface
443 auto damage = DiffLayerTree(l1, MockLayerTree(SkISize::Make(100, 100)));
444 EXPECT_EQ(damage.frame_damage, SkIRect::MakeWH(100, 100));
445
446 MockLayerTree l2(SkISize::Make(100, 100));
447
448 auto clip = std::make_shared<ClipRectLayer>(SkRect::MakeLTRB(20, 20, 60, 60),
450 clip->Add(std::make_shared<BackdropFilterLayer>(filter.shared(),
452 l2.root()->Add(clip);
453 damage = DiffLayerTree(l2, MockLayerTree(SkISize::Make(100, 100)));
454
455 EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(0, 0, 90, 90));
456
457 MockLayerTree l3;
458 auto scale = std::make_shared<TransformLayer>(SkMatrix::Scale(2.0, 2.0));
459 scale->Add(clip);
460 l3.root()->Add(scale);
461
462 damage = DiffLayerTree(l3, MockLayerTree());
463 EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(0, 0, 180, 180));
464
465 MockLayerTree l4;
466 l4.root()->Add(scale);
467
468 // path just outside of readback region, doesn't affect blur
469 auto path1 = SkPath().addRect(SkRect::MakeLTRB(180, 180, 190, 190));
470 l4.root()->Add(std::make_shared<MockLayer>(path1));
471 damage = DiffLayerTree(l4, l3);
472 EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(180, 180, 190, 190));
473
474 MockLayerTree l5;
475 l5.root()->Add(scale);
476
477 // path just inside of readback region, must trigger backdrop repaint
478 auto path2 = SkPath().addRect(SkRect::MakeLTRB(179, 179, 189, 189));
479 l5.root()->Add(std::make_shared<MockLayer>(path2));
480 damage = DiffLayerTree(l5, l4);
481 EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(0, 0, 190, 190));
482}
483
484TEST_F(BackdropLayerDiffTest, ReadbackOutsideOfPaintArea) {
485 auto filter = DlMatrixImageFilter(SkMatrix::Translate(50, 50),
487
488 MockLayerTree l1(SkISize::Make(100, 100));
489
490 auto clip = std::make_shared<ClipRectLayer>(SkRect::MakeLTRB(60, 60, 80, 80),
492 clip->Add(std::make_shared<BackdropFilterLayer>(filter.shared(),
494 l1.root()->Add(clip);
495 auto damage = DiffLayerTree(l1, MockLayerTree(SkISize::Make(100, 100)));
496
497 EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(60 - 50, 60 - 50, 80, 80));
498
499 MockLayerTree l2(SkISize::Make(100, 100));
500 // path inside readback area must trigger whole readback repaint + filter
501 // repaint.
502 auto path2 = SkPath().addRect(SkRect::MakeXYWH(60 - 50, 60 - 50, 10, 10));
503 l2.root()->Add(clip);
504 l2.root()->Add(std::make_shared<MockLayer>(path2));
505 damage = DiffLayerTree(l2, l1);
506 EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(60 - 50, 60 - 50, 80, 80));
507}
508
509TEST_F(BackdropLayerDiffTest, BackdropLayerInvalidTransform) {
510 auto filter = DlBlurImageFilter(10, 10, DlTileMode::kClamp);
511
512 {
513 // tests later assume 30px readback area, fail early if that's not the case
515 EXPECT_EQ(filter.get_input_device_bounds(SkIRect::MakeWH(10, 10),
517 &readback);
518 EXPECT_EQ(readback, SkIRect::MakeLTRB(-30, -30, 40, 40));
519 }
520
521 MockLayerTree l1(SkISize::Make(100, 100));
523 transform.setPerspX(0.1);
524 transform.setPerspY(0.1);
525
526 auto transform_layer = std::make_shared<TransformLayer>(transform);
527 l1.root()->Add(transform_layer);
528 transform_layer->Add(std::make_shared<BackdropFilterLayer>(
529 filter.shared(), DlBlendMode::kSrcOver));
530
531 auto damage = DiffLayerTree(l1, MockLayerTree(SkISize::Make(100, 100)));
532 EXPECT_EQ(damage.frame_damage, SkIRect::MakeWH(100, 100));
533}
534
535} // namespace testing
536} // namespace flutter
static void readback(const SkBitmap &src, int *result, int resultCount)
Definition: BlurTest.cpp:264
static SkPath path1()
static SkPath path2()
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition: SkPath.cpp:3892
static SkMatrix Scale(SkScalar sx, SkScalar sy)
Definition: SkMatrix.h:75
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Definition: SkMatrix.h:91
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
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
virtual void Add(std::shared_ptr< Layer > layer)
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
void ClipRect(const SkRect &rect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false) override
Definition: dl_builder.cc:934
DlPaint & setColor(DlColor color)
Definition: dl_paint.h:70
DlPaint & setAlpha(uint8_t alpha)
Definition: dl_paint.h:76
DlPaint & setBlendMode(DlBlendMode mode)
Definition: dl_paint.h:86
TEST_F(DisplayListTest, Defaults)
LayerTestBase<::testing::Test > LayerTest
Definition: layer_test.h:210
bool DisplayListsEQ_Verbose(const DisplayList *a, const DisplayList *b)
static constexpr SkRect kEmptyRect
Definition: mock_canvas.h:30
@ kHardEdge
Definition: layer.h:53
@ kSrcOver
r = s + (1-sa)*d
flutter::DlPaint DlPaint
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47
const Scalar scale
Definition: SkRect.h:32
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
Definition: SkRect.h:91
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
Definition: SkRect.h:56
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20
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
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
void join(const SkRect &r)
Definition: SkRect.cpp:126
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646
static constexpr DlColor kYellow()
Definition: dl_color.h:29
static constexpr DlColor kRed()
Definition: dl_color.h:24
static constexpr DlColor kCyan()
Definition: dl_color.h:27
#define EXPECT_TRUE(handle)
Definition: unit_test.h:678