35 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
42sk_sp<DisplayList> MakeWideStrokedRects(
Point scale,
43 const DrawRectProc& draw_rect) {
45 builder.
Scale(scale.
x, scale.
y);
85 return builder.
Build();
90 ASSERT_TRUE(OpenPlaygroundHere(MakeWideStrokedRects(
99 ASSERT_TRUE(OpenPlaygroundHere(MakeWideStrokedRects(
113 DlImageSampling::kNearestNeighbor, &paint);
114 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
127 DlImageSampling::kNearestNeighbor, &paint);
128 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
140 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
152 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
156bool GenerateMipmap(
const std::shared_ptr<Context>& context,
157 std::shared_ptr<Texture>
texture,
158 std::string_view label) {
159 auto buffer = context->CreateCommandBuffer();
163 auto pass = buffer->CreateBlitPass();
167 pass->GenerateMipmap(std::move(
texture), label);
169 pass->EncodeCommands();
170 return context->GetCommandQueue()->Submit({
buffer}).ok();
173void CanRenderTiledTexture(
AiksTest* aiks_test,
175 Matrix local_matrix = {}) {
176 auto context = aiks_test->GetContext();
177 ASSERT_TRUE(context);
178 auto texture = aiks_test->CreateTextureForFixture(
"table_mountain_nx.png",
180 GenerateMipmap(context,
texture,
"table_mountain_nx");
183 image, tile_mode, tile_mode, DlImageSampling::kNearestNeighbor,
191 builder.
Scale(aiks_test->GetContentScale().x, aiks_test->GetContentScale().y);
196 constexpr auto stroke_width = 64;
199 if (tile_mode == DlTileMode::kDecal) {
215 EXPECT_FALSE(
path.IsRect(
nullptr));
216 EXPECT_FALSE(
path.IsOval(
nullptr));
217 EXPECT_FALSE(
path.IsRoundRect(
nullptr));
220 EXPECT_FALSE(
path.IsConvex());
230 constexpr float kConicWeight = 0.707106781f;
233 .ConicCurveTo({300, 300}, {300, 450}, kConicWeight)
234 .ConicCurveTo({300, 600}, {150, 600}, kConicWeight)
235 .ConicCurveTo({0, 600}, {0, 450}, kConicWeight)
236 .ConicCurveTo({0, 300}, {150, 300}, kConicWeight)
241 EXPECT_FALSE(
path.IsRect(
nullptr));
242 EXPECT_FALSE(
path.IsOval(
nullptr));
243 EXPECT_FALSE(
path.IsRoundRect(
nullptr));
246 EXPECT_TRUE(
path.IsConvex());
252 ASSERT_TRUE(aiks_test->OpenPlaygroundHere(builder.
Build()));
257 CanRenderTiledTexture(
this, DlTileMode::kClamp);
261 CanRenderTiledTexture(
this, DlTileMode::kRepeat);
265 CanRenderTiledTexture(
this, DlTileMode::kMirror);
269 CanRenderTiledTexture(
this, DlTileMode::kDecal);
273 CanRenderTiledTexture(
this, DlTileMode::kClamp,
287 source_rect.Shift(image_half_size.
width, image_half_size.
height);
291 DlImageSampling::kNearestNeighbor);
292 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
301 image->GetSize().width * 0.25f,
image->GetSize().height * 0.4f,
302 image->GetSize().width,
image->GetSize().height);
311 DlImageSampling::kNearestNeighbor);
312 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
317 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
368 DlColor::RGBA(0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0),
369 DlColor::RGBA(0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0),
370 DlColor::RGBA(0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0),
371 DlColor::RGBA(0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0),
372 DlColor::RGBA(0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0),
383 auto texture = CreateTextureForFixture(
"airplane.jpg",
388 DlPoint(500, 600), 75, 7, gradient_colors, stops, DlTileMode::kMirror));
393 DlImageSampling::kNearestNeighbor));
396 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
414 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
448 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
458 .top_right =
DlSize(25, 50),
459 .bottom_left =
DlSize(25, 50),
460 .bottom_right =
DlSize(50, 25),
467 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
471 auto medium_turquoise =
472 DlColor::RGBA(72.0f / 255.0f, 209.0f / 255.0f, 204.0f / 255.0f, 1.0f);
475 builder.
Scale(0.2, 0.2);
477 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
481 auto medium_turquoise =
482 DlColor::RGBA(72.0f / 255.0f, 209.0f / 255.0f, 204.0f / 255.0f, 1.0f);
484 DlColor::RGBA(255.0f / 255.0f, 69.0f / 255.0f, 0.0f / 255.0f, 1.0f);
487 builder.
Scale(0.2, 0.2);
490 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
495 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
543 builder.
DrawRect(thin_tall_rect.
Shift({100, 100}), thin_paint);
545 builder.
DrawRect(thin_wide_rect.
Shift({100, 100}), thin_paint);
554 builder.
DrawRect(thin_tall_rect.
Shift({100, 300}), thin_paint);
556 builder.
DrawRect(thin_wide_rect.
Shift({100, 300}), thin_paint);
566 builder.
DrawRect(thin_tall_rect.
Shift({100, 500}), thin_paint);
568 builder.
DrawRect(thin_wide_rect.
Shift({100, 500}), thin_paint);
578 builder.
DrawRect(thin_tall_rect.
Shift({300, 500}), thin_paint);
580 builder.
DrawRect(thin_wide_rect.
Shift({300, 500}), thin_paint);
617 for (
int i = 0;
i < 15;
i++) {
625 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
630 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
632 const int color_count = 3;
633 DlColor colors[color_count] = {
636 DlColor::RGBA(220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f),
645 paint.
setColor(colors[(c_index++) % color_count]);
657 DlColor::RGBA(0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0),
658 DlColor::RGBA(0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0),
659 DlColor::RGBA(0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0),
660 DlColor::RGBA(0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0),
661 DlColor::RGBA(0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0),
672 auto texture = CreateTextureForFixture(
"airplane.jpg",
677 DlPoint(500, 600), 75, 7, gradient_colors, stops, DlTileMode::kMirror));
682 image, DlTileMode::kRepeat, DlTileMode::kRepeat,
683 DlImageSampling::kNearestNeighbor, &local_matrix));
686 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
691 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
693 const int color_count = 3;
694 DlColor colors[color_count] = {
697 DlColor::RGBA(220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f),
705 auto draw = [&paint, &colors, &c_index](
DlCanvas& canvas,
DlPoint center,
707 for (
int i = 0;
i < n;
i++) {
708 paint.
setColor(colors[(c_index++) % color_count]);
709 canvas.DrawCircle(center, r, paint);
716 draw(builder,
DlPoint(10, 10), 2, 2, 14);
718 draw(builder,
DlPoint(10, 10), 35, 10, 56);
723 DlColor::RGBA(0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0),
724 DlColor::RGBA(0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0),
725 DlColor::RGBA(0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0),
726 DlColor::RGBA(0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0),
727 DlColor::RGBA(0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0),
738 auto texture = CreateTextureForFixture(
"airplane.jpg",
743 DlPoint(500, 600), 75, 7, gradient_colors, stops, DlTileMode::kMirror));
744 draw(builder,
DlPoint(500, 600), 5, 10, 10);
748 image, DlTileMode::kRepeat, DlTileMode::kRepeat,
749 DlImageSampling::kNearestNeighbor, &local_matrix));
750 draw(builder,
DlPoint(800, 300), 5, 10, 10);
752 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
757 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
759 const int color_count = 3;
760 DlColor colors[color_count] = {
763 DlColor::RGBA(220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f),
770 int long_radius = 600;
771 int short_radius = 600;
772 while (long_radius > 0 && short_radius > 0) {
773 paint.
setColor(colors[(c_index++) % color_count]);
775 long_radius * 2, short_radius * 2),
778 short_radius * 2, long_radius * 2),
780 if (short_radius > 30) {
792 DlColor::RGBA(0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0),
793 DlColor::RGBA(0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0),
794 DlColor::RGBA(0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0),
795 DlColor::RGBA(0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0),
796 DlColor::RGBA(0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0),
807 auto texture = CreateTextureForFixture(
"airplane.jpg",
814 DlPoint(300, 650), 75, 7, gradient_colors, stops, DlTileMode::kMirror));
820 image, DlTileMode::kRepeat, DlTileMode::kRepeat,
821 DlImageSampling::kNearestNeighbor, &local_matrix));
825 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
829struct ArcFarmOptions {
838 const ArcFarmOptions& opts) {
842 const int sweep_limit = opts.sweeps_over_360 ? 420 : 360;
845 for (
int sweep = 30; sweep <= sweep_limit; sweep += 30) {
846 builder.
DrawArc(arc_bounds,
start, opts.full_circles ? 360 : sweep,
847 opts.use_center, paint);
861 for (
int stroke_width = 10; stroke_width <= 40; stroke_width += 3) {
865 for (
int sweep = 160; sweep <= 360; sweep += 20) {
866 builder.
DrawArc(arc_bounds, 0, sweep,
false, modified_paint);
878 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
884 RenderArcFarm(builder, paint,
887 .full_circles =
false,
890 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
895 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
901 RenderArcFarm(builder, paint,
904 .full_circles =
false,
907 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
912 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
918 RenderArcFarm(builder, paint,
921 .full_circles =
false,
924 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
929 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
935 RenderArcFarm(builder, paint,
938 .full_circles =
false,
939 .vertical_scale = 0.8f,
942 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
947 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
953 RenderArcFarm(builder, paint,
956 .full_circles =
false,
957 .vertical_scale = 0.8f,
960 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
965 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
974 RenderArcFarm(builder, paint,
977 .full_circles =
false,
980 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
985 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
994 RenderArcFarm(builder, paint,
997 .full_circles =
false,
1000 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1005 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1013 RenderArcFarmForOverlappingCapsTest(builder, paint);
1015 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1020 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1029 RenderArcFarm(builder, paint,
1031 .use_center =
false,
1032 .full_circles =
false,
1035 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1040 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1048 RenderArcFarmForOverlappingCapsTest(builder, paint);
1050 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1055 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1064 RenderArcFarm(builder, paint,
1067 .full_circles =
false,
1068 .sweeps_over_360 =
true,
1071 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1076 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1088 RenderArcFarm(builder, paint,
1091 .full_circles =
false,
1092 .sweeps_over_360 =
true,
1095 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1100 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1109 RenderArcFarm(builder, paint,
1112 .full_circles =
false,
1113 .sweeps_over_360 =
true,
1116 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1121 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1130 RenderArcFarm(builder, paint,
1132 .use_center =
false,
1133 .full_circles =
false,
1139 RenderArcFarm(builder, paint,
1141 .use_center =
false,
1142 .full_circles =
false,
1145 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1150 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1159 RenderArcFarm(builder, paint,
1161 .use_center =
false,
1162 .full_circles =
false,
1168 RenderArcFarm(builder, paint,
1170 .use_center =
false,
1171 .full_circles =
false,
1177 RenderArcFarm(builder, paint,
1179 .use_center =
false,
1180 .full_circles =
false,
1183 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1199 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1209 RenderArcFarm(builder, paint,
1211 .use_center =
false,
1212 .full_circles =
true,
1218 RenderArcFarm(builder, paint,
1220 .use_center =
false,
1221 .full_circles =
false,
1224 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1229 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1231 const int color_count = 3;
1232 DlColor colors[color_count] = {
1235 DlColor::RGBA(220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f),
1242 for (
int i = 0;
i < 4;
i++) {
1243 for (
int j = 0; j < 4; j++) {
1244 paint.
setColor(colors[(c_index++) % color_count]);
1248 i * 5 + 10, j * 5 + 10),
1252 paint.
setColor(colors[(c_index++) % color_count]);
1256 paint.
setColor(colors[(c_index++) % color_count]);
1261 DlColor gradient_colors[7] = {
1264 DlColor::RGBA(0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0),
1265 DlColor::RGBA(0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0),
1266 DlColor::RGBA(0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0),
1267 DlColor::RGBA(0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0),
1268 DlColor::RGBA(0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0),
1279 auto texture = CreateTextureForFixture(
"airplane.jpg",
1285 DlPoint(550, 550), 75, 7, gradient_colors, stops, DlTileMode::kMirror));
1286 for (
int i = 1;
i <= 10;
i++) {
1290 550 +
i * 20, 550 + j * 20),
1297 DlPoint(200, 650), 75, 7, gradient_colors, stops, DlTileMode::kMirror));
1309 image, DlTileMode::kRepeat, DlTileMode::kRepeat,
1310 DlImageSampling::kNearestNeighbor, &local_matrix));
1311 for (
int i = 1;
i <= 10;
i++) {
1315 720 +
i * 20, 220 + j * 20),
1323 image, DlTileMode::kRepeat, DlTileMode::kRepeat,
1324 DlImageSampling::kNearestNeighbor, &local_matrix));
1332 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1337 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1344 DlColor::RGBA(220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f));
1346 for (
int i = 0;
i < 5;
i++) {
1350 radius, 60.0f - radius),
1356 for (
int i = 0;
i < 5;
i++) {
1364 for (
int i = 0;
i < 5;
i++) {
1368 radius, 60.0f - radius),
1373 DlColor::RGBA(128.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1.0f));
1375 for (
int i = 0;
i < 5;
i++) {
1385 DlColor::RGBA(255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f, 1.0f));
1387 for (
int i = 0;
i < 5;
i++) {
1396 auto dl = builder.
Build();
1397 ASSERT_TRUE(OpenPlaygroundHere(dl));
1403 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1406 std::vector<DlColor> colors = {
DlColor::RGBA(0.9568, 0.2627, 0.2118, 1.0),
1408 std::vector<Scalar> stops = {
1434 builder.
SaveLayer(clip_rect, &save_paint, backdrop_filter.get());
1436 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1442 auto callback = [&]() -> sk_sp<DisplayList> {
1457 DlClipOp::kDifference);
1471 Matrix(1.0, 0.0, 0.0, 0.0,
1473 0.0, 0.0, 1.0, 0.003,
1474 0.0, 0.0, 0.0, 1.0) *
1495 return builder.
Build();
1497 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1515 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1516 DlImageSampling::kNearestNeighbor, &matrix));
1527 Matrix matrix(1, -1, 0, 0,
1532 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1533 DlImageSampling::kNearestNeighbor, &matrix));
1542 builder.
Scale(100, 100);
1547 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1548 DlImageSampling::kNearestNeighbor, &matrix));
1563 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1564 DlImageSampling::kNearestNeighbor, &matrix));
1570 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1592 builder.
SaveLayer(std::nullopt, &paint);
1598 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1604 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1612 builder.
SaveLayer(std::nullopt, &paint);
1619 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1624 MatrixImageFilterDoesntCullWhenScaledAndTranslatedFromOffscreen) {
1626 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1634 DlImageSampling::kNearestNeighbor));
1635 builder.
SaveLayer(std::nullopt, &paint);
1642 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1647 SetWindowSize({400, 400});
1650 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1657 DlImageSampling::kLinear));
1658 builder.SaveLayer(std::nullopt, &paint);
1669 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
1674 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1681 builder.
SaveLayer(std::nullopt, &paint);
1684 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1689 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1696 builder.
SaveLayer(std::nullopt, &paint);
1699 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1703 CanPerformSaveLayerWithBoundsAndLargerIntermediateIsNotAllocated) {
1727 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1732 EXPECT_EQ(GetContext()->GetCapabilities()->GetDefaultColorFormat(),
1738 GetContext()->GetCapabilities()->GetDefaultColorFormat();
1753 builder.
Scale(0.5, 0.5);
1755 DlImageSampling::kNearestNeighbor);
1764 builder.
SaveLayer(std::nullopt, &alpha);
1777 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1787 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1798 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1820 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1825 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1828 const int color_count = 3;
1829 DlColor colors[color_count] = {
1832 DlColor::ARGB(1.0, 220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f),
1844 for (
int i = 0;
i < 4;
i++) {
1845 for (
int j = 0; j < 4; j++) {
1846 paint.
setColor(colors[(c_index++) % color_count]);
1848 i * 5 + 10, j * 5 + 10, paint);
1851 paint.
setColor(colors[(c_index++) % color_count]);
1853 paint.
setColor(colors[(c_index++) % color_count]);
1856 std::vector<DlColor> gradient_colors = {
1859 DlColor::RGBA(0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0),
1860 DlColor::RGBA(0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0),
1861 DlColor::RGBA(0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0),
1862 DlColor::RGBA(0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0),
1863 DlColor::RGBA(0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0)};
1864 std::vector<Scalar> stops = {
1874 CreateTextureForFixture(
"airplane.jpg",
1881 gradient_colors.size(),
1882 gradient_colors.data(),
1884 DlTileMode::kMirror));
1885 for (
int i = 1;
i <= 10;
i++) {
1888 550 +
i * 20, 550 + j * 20),
1889 i * 10, j * 10, paint);
1895 gradient_colors.size(),
1896 gradient_colors.data(),
1898 DlTileMode::kMirror));
1905 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1906 DlImageSampling::kMipmapLinear, &matrix));
1907 for (
int i = 1;
i <= 10;
i++) {
1910 720 +
i * 20, 220 + j * 20),
1911 i * 10, j * 10, paint);
1916 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1917 DlImageSampling::kMipmapLinear, &matrix));
1922 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1926 auto callback = [&]() -> sk_sp<DisplayList> {
1928 builder.
Scale(GetContentScale().x, GetContentScale().y);
1933 auto current =
Point{25, 25};
1934 const auto offset =
Point{25, 25};
1946 builder.
DrawRect(bounds, stroke_paint);
1967 return builder.
Build();
1970 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1985 builder.
SaveLayer(std::nullopt, &save_paint);
1996 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2032 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2062 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2068 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
2072 auto draw_image_layer = [&builder, &
texture](
const DlPaint& paint) {
2073 builder.
SaveLayer(std::nullopt, &paint);
2080 draw_image_layer(effect_paint);
2083 builder.
Scale(3, 3);
2084 draw_image_layer(effect_paint);
2086 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2092 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
2101 for (
int i = 0;
i < 5;
i++) {
2104 for (
int j = 0; j < 5; j++) {
2106 Scalar x_radius = j * 15;
2110 x_radius, y_radius),
2115 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2123 builder.
SaveLayer(std::nullopt, &paint);
2138 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2146 GTEST_SKIP() <<
"Swiftshader is running out of memory on this example.";
2155 builder.
SaveLayer(std::nullopt, &paint);
2163 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2170 auto callback = [&]() -> sk_sp<DisplayList> {
2172 ImGuiWindowFlags_AlwaysAutoResize)) {
2173 ImGui::SliderFloat(
"width", &
width, 0, 200);
2174 ImGui::SliderFloat(
"height", &
height, 0, 200);
2175 ImGui::SliderFloat(
"corner", &corner, 0, 1);
2180 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
2183 background_paint.
setColor(
DlColor(1, 0.1, 0.1, 0.1, DlColorSpace::kSRGB));
2187 std::vector<Scalar> stops = {0.0, 1.0};
2191 2, colors.data(), stops.data(),
2192 DlTileMode::kClamp);
2201 Scalar corner_x = ((1 - corner) * 50) + 50;
2202 Scalar corner_y = corner * 50 + 50;
2207 return builder.
Build();
2209 ASSERT_TRUE(OpenPlaygroundHere(
callback));
2231 builder.
SaveLayer(std::nullopt,
nullptr, image_filter.get());
2237 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
void DrawOval(const DlRect &bounds, const DlPaint &paint) override
void ClipRect(const DlRect &rect, DlClipOp clip_op=DlClipOp::kIntersect, bool is_aa=false) override
void DrawImageRect(const sk_sp< DlImage > &image, const DlRect &src, const DlRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, DlSrcRectConstraint constraint=DlSrcRectConstraint::kFast) override
void DrawRoundRect(const DlRoundRect &rrect, const DlPaint &paint) override
void DrawArc(const DlRect &bounds, DlScalar start, DlScalar sweep, bool useCenter, const DlPaint &paint) override
void DrawImage(const sk_sp< DlImage > &image, const DlPoint &point, DlImageSampling sampling, const DlPaint *paint=nullptr) override
void DrawColor(DlColor color, DlBlendMode mode) override
void DrawCircle(const DlPoint ¢er, DlScalar radius, const DlPaint &paint) override
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 ClipRoundRect(const DlRoundRect &rrect, DlClipOp clip_op=DlClipOp::kIntersect, bool is_aa=false) override
void Rotate(DlScalar degrees) override
void Scale(DlScalar sx, DlScalar sy) override
void Skew(DlScalar sx, DlScalar sy) override
void Translate(DlScalar tx, DlScalar ty) override
void DrawPaint(const DlPaint &paint) override
sk_sp< DisplayList > Build()
void DrawPath(const DlPath &path, const DlPaint &paint) override
void ClipPath(const DlPath &path, DlClipOp clip_op=DlClipOp::kIntersect, bool is_aa=false) override
void ClipOval(const DlRect &bounds, DlClipOp clip_op=DlClipOp::kIntersect, bool is_aa=false) override
void Transform(const DlMatrix &matrix) override
void DrawRect(const DlRect &rect, const DlPaint &paint) override
static std::shared_ptr< DlMaskFilter > Make(DlBlurStyle style, SkScalar sigma, bool respect_ctm=true)
Developer-facing API for rendering anything within the engine.
static std::shared_ptr< const DlColorFilter > MakeBlend(DlColor color, DlBlendMode mode)
static std::shared_ptr< DlColorSource > MakeImage(const sk_sp< const DlImage > &image, DlTileMode horizontal_tile_mode, DlTileMode vertical_tile_mode, DlImageSampling sampling=DlImageSampling::kLinear, const DlMatrix *matrix=nullptr)
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)
static std::shared_ptr< DlColorSource > MakeRadial(DlPoint center, DlScalar radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
static std::shared_ptr< DlImageFilter > MakeBlur(DlScalar sigma_x, DlScalar sigma_y, DlTileMode tile_mode)
static std::shared_ptr< DlImageFilter > MakeColorFilter(const std::shared_ptr< const DlColorFilter > &filter)
static std::shared_ptr< DlImageFilter > MakeMatrix(const DlMatrix &matrix, DlImageSampling sampling)
DlPaint & setColor(DlColor color)
DlPaint & setInvertColors(bool isInvertColors)
DlPaint & setStrokeCap(DlStrokeCap cap)
DlPaint & setStrokeWidth(float width)
DlPaint & setStrokeMiter(float miter)
DlPaint & setBlendMode(DlBlendMode mode)
DlPaint & setImageFilter(std::nullptr_t filter)
DlPaint & setMaskFilter(std::nullptr_t filter)
DlPaint & setDrawStyle(DlDrawStyle style)
DlPaint & setStrokeJoin(DlStrokeJoin join)
DlPaint & setColorFilter(std::nullptr_t filter)
DlPaint & setColorSource(std::nullptr_t source)
DlPathBuilder & MoveTo(DlPoint p2)
Start a new contour that will originate at the indicated point p2.
const DlPath TakePath()
Returns the path constructed by this path builder and resets its internal state to the default state ...
DlPathBuilder & AddCircle(DlPoint center, DlScalar radius)
Append a closed circular contour to the path centered on the provided point at the provided radius.
DlPathBuilder & AddRoundRect(const DlRoundRect &round_rect)
Append a closed rounded rect contour to the path.
static DlPath MakeCircle(const DlPoint center, DlScalar radius)
static DlPath MakeRectXYWH(DlScalar x, DlScalar y, DlScalar width, DlScalar height)
static DlPath MakeRect(const DlRect &rect)
static DlPath MakeRoundRectXY(const DlRect &rect, DlScalar x_radius, DlScalar y_radius, bool counter_clock_wise=false)
static bool ImGuiBegin(const char *name, bool *p_open, ImGuiWindowFlags flags)
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
FlutterVulkanImage * image
FlutterDesktopBinaryReply callback
impeller::Scalar DlScalar
impeller::ISize32 DlISize
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
static constexpr DlScalar kEhCloseEnough
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
TEST_P(AiksTest, DrawAtlasNoColor)
std::tuple< Point, Point > DrawPlaygroundLine(PlaygroundPoint &point_a, PlaygroundPoint &point_b)
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
void Close(PathBuilder *builder)
constexpr const char * PixelFormatToString(PixelFormat format)
static constexpr DlColor kWhite()
static constexpr DlColor kBlue()
static constexpr DlColor RGBA(DlScalar r, DlScalar g, DlScalar b, DlScalar a)
Construct a 32 bit color from floating point R, G, B, and A color channels.
static constexpr DlColor kBlack()
static constexpr DlColor ARGB(DlScalar a, DlScalar r, DlScalar g, DlScalar b)
Construct a 32 bit color from floating point A, R, G, and B color channels.
static constexpr DlColor kAqua()
static constexpr DlColor kYellow()
static constexpr DlColor kPurple()
static constexpr DlColor kMidGrey()
static constexpr DlColor kTransparent()
static constexpr DlColor kRed()
static constexpr DlColor kGreen()
static constexpr DlColor kOrange()
constexpr DlColor modulateOpacity(DlScalar opacity) const
static constexpr Color White()
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeTranslation(const Vector3 &t)
static Matrix MakeRotationY(Radians r)
static Matrix MakePerspective(Radians fov_y, Scalar aspect_ratio, Scalar z_near, Scalar z_far)
static constexpr Matrix MakeScale(const Vector3 &s)
static RoundRect MakeRectRadii(const Rect &rect, const RoundingRadii &radii)
static RoundRect MakeRectXY(const Rect &rect, Scalar x_radius, Scalar y_radius)
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
static constexpr TRect MakeSize(const TSize< U > &size)
constexpr TRect< T > Expand(T left, T top, T right, T bottom) const
Returns a rectangle with expanded edges. Negative expansion results in shrinking.
constexpr TRect< T > Shift(T dx, T dy) const
Returns a new rectangle translated by the given offset.
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)