Flutter Engine
 
Loading...
Searching...
No Matches
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
6
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 };
33 return DlColorSource::MakeLinear(DlPoint(0, 0), DlPoint(10, 10), 2, colors,
34 stops, DlTileMode::kRepeat);
35}
36
37#ifndef NDEBUG
38TEST_F(ShaderMaskLayerTest, PaintingEmptyLayerDies) {
39 auto layer =
40 std::make_shared<ShaderMaskLayer>(nullptr, DlRect(), DlBlendMode::kSrc);
41
42 layer->Preroll(preroll_context());
43 EXPECT_EQ(layer->paint_bounds(), DlRect());
44 EXPECT_EQ(layer->child_paint_bounds(), DlRect());
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 DlRect child_bounds = DlRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
53 const DlPath child_path = DlPath::MakeRect(child_bounds);
54 auto mock_layer = std::make_shared<MockLayer>(child_path);
55 auto layer =
56 std::make_shared<ShaderMaskLayer>(nullptr, DlRect(), DlBlendMode::kSrc);
57 layer->Add(mock_layer);
58
59 EXPECT_EQ(layer->paint_bounds(), DlRect());
60 EXPECT_EQ(layer->child_paint_bounds(), DlRect());
61 EXPECT_DEATH_IF_SUPPORTED(layer->Paint(paint_context()),
62 "needs_painting\\(context\\)");
63}
64#endif
65
66TEST_F(ShaderMaskLayerTest, EmptyFilter) {
67 const DlMatrix initial_transform = DlMatrix::MakeTranslation({0.5f, 1.0f});
68 const DlRect child_bounds = DlRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
69 const DlRect layer_bounds = DlRect::MakeLTRB(2.0f, 4.0f, 6.5f, 6.5f);
70 const DlPath child_path = DlPath::MakeRect(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,
74 DlBlendMode::kSrc);
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.GetLeft(),
101 layer_bounds.GetTop());
102 expected_builder.DrawRect(DlRect::MakeSize(layer_bounds.GetSize()),
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 DlMatrix initial_transform = DlMatrix::MakeTranslation({0.5f, 1.0f});
114 const DlRect child_bounds = DlRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
115 const DlRect layer_bounds = DlRect::MakeLTRB(2.0f, 4.0f, 6.5f, 6.5f);
116 const DlPath child_path = DlPath::MakeRect(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,
121 DlBlendMode::kSrc);
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.GetLeft(),
146 layer_bounds.GetTop());
147 expected_builder.DrawRect(DlRect::MakeSize(layer_bounds.GetSize()),
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 DlMatrix initial_transform = DlMatrix::MakeTranslation({0.5f, 1.0f});
159 const DlRect child_bounds = DlRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
160 const DlRect layer_bounds = DlRect::MakeLTRB(2.0f, 4.0f, 6.5f, 6.5f);
161 const DlPath child_path1 = DlPath::MakeRect(child_bounds);
162 const DlPath child_path2 = DlPath::MakeRect(child_bounds.Shift(3.0f, 0.0f));
163 const DlPaint child_paint1 = DlPaint(DlColor::kYellow());
164 const DlPaint child_paint2 = DlPaint(DlColor::kCyan());
165 auto dl_filter = MakeFilter(DlColor::kBlue());
166 auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
167 auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
168 auto layer = std::make_shared<ShaderMaskLayer>(dl_filter, layer_bounds,
169 DlBlendMode::kSrc);
170 layer->Add(mock_layer1);
171 layer->Add(mock_layer2);
172
173 const DlRect children_bounds =
174 child_path1.GetBounds().Union(child_path2.GetBounds());
175 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
176 layer->Preroll(preroll_context());
177 EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.GetBounds());
178 EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.GetBounds());
179 EXPECT_EQ(layer->paint_bounds(), children_bounds);
180 EXPECT_EQ(layer->child_paint_bounds(), children_bounds);
181 EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
182 EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
183 EXPECT_TRUE(layer->needs_painting(paint_context()));
184 EXPECT_EQ(mock_layer1->parent_matrix(), initial_transform);
185 EXPECT_EQ(mock_layer2->parent_matrix(), initial_transform);
186
187 DlPaint filter_paint;
188 filter_paint.setBlendMode(DlBlendMode::kSrc);
189 filter_paint.setColorSource(dl_filter);
190
191 layer->Paint(display_list_paint_context());
192 DisplayListBuilder expected_builder;
193 /* (ShaderMask)layer::Paint */ {
194 expected_builder.Save();
195 {
196 expected_builder.SaveLayer(children_bounds);
197 {
198 /* mock_layer1::Paint */ {
199 expected_builder.DrawPath(child_path1, child_paint1);
200 }
201 /* mock_layer2::Paint */ {
202 expected_builder.DrawPath(child_path2, child_paint2);
203 }
204 expected_builder.Translate(layer_bounds.GetLeft(),
205 layer_bounds.GetTop());
206 expected_builder.DrawRect(DlRect::MakeSize(layer_bounds.GetSize()),
207 filter_paint);
208 }
209 expected_builder.Restore();
210 }
211 expected_builder.Restore();
212 }
213 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
214}
215
217 const DlMatrix initial_transform = DlMatrix::MakeTranslation({0.5f, 1.0f});
218 const DlRect child_bounds = DlRect::MakeLTRB(5.0f, 6.0f, 7.5f, 8.5f);
219 const DlRect layer_bounds = DlRect::MakeLTRB(2.0f, 4.0f, 20.5f, 20.5f);
220 const DlPath child_path1 = DlPath::MakeRect(child_bounds);
221 const DlPath child_path2 = DlPath::MakeRect(child_bounds.Shift(3.0f, 0.0f));
222 const DlPaint child_paint1 = DlPaint(DlColor::kYellow());
223 const DlPaint child_paint2 = DlPaint(DlColor::kCyan());
224 auto dl_filter1 = MakeFilter(DlColor::kGreen());
225 auto dl_filter2 = MakeFilter(DlColor::kMagenta());
226 auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
227 auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
228 auto layer1 = std::make_shared<ShaderMaskLayer>(dl_filter1, layer_bounds,
229 DlBlendMode::kSrc);
230 auto layer2 = std::make_shared<ShaderMaskLayer>(dl_filter2, layer_bounds,
231 DlBlendMode::kSrc);
232 layer2->Add(mock_layer2);
233 layer1->Add(mock_layer1);
234 layer1->Add(layer2);
235
236 const DlRect children_bounds =
237 child_path1.GetBounds().Union(child_path2.GetBounds());
238 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
239 layer1->Preroll(preroll_context());
240 EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.GetBounds());
241 EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.GetBounds());
242 EXPECT_EQ(layer1->paint_bounds(), children_bounds);
243 EXPECT_EQ(layer1->child_paint_bounds(), children_bounds);
244 EXPECT_EQ(layer2->paint_bounds(), mock_layer2->paint_bounds());
245 EXPECT_EQ(layer2->child_paint_bounds(), mock_layer2->paint_bounds());
246 EXPECT_TRUE(mock_layer1->needs_painting(paint_context()));
247 EXPECT_TRUE(mock_layer2->needs_painting(paint_context()));
248 EXPECT_TRUE(layer1->needs_painting(paint_context()));
249 EXPECT_TRUE(layer2->needs_painting(paint_context()));
250 EXPECT_EQ(mock_layer1->parent_matrix(), initial_transform);
251 EXPECT_EQ(mock_layer2->parent_matrix(), initial_transform);
252
253 DlPaint filter_paint1, filter_paint2;
254 filter_paint1.setBlendMode(DlBlendMode::kSrc);
255 filter_paint2.setBlendMode(DlBlendMode::kSrc);
256 filter_paint1.setColorSource(dl_filter1);
257 filter_paint2.setColorSource(dl_filter2);
258
259 layer1->Paint(display_list_paint_context());
260 DisplayListBuilder expected_builder;
261 /* (ShaderMask)layer1::Paint */ {
262 expected_builder.Save();
263 {
264 expected_builder.SaveLayer(children_bounds);
265 {
266 /* mock_layer1::Paint */ {
267 expected_builder.DrawPath(child_path1, child_paint1);
268 }
269 /* (ShaderMask)layer2::Paint */ {
270 expected_builder.Save();
271 {
272 expected_builder.SaveLayer(child_path2.GetBounds());
273 {
274 /* mock_layer2::Paint */ {
275 expected_builder.DrawPath(child_path2, child_paint2);
276 }
277 expected_builder.Translate(layer_bounds.GetLeft(),
278 layer_bounds.GetTop());
279 expected_builder.DrawRect(
280 DlRect::MakeSize(layer_bounds.GetSize()), filter_paint2);
281 }
282 expected_builder.Restore();
283 }
284 expected_builder.Restore();
285 }
286 expected_builder.Translate(layer_bounds.GetLeft(),
287 layer_bounds.GetTop());
288 expected_builder.DrawRect(DlRect::MakeSize(layer_bounds.GetSize()),
289 filter_paint1);
290 }
291 expected_builder.Restore();
292 }
293 expected_builder.Restore();
294 }
295 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
296}
297
298TEST_F(ShaderMaskLayerTest, Readback) {
299 const DlRect layer_bounds = DlRect::MakeLTRB(2.0f, 4.0f, 20.5f, 20.5f);
300 auto dl_filter = MakeFilter(DlColor::kBlue());
301 auto layer = std::make_shared<ShaderMaskLayer>(dl_filter, layer_bounds,
302 DlBlendMode::kSrc);
303
304 // ShaderMaskLayer does not read from surface
305 preroll_context()->surface_needs_readback = false;
306 layer->Preroll(preroll_context());
307 EXPECT_FALSE(preroll_context()->surface_needs_readback);
308
309 // ShaderMaskLayer blocks child with readback
310 auto mock_layer = std::make_shared<MockLayer>(DlPath(), DlPaint());
311 mock_layer->set_fake_reads_surface(true);
312 layer->Add(mock_layer);
313 preroll_context()->surface_needs_readback = false;
314 layer->Preroll(preroll_context());
315 EXPECT_FALSE(preroll_context()->surface_needs_readback);
316}
317
318TEST_F(ShaderMaskLayerTest, LayerCached) {
319 auto dl_filter = MakeFilter(DlColor::kBlue());
320 DlPaint paint;
321 const DlRect layer_bounds = DlRect::MakeLTRB(2.0f, 4.0f, 20.5f, 20.5f);
322 auto initial_transform = DlMatrix::MakeTranslation({50.0f, 25.5f});
323 const DlPath child_path = DlPath::MakeRect(DlRect::MakeWH(5.0f, 5.0f));
324 auto mock_layer = std::make_shared<MockLayer>(child_path);
325 auto layer = std::make_shared<ShaderMaskLayer>(dl_filter, layer_bounds,
326 DlBlendMode::kSrc);
327 layer->Add(mock_layer);
328
329 DlMatrix cache_ctm = initial_transform;
330 DisplayListBuilder cache_canvas;
331 cache_canvas.Transform(cache_ctm);
332
333 use_mock_raster_cache();
334 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
335 const auto* cacheable_shader_masker_item = layer->raster_cache_item();
336
337 EXPECT_EQ(raster_cache()->GetLayerCachedEntriesCount(), (size_t)0);
338 EXPECT_EQ(cacheable_shader_masker_item->cache_state(),
340 EXPECT_FALSE(cacheable_shader_masker_item->GetId().has_value());
341
342 // frame 1.
343 layer->Preroll(preroll_context());
344 LayerTree::TryToRasterCache(cacheable_items(), &paint_context());
345
346 EXPECT_EQ(raster_cache()->GetLayerCachedEntriesCount(), (size_t)0);
347 EXPECT_EQ(cacheable_shader_masker_item->cache_state(),
349 EXPECT_FALSE(cacheable_shader_masker_item->GetId().has_value());
350
351 // frame 2.
352 layer->Preroll(preroll_context());
353 LayerTree::TryToRasterCache(cacheable_items(), &paint_context());
354 EXPECT_EQ(raster_cache()->GetLayerCachedEntriesCount(), (size_t)0);
355 EXPECT_EQ(cacheable_shader_masker_item->cache_state(),
357 EXPECT_FALSE(cacheable_shader_masker_item->GetId().has_value());
358
359 // frame 3.
360 layer->Preroll(preroll_context());
361 LayerTree::TryToRasterCache(cacheable_items(), &paint_context());
362 EXPECT_EQ(raster_cache()->GetLayerCachedEntriesCount(), (size_t)1);
363 EXPECT_EQ(cacheable_shader_masker_item->cache_state(),
365
366 EXPECT_TRUE(raster_cache()->Draw(
367 cacheable_shader_masker_item->GetId().value(), cache_canvas, &paint));
368}
369
370TEST_F(ShaderMaskLayerTest, OpacityInheritance) {
371 const DlRect child_bounds = DlRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
372 const DlPath child_path = DlPath::MakeRect(child_bounds);
373 auto mock_layer = MockLayer::Make(child_path);
374 const DlRect mask_rect = DlRect::MakeLTRB(10, 10, 20, 20);
375 auto shader_mask_layer =
376 std::make_shared<ShaderMaskLayer>(nullptr, mask_rect, DlBlendMode::kSrc);
377 shader_mask_layer->Add(mock_layer);
378
379 // ShaderMaskLayers can always support opacity despite incompatible children
380 PrerollContext* context = preroll_context();
381 shader_mask_layer->Preroll(context);
382 EXPECT_EQ(context->renderable_state_flags, Layer::kSaveLayerRenderFlags);
383
384 int opacity_alpha = 0x7F;
385 DlPoint offset = DlPoint(10, 10);
386 auto opacity_layer = std::make_shared<OpacityLayer>(opacity_alpha, offset);
387 opacity_layer->Add(shader_mask_layer);
388 opacity_layer->Preroll(context);
389 EXPECT_TRUE(opacity_layer->children_can_accept_opacity());
390
391 DisplayListBuilder expected_builder;
392 /* OpacityLayer::Paint() */ {
393 expected_builder.Save();
394 {
395 expected_builder.Translate(offset.x, offset.y);
396 /* ShaderMaskLayer::Paint() */ {
397 DlPaint sl_paint = DlPaint(DlColor(opacity_alpha << 24));
398 expected_builder.SaveLayer(child_path.GetBounds(), &sl_paint);
399 {
400 /* child layer paint */ {
401 expected_builder.DrawPath(child_path, DlPaint());
402 }
403 expected_builder.Translate(mask_rect.GetLeft(), mask_rect.GetTop());
404 expected_builder.DrawRect(DlRect::MakeSize(mask_rect.GetSize()),
405 DlPaint().setBlendMode(DlBlendMode::kSrc));
406 }
407 expected_builder.Restore();
408 }
409 }
410 expected_builder.Restore();
411 }
412
413 opacity_layer->Paint(display_list_paint_context());
414 EXPECT_TRUE(DisplayListsEQ_Verbose(expected_builder.Build(), display_list()));
415}
416
417TEST_F(ShaderMaskLayerTest, SimpleFilterWithRasterCacheLayerNotCached) {
418 use_mock_raster_cache(); // Ensure non-fractional alignment.
419
420 const DlMatrix initial_transform = DlMatrix::MakeTranslation({0.5f, 1.0f});
421 const DlRect child_bounds = DlRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
422 const DlRect layer_bounds = DlRect::MakeLTRB(2.0f, 4.0f, 6.5f, 6.5f);
423 const DlPath child_path = DlPath::MakeRect(child_bounds);
424 const DlPaint child_paint = DlPaint(DlColor::kYellow());
425 auto dl_filter = MakeFilter(DlColor::kBlue());
426 auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
427 auto layer = std::make_shared<ShaderMaskLayer>(dl_filter, layer_bounds,
428 DlBlendMode::kSrc);
429 layer->Add(mock_layer);
430
431 preroll_context()->state_stack.set_preroll_delegate(initial_transform);
432 layer->Preroll(preroll_context());
433
434 DlPaint filter_paint;
435 filter_paint.setBlendMode(DlBlendMode::kSrc);
436 filter_paint.setColorSource(dl_filter);
437
438 layer->Paint(display_list_paint_context());
439 DisplayListBuilder expected_builder;
440 /* (ShaderMask)layer::Paint */ {
441 expected_builder.Save();
442 {
443 // The layer will notice that the CTM is already an integer matrix
444 // and will not perform an Integral CTM operation.
445 // expected_builder.TransformReset();
446 // expected_builder.Transform(DlMatrix());
447 expected_builder.SaveLayer(child_bounds);
448 {
449 /* mock_layer::Paint */ {
450 expected_builder.DrawPath(child_path, child_paint);
451 }
452 expected_builder.Translate(layer_bounds.GetLeft(),
453 layer_bounds.GetTop());
454 expected_builder.DrawRect(DlRect::MakeSize(layer_bounds.GetSize()),
455 filter_paint);
456 }
457 expected_builder.Restore();
458 }
459 expected_builder.Restore();
460 }
461 EXPECT_TRUE(DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
462}
463
464} // namespace testing
465} // namespace flutter
466
467// NOLINTEND(bugprone-unchecked-optional-access)
void SaveLayer(const std::optional< DlRect > &bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr, std::optional< int64_t > backdrop_id=std::nullopt) override
void Translate(DlScalar tx, DlScalar ty) override
sk_sp< DisplayList > Build()
Definition dl_builder.cc:66
void DrawPath(const DlPath &path, const DlPaint &paint) override
void DrawRect(const DlRect &rect, const DlPaint &paint) override
static std::shared_ptr< DlColorSource > MakeLinear(const DlPoint start_point, const DlPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
DlPaint & setBlendMode(DlBlendMode mode)
Definition dl_paint.h:85
DlPaint & setColorSource(std::nullptr_t source)
Definition dl_paint.h:131
static DlPath MakeRect(const DlRect &rect)
Definition dl_path.cc:39
static constexpr int kSaveLayerRenderFlags
Definition layer.h:118
static void TryToRasterCache(const std::vector< RasterCacheItem * > &raster_cached_entries, const PaintContext *paint_context, bool ignore_raster_cache=false)
Definition layer_tree.cc:67
static std::shared_ptr< MockLayer > Make(const DlPath &path, DlPaint paint=DlPaint())
Definition mock_layer.h:30
TEST_F(DisplayListTest, Defaults)
LayerTestBase<::testing::Test > LayerTest
Definition layer_test.h:177
static std::shared_ptr< DlColorSource > MakeFilter(DlColor color)
bool DisplayListsEQ_Verbose(const DisplayList *a, const DisplayList *b)
impeller::Matrix DlMatrix
impeller::Rect DlRect
impeller::Point DlPoint
flutter::DlPath DlPath
flutter::DlColor DlColor
flutter::DlPaint DlPaint
static constexpr DlColor kMagenta()
Definition dl_color.h:75
static constexpr DlColor kBlue()
Definition dl_color.h:73
static constexpr DlColor kYellow()
Definition dl_color.h:76
static constexpr DlColor kGreen()
Definition dl_color.h:72
static constexpr DlColor kCyan()
Definition dl_color.h:74
DlColor withAlpha(uint8_t alpha) const
Definition dl_color.h:120
A 4x4 matrix using column-major storage.
Definition matrix.h:37
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition matrix.h:95
constexpr Quad Transform(const Quad &quad) const
Definition matrix.h:623
static constexpr TRect MakeWH(Type width, Type height)
Definition rect.h:140
constexpr auto GetTop() const
Definition rect.h:353
constexpr TSize< Type > GetSize() const
Returns the size of the rectangle which may be negative in either width or height and may have been c...
Definition rect.h:327
constexpr TRect Union(const TRect &o) const
Definition rect.h:513
constexpr auto GetLeft() const
Definition rect.h:351
static constexpr TRect MakeSize(const TSize< U > &size)
Definition rect.h:150
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition rect.h:129