| Flutter Impeller |

aiks_dl_vertices_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 "display_list/dl_sampling_options.h"
6 #include "display_list/dl_tile_mode.h"
7 #include "display_list/dl_vertices.h"
8 #include "flutter/impeller/display_list/aiks_unittests.h"
9
10 #include "flutter/display_list/dl_blend_mode.h"
11 #include "flutter/display_list/dl_builder.h"
12 #include "flutter/display_list/dl_color.h"
13 #include "flutter/display_list/dl_paint.h"
14 #include "flutter/testing/testing.h"
15 #include "impeller/display_list/dl_dispatcher.h"
16 #include "impeller/display_list/dl_image_impeller.h"
17
18 namespace impeller {
19 namespace testing {
20
21 using namespace flutter;
22
23 namespace {
24 std::shared_ptr<DlVertices> MakeVertices(
25 DlVertexMode mode,
26 std::vector<SkPoint> vertices,
27 std::vector<uint16_t> indices,
28 std::vector<SkPoint> texture_coordinates,
29 std::vector<DlColor> colors) {
30 DlVertices::Builder::Flags flags(
31 {{texture_coordinates.size() > 0, colors.size() > 0}});
32 DlVertices::Builder builder(mode, vertices.size(), flags, indices.size());
33 if (colors.size() > 0) {
34 builder.store_colors(colors.data());
35 }
36 if (texture_coordinates.size() > 0) {
37 builder.store_texture_coordinates(texture_coordinates.data());
38 }
39 if (indices.size() > 0) {
40 builder.store_indices(indices.data());
41 }
42 builder.store_vertices(vertices.data());
43 return builder.build();
44 }
45 }; // namespace
46
47 // Regression test for https://github.com/flutter/flutter/issues/135441 .
48 TEST_P(AiksTest, VerticesGeometryUVPositionData) {
49 DisplayListBuilder builder;
50 DlPaint paint;
51 auto image =
52 DlImageImpeller::Make(CreateTextureForFixture("table_mountain_nx.png"));
53 auto size = image->impeller_texture()->GetSize();
54
55 paint.setColorSource(std::make_shared<DlImageColorSource>(
56 image, DlTileMode::kClamp, DlTileMode::kClamp));
57
58 std::vector<SkPoint> vertex_coordinates = {SkPoint::Make(0, 0),
59 SkPoint::Make(size.width, 0),
60 SkPoint::Make(0, size.height)};
61 auto vertices = MakeVertices(DlVertexMode::kTriangleStrip, vertex_coordinates,
62 {0, 1, 2}, {}, {});
63
64 builder.DrawVertices(vertices, DlBlendMode::kSrcOver, paint);
65 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
66 }
67
68 // Regression test for https://github.com/flutter/flutter/issues/135441 .
69 TEST_P(AiksTest, VerticesGeometryUVPositionDataWithTranslate) {
70 DisplayListBuilder builder;
71 DlPaint paint;
72 auto image =
73 DlImageImpeller::Make(CreateTextureForFixture("table_mountain_nx.png"));
74 auto size = image->impeller_texture()->GetSize();
75
76 SkMatrix matrix;
77 matrix.setTranslateX(100);
78 matrix.setTranslateY(100);
79 paint.setColorSource(std::make_shared<DlImageColorSource>(
80 image, DlTileMode::kClamp, DlTileMode::kClamp, DlImageSampling::kLinear,
81 &matrix));
82
83 std::vector<SkPoint> positions = {SkPoint::Make(0, 0),
84 SkPoint::Make(size.width, 0),
85 SkPoint::Make(0, size.height)};
86 auto vertices =
87 MakeVertices(DlVertexMode::kTriangleStrip, positions, {0, 1, 2}, {}, {});
88
89 builder.DrawVertices(vertices, DlBlendMode::kSrcOver, paint);
90 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
91 }
92
93 // Regression test for https://github.com/flutter/flutter/issues/145707
94 TEST_P(AiksTest, VerticesGeometryColorUVPositionData) {
95 DisplayListBuilder builder;
96 DlPaint paint;
97 auto image =
98 DlImageImpeller::Make(CreateTextureForFixture("table_mountain_nx.png"));
99 auto size = image->impeller_texture()->GetSize();
100
101 paint.setColorSource(std::make_shared<DlImageColorSource>(
102 image, DlTileMode::kClamp, DlTileMode::kClamp));
103
104 std::vector<SkPoint> positions = {
105 SkPoint::Make(0, 0), SkPoint::Make(size.width, 0),
106 SkPoint::Make(0, size.height), SkPoint::Make(size.width, 0),
107 SkPoint::Make(0, 0), SkPoint::Make(size.width, size.height),
108 };
109 std::vector<DlColor> colors = {
110 DlColor::kRed().withAlpha(128), DlColor::kBlue().withAlpha(128),
111 DlColor::kGreen().withAlpha(128), DlColor::kRed().withAlpha(128),
112 DlColor::kBlue().withAlpha(128), DlColor::kGreen().withAlpha(128),
113 };
114
115 auto vertices =
116 MakeVertices(DlVertexMode::kTriangles, positions, {}, {}, colors);
117
118 builder.DrawVertices(vertices, DlBlendMode::kDstOver, paint);
119 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
120 }
121
122 TEST_P(AiksTest, VerticesGeometryColorUVPositionDataAdvancedBlend) {
123 DisplayListBuilder builder;
124 DlPaint paint;
125 auto image =
126 DlImageImpeller::Make(CreateTextureForFixture("table_mountain_nx.png"));
127 auto size = image->impeller_texture()->GetSize();
128
129 paint.setColorSource(std::make_shared<DlImageColorSource>(
130 image, DlTileMode::kClamp, DlTileMode::kClamp));
131
132 std::vector<SkPoint> positions = {
133 SkPoint::Make(0, 0), SkPoint::Make(size.width, 0),
134 SkPoint::Make(0, size.height), SkPoint::Make(size.width, 0),
135 SkPoint::Make(0, 0), SkPoint::Make(size.width, size.height),
136 };
137 std::vector<DlColor> colors = {
138 DlColor::kRed().modulateOpacity(0.5),
139 DlColor::kBlue().modulateOpacity(0.5),
140 DlColor::kGreen().modulateOpacity(0.5),
141 DlColor::kRed().modulateOpacity(0.5),
142 DlColor::kBlue().modulateOpacity(0.5),
143 DlColor::kGreen().modulateOpacity(0.5),
144 };
145
146 auto vertices =
147 MakeVertices(DlVertexMode::kTriangles, positions, {}, {}, colors);
148
149 builder.DrawVertices(vertices, DlBlendMode::kColorBurn, paint);
150 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
151 }
152
153 // Draw a hexagon using triangle fan
154 TEST_P(AiksTest, CanConvertTriangleFanToTriangles) {
155 constexpr Scalar hexagon_radius = 125;
156 auto hex_start = Point(200.0, -hexagon_radius + 200.0);
157 auto center_to_flat = 1.73 / 2 * hexagon_radius;
158
159 // clang-format off
160 std::vector<SkPoint> vertices = {
161 SkPoint::Make(hex_start.x, hex_start.y),
162 SkPoint::Make(hex_start.x + center_to_flat, hex_start.y + 0.5 * hexagon_radius),
163 SkPoint::Make(hex_start.x + center_to_flat, hex_start.y + 1.5 * hexagon_radius),
164 SkPoint::Make(hex_start.x + center_to_flat, hex_start.y + 1.5 * hexagon_radius),
165 SkPoint::Make(hex_start.x, hex_start.y + 2 * hexagon_radius),
166 SkPoint::Make(hex_start.x, hex_start.y + 2 * hexagon_radius),
167 SkPoint::Make(hex_start.x - center_to_flat, hex_start.y + 1.5 * hexagon_radius),
168 SkPoint::Make(hex_start.x - center_to_flat, hex_start.y + 1.5 * hexagon_radius),
169 SkPoint::Make(hex_start.x - center_to_flat, hex_start.y + 0.5 * hexagon_radius)
170 };
171 // clang-format on
172 auto paint = flutter::DlPaint(flutter::DlColor::kDarkGrey());
173 auto dl_vertices = flutter::DlVertices::Make(
174 flutter::DlVertexMode::kTriangleFan, vertices.size(), vertices.data(),
175 nullptr, nullptr);
176 flutter::DisplayListBuilder builder;
177 builder.DrawVertices(dl_vertices, flutter::DlBlendMode::kSrcOver, paint);
178 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
179 }
180
181 TEST_P(AiksTest, DrawVerticesSolidColorTrianglesWithoutIndices) {
182 // Use negative coordinates and then scale the transform by -1, -1 to make
183 // sure coverage is taking the transform into account.
184 std::vector<SkPoint> positions = {SkPoint::Make(-100, -300),
185 SkPoint::Make(-200, -100),
186 SkPoint::Make(-300, -300)};
187 std::vector<flutter::DlColor> colors = {flutter::DlColor::kWhite(),
188 flutter::DlColor::kGreen(),
189 flutter::DlColor::kWhite()};
190
191 auto vertices = flutter::DlVertices::Make(
192 flutter::DlVertexMode::kTriangles, 3, positions.data(),
193 /*texture_coordinates=*/nullptr, colors.data());
194
195 flutter::DisplayListBuilder builder;
196 flutter::DlPaint paint;
197
198 paint.setColor(flutter::DlColor::kRed().modulateOpacity(0.5));
199 builder.Scale(-1, -1);
200 builder.DrawVertices(vertices, flutter::DlBlendMode::kSrcOver, paint);
201
202 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
203 }
204
205 TEST_P(AiksTest, DrawVerticesLinearGradientWithoutIndices) {
206 std::vector<SkPoint> positions = {SkPoint::Make(100, 300),
207 SkPoint::Make(200, 100),
208 SkPoint::Make(300, 300)};
209
210 auto vertices = flutter::DlVertices::Make(
211 flutter::DlVertexMode::kTriangles, 3, positions.data(),
212 /*texture_coordinates=*/nullptr, /*colors=*/nullptr);
213
214 std::vector<flutter::DlColor> colors = {flutter::DlColor::kBlue(),
215 flutter::DlColor::kRed()};
216 const float stops[2] = {0.0, 1.0};
217
218 auto linear = flutter::DlColorSource::MakeLinear(
219 {100.0, 100.0}, {300.0, 300.0}, 2, colors.data(), stops,
220 flutter::DlTileMode::kRepeat);
221
222 flutter::DisplayListBuilder builder;
223 flutter::DlPaint paint;
224
225 paint.setColorSource(linear);
226 builder.DrawVertices(vertices, flutter::DlBlendMode::kSrcOver, paint);
227
228 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
229 }
230
231 TEST_P(AiksTest, DrawVerticesLinearGradientWithTextureCoordinates) {
232 std::vector<SkPoint> positions = {SkPoint::Make(100, 300),
233 SkPoint::Make(200, 100),
234 SkPoint::Make(300, 300)};
235 std::vector<SkPoint> texture_coordinates = {SkPoint::Make(300, 100),
236 SkPoint::Make(100, 200),
237 SkPoint::Make(300, 300)};
238
239 auto vertices = flutter::DlVertices::Make(
240 flutter::DlVertexMode::kTriangles, 3, positions.data(),
241 texture_coordinates.data(), /*colors=*/nullptr);
242
243 std::vector<flutter::DlColor> colors = {flutter::DlColor::kBlue(),
244 flutter::DlColor::kRed()};
245 const float stops[2] = {0.0, 1.0};
246
247 auto linear = flutter::DlColorSource::MakeLinear(
248 {100.0, 100.0}, {300.0, 300.0}, 2, colors.data(), stops,
249 flutter::DlTileMode::kRepeat);
250
251 flutter::DisplayListBuilder builder;
252 flutter::DlPaint paint;
253
254 paint.setColorSource(linear);
255 builder.DrawVertices(vertices, flutter::DlBlendMode::kSrcOver, paint);
256
257 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
258 }
259
260 TEST_P(AiksTest, DrawVerticesImageSourceWithTextureCoordinates) {
261 auto texture = CreateTextureForFixture("embarcadero.jpg");
262 auto dl_image = DlImageImpeller::Make(texture);
263 std::vector<SkPoint> positions = {SkPoint::Make(100, 300),
264 SkPoint::Make(200, 100),
265 SkPoint::Make(300, 300)};
266 std::vector<SkPoint> texture_coordinates = {
267 SkPoint::Make(0, 0), SkPoint::Make(100, 200), SkPoint::Make(200, 100)};
268
269 auto vertices = flutter::DlVertices::Make(
270 flutter::DlVertexMode::kTriangles, 3, positions.data(),
271 texture_coordinates.data(), /*colors=*/nullptr);
272
273 flutter::DisplayListBuilder builder;
274 flutter::DlPaint paint;
275
276 auto image_source = flutter::DlImageColorSource(
277 dl_image, flutter::DlTileMode::kRepeat, flutter::DlTileMode::kRepeat);
278
279 paint.setColorSource(&image_source);
280 builder.DrawVertices(vertices, flutter::DlBlendMode::kSrcOver, paint);
281
282 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
283 }
284
285 TEST_P(AiksTest,
286 DrawVerticesImageSourceWithTextureCoordinatesAndColorBlending) {
287 auto texture = CreateTextureForFixture("embarcadero.jpg");
288 auto dl_image = DlImageImpeller::Make(texture);
289 std::vector<SkPoint> positions = {SkPoint::Make(100, 300),
290 SkPoint::Make(200, 100),
291 SkPoint::Make(300, 300)};
292 std::vector<flutter::DlColor> colors = {flutter::DlColor::kWhite(),
293 flutter::DlColor::kGreen(),
294 flutter::DlColor::kWhite()};
295 std::vector<SkPoint> texture_coordinates = {
296 SkPoint::Make(0, 0), SkPoint::Make(100, 200), SkPoint::Make(200, 100)};
297
298 auto vertices = flutter::DlVertices::Make(
299 flutter::DlVertexMode::kTriangles, 3, positions.data(),
300 texture_coordinates.data(), colors.data());
301
302 flutter::DisplayListBuilder builder;
303 flutter::DlPaint paint;
304
305 auto image_source = flutter::DlImageColorSource(
306 dl_image, flutter::DlTileMode::kRepeat, flutter::DlTileMode::kRepeat);
307
308 paint.setColorSource(&image_source);
309 builder.DrawVertices(vertices, flutter::DlBlendMode::kModulate, paint);
310
311 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
312 }
313
314 TEST_P(AiksTest, DrawVerticesSolidColorTrianglesWithIndices) {
315 std::vector<SkPoint> positions = {
316 SkPoint::Make(100, 300), SkPoint::Make(200, 100), SkPoint::Make(300, 300),
317 SkPoint::Make(200, 500)};
318 std::vector<uint16_t> indices = {0, 1, 2, 0, 2, 3};
319
320 auto vertices = flutter::DlVertices::Make(
321 flutter::DlVertexMode::kTriangles, positions.size(), positions.data(),
322 /*texture_coordinates=*/nullptr, /*colors=*/nullptr, indices.size(),
323 indices.data());
324
325 flutter::DisplayListBuilder builder;
326 flutter::DlPaint paint;
327
328 paint.setColor(flutter::DlColor::kRed());
329 builder.DrawVertices(vertices, flutter::DlBlendMode::kSrcOver, paint);
330
331 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
332 }
333
334 TEST_P(AiksTest, DrawVerticesPremultipliesColors) {
335 std::vector<SkPoint> positions = {
336 SkPoint::Make(100, 300), SkPoint::Make(200, 100), SkPoint::Make(300, 300),
337 SkPoint::Make(200, 500)};
338 auto color = flutter::DlColor::kBlue().withAlpha(0x99);
339 std::vector<uint16_t> indices = {0, 1, 2, 0, 2, 3};
340 std::vector<flutter::DlColor> colors = {color, color, color, color};
341
342 auto vertices = flutter::DlVertices::Make(
343 flutter::DlVertexMode::kTriangles, positions.size(), positions.data(),
344 /*texture_coordinates=*/nullptr, colors.data(), indices.size(),
345 indices.data());
346
347 flutter::DisplayListBuilder builder;
348 flutter::DlPaint paint;
349 paint.setBlendMode(flutter::DlBlendMode::kSrcOver);
350 paint.setColor(flutter::DlColor::kRed());
351
352 builder.DrawRect(SkRect::MakeLTRB(0, 0, 400, 400), paint);
353 builder.DrawVertices(vertices, flutter::DlBlendMode::kDst, paint);
354
355 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
356 }
357
358 TEST_P(AiksTest, DrawVerticesWithInvalidIndices) {
359 std::vector<SkPoint> positions = {
360 SkPoint::Make(100, 300), SkPoint::Make(200, 100), SkPoint::Make(300, 300),
361 SkPoint::Make(200, 500)};
362 std::vector<uint16_t> indices = {0, 1, 2, 0, 2, 3, 99, 100, 101};
363
364 auto vertices = flutter::DlVertices::Make(
365 flutter::DlVertexMode::kTriangles, positions.size(), positions.data(),
366 /*texture_coordinates=*/nullptr, /*colors=*/nullptr, indices.size(),
367 indices.data());
368
369 EXPECT_EQ(vertices->bounds(), SkRect::MakeLTRB(100, 100, 300, 500));
370
371 flutter::DisplayListBuilder builder;
372 flutter::DlPaint paint;
373 paint.setBlendMode(flutter::DlBlendMode::kSrcOver);
374 paint.setColor(flutter::DlColor::kRed());
375
376 builder.DrawRect(SkRect::MakeLTRB(0, 0, 400, 400), paint);
377 builder.DrawVertices(vertices, flutter::DlBlendMode::kSrc, paint);
378
379 AiksContext renderer(GetContext(), nullptr);
380 std::shared_ptr<Texture> image =
381 DisplayListToTexture(builder.Build(), {1024, 768}, renderer);
382 EXPECT_TRUE(image);
383 }
384
385 // All four vertices should form a solid red rectangle with no gaps.
386 // The blue rectangle drawn under them should not be visible.
387 TEST_P(AiksTest, DrawVerticesTextureCoordinatesWithFragmentShader) {
388 std::vector<SkPoint> positions_lt = {
389 SkPoint::Make(0, 0), //
390 SkPoint::Make(50, 0), //
391 SkPoint::Make(0, 50), //
392 SkPoint::Make(50, 50), //
393 };
394
395 auto vertices_lt = flutter::DlVertices::Make(
396 flutter::DlVertexMode::kTriangleStrip, positions_lt.size(),
397 positions_lt.data(),
398 /*texture_coordinates=*/positions_lt.data(), /*colors=*/nullptr,
399 /*index_count=*/0,
400 /*indices=*/nullptr);
401
402 std::vector<SkPoint> positions_rt = {
403 SkPoint::Make(50, 0), //
404 SkPoint::Make(100, 0), //
405 SkPoint::Make(50, 50), //
406 SkPoint::Make(100, 50), //
407 };
408
409 auto vertices_rt = flutter::DlVertices::Make(
410 flutter::DlVertexMode::kTriangleStrip, positions_rt.size(),
411 positions_rt.data(),
412 /*texture_coordinates=*/positions_rt.data(), /*colors=*/nullptr,
413 /*index_count=*/0,
414 /*indices=*/nullptr);
415
416 std::vector<SkPoint> positions_lb = {
417 SkPoint::Make(0, 50), //
418 SkPoint::Make(50, 50), //
419 SkPoint::Make(0, 100), //
420 SkPoint::Make(50, 100), //
421 };
422
423 auto vertices_lb = flutter::DlVertices::Make(
424 flutter::DlVertexMode::kTriangleStrip, positions_lb.size(),
425 positions_lb.data(),
426 /*texture_coordinates=*/positions_lb.data(), /*colors=*/nullptr,
427 /*index_count=*/0,
428 /*indices=*/nullptr);
429
430 std::vector<SkPoint> positions_rb = {
431 SkPoint::Make(50, 50), //
432 SkPoint::Make(100, 50), //
433 SkPoint::Make(50, 100), //
434 SkPoint::Make(100, 100), //
435 };
436
437 auto vertices_rb = flutter::DlVertices::Make(
438 flutter::DlVertexMode::kTriangleStrip, positions_rb.size(),
439 positions_rb.data(),
440 /*texture_coordinates=*/positions_rb.data(), /*colors=*/nullptr,
441 /*index_count=*/0,
442 /*indices=*/nullptr);
443
444 flutter::DisplayListBuilder builder;
445 flutter::DlPaint paint;
446 flutter::DlPaint rect_paint;
447 rect_paint.setColor(DlColor::kBlue());
448
449 auto runtime_stages =
450 OpenAssetAsRuntimeStage("runtime_stage_simple.frag.iplr");
451
452 auto runtime_stage =
453 runtime_stages[PlaygroundBackendToRuntimeStageBackend(GetBackend())];
454 ASSERT_TRUE(runtime_stage);
455
456 auto runtime_effect = DlRuntimeEffect::MakeImpeller(runtime_stage);
457 auto uniform_data = std::make_shared<std::vector<uint8_t>>();
458 auto color_source = flutter::DlColorSource::MakeRuntimeEffect(
459 runtime_effect, {}, uniform_data);
460
461 paint.setColorSource(color_source);
462
463 builder.Scale(GetContentScale().x, GetContentScale().y);
464 builder.Save();
465 builder.DrawRect(SkRect::MakeLTRB(0, 0, 100, 100), rect_paint);
466 builder.DrawVertices(vertices_lt, flutter::DlBlendMode::kSrcOver, paint);
467 builder.DrawVertices(vertices_rt, flutter::DlBlendMode::kSrcOver, paint);
468 builder.DrawVertices(vertices_lb, flutter::DlBlendMode::kSrcOver, paint);
469 builder.DrawVertices(vertices_rb, flutter::DlBlendMode::kSrcOver, paint);
470 builder.Restore();
471
472 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
473 }
474
475 // The vertices should form a solid red rectangle with no gaps.
476 // The blue rectangle drawn under them should not be visible.
477 TEST_P(AiksTest,
478 DrawVerticesTextureCoordinatesWithFragmentShaderNonZeroOrigin) {
479 std::vector<SkPoint> positions_lt = {
480 SkPoint::Make(200, 200), //
481 SkPoint::Make(250, 200), //
482 SkPoint::Make(200, 250), //
483 SkPoint::Make(250, 250), //
484 };
485
486 auto vertices = flutter::DlVertices::Make(
487 flutter::DlVertexMode::kTriangleStrip, positions_lt.size(),
488 positions_lt.data(),
489 /*texture_coordinates=*/positions_lt.data(), /*colors=*/nullptr,
490 /*index_count=*/0,
491 /*indices=*/nullptr);
492
493 flutter::DisplayListBuilder builder;
494 flutter::DlPaint paint;
495 flutter::DlPaint rect_paint;
496 rect_paint.setColor(DlColor::kBlue());
497
498 auto runtime_stages =
499 OpenAssetAsRuntimeStage("runtime_stage_position.frag.iplr");
500
501 auto runtime_stage =
502 runtime_stages[PlaygroundBackendToRuntimeStageBackend(GetBackend())];
503 ASSERT_TRUE(runtime_stage);
504
505 auto runtime_effect = DlRuntimeEffect::MakeImpeller(runtime_stage);
506 auto rect_data = std::vector<Rect>{Rect::MakeLTRB(200, 200, 250, 250)};
507
508 auto uniform_data = std::make_shared<std::vector<uint8_t>>();
509 uniform_data->resize(rect_data.size() * sizeof(Rect));
510 memcpy(uniform_data->data(), rect_data.data(), uniform_data->size());
511
512 auto color_source = flutter::DlColorSource::MakeRuntimeEffect(
513 runtime_effect, {}, uniform_data);
514
515 paint.setColorSource(color_source);
516
517 builder.Scale(GetContentScale().x, GetContentScale().y);
518 builder.DrawRect(SkRect::MakeLTRB(200, 200, 250, 250), rect_paint);
519 builder.DrawVertices(vertices, flutter::DlBlendMode::kSrcOver, paint);
520
521 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
522 }
523
524 } // namespace testing
525 } // namespace impeller
impeller::AiksPlayground
Definition: aiks_playground.h:16
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::AiksContext
Definition: aiks_context.h:19
aiks_unittests.h
dl_dispatcher.h
impeller::PlaygroundBackendToRuntimeStageBackend
constexpr RuntimeStageBackend PlaygroundBackendToRuntimeStageBackend(PlaygroundBackend backend)
Definition: playground.h:32
impeller::DlImageImpeller::Make
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
Definition: dl_image_impeller.cc:23
impeller::Point
TPoint< Scalar > Point
Definition: point.h:327
flutter
Definition: dl_golden_blur_unittests.cc:15
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:776
impeller::testing::TEST_P
TEST_P(AiksTest, DrawAtlasNoColor)
Definition: aiks_dl_atlas_unittests.cc:78
color
DlColor color
Definition: dl_golden_blur_unittests.cc:24
impeller::DisplayListToTexture
std::shared_ptr< Texture > DisplayListToTexture(const sk_sp< flutter::DisplayList > &display_list, ISize size, AiksContext &context, bool reset_host_buffer, bool generate_mips)
Render the provided display list to a texture with the given size.
Definition: dl_dispatcher.cc:1195
impeller::TRect< Scalar >::MakeLTRB
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition: rect.h:129
impeller
Definition: allocation.cc:12
dl_image_impeller.h