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);
859 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
865 RenderArcFarm(builder, paint,
868 .full_circles =
false,
871 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
876 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
882 RenderArcFarm(builder, paint,
885 .full_circles =
false,
888 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
893 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
899 RenderArcFarm(builder, paint,
902 .full_circles =
false,
903 .vertical_scale = 0.8f,
906 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
911 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
917 RenderArcFarm(builder, paint,
920 .full_circles =
false,
921 .vertical_scale = 0.8f,
924 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
929 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
938 RenderArcFarm(builder, paint,
941 .full_circles =
false,
944 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
949 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
958 RenderArcFarm(builder, paint,
961 .full_circles =
false,
964 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
969 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
978 RenderArcFarm(builder, paint,
981 .full_circles =
false,
984 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
989 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
998 RenderArcFarm(builder, paint,
1001 .full_circles =
false,
1002 .sweeps_over_360 =
true,
1005 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1010 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1022 RenderArcFarm(builder, paint,
1025 .full_circles =
false,
1026 .sweeps_over_360 =
true,
1029 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1034 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1043 RenderArcFarm(builder, paint,
1046 .full_circles =
false,
1047 .sweeps_over_360 =
true,
1050 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1055 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1064 RenderArcFarm(builder, paint,
1066 .use_center =
false,
1067 .full_circles =
false,
1073 RenderArcFarm(builder, paint,
1075 .use_center =
false,
1076 .full_circles =
false,
1079 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1084 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1093 RenderArcFarm(builder, paint,
1095 .use_center =
false,
1096 .full_circles =
false,
1102 RenderArcFarm(builder, paint,
1104 .use_center =
false,
1105 .full_circles =
false,
1111 RenderArcFarm(builder, paint,
1113 .use_center =
false,
1114 .full_circles =
false,
1117 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1133 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1143 RenderArcFarm(builder, paint,
1145 .use_center =
false,
1146 .full_circles =
true,
1152 RenderArcFarm(builder, paint,
1154 .use_center =
false,
1155 .full_circles =
false,
1158 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1163 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1165 const int color_count = 3;
1166 DlColor colors[color_count] = {
1169 DlColor::RGBA(220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f),
1176 for (
int i = 0;
i < 4;
i++) {
1177 for (
int j = 0; j < 4; j++) {
1178 paint.
setColor(colors[(c_index++) % color_count]);
1182 i * 5 + 10, j * 5 + 10),
1186 paint.
setColor(colors[(c_index++) % color_count]);
1190 paint.
setColor(colors[(c_index++) % color_count]);
1195 DlColor gradient_colors[7] = {
1198 DlColor::RGBA(0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0),
1199 DlColor::RGBA(0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0),
1200 DlColor::RGBA(0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0),
1201 DlColor::RGBA(0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0),
1202 DlColor::RGBA(0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0),
1213 auto texture = CreateTextureForFixture(
"airplane.jpg",
1219 DlPoint(550, 550), 75, 7, gradient_colors, stops, DlTileMode::kMirror));
1220 for (
int i = 1;
i <= 10;
i++) {
1224 550 +
i * 20, 550 + j * 20),
1231 DlPoint(200, 650), 75, 7, gradient_colors, stops, DlTileMode::kMirror));
1243 image, DlTileMode::kRepeat, DlTileMode::kRepeat,
1244 DlImageSampling::kNearestNeighbor, &local_matrix));
1245 for (
int i = 1;
i <= 10;
i++) {
1249 720 +
i * 20, 220 + j * 20),
1257 image, DlTileMode::kRepeat, DlTileMode::kRepeat,
1258 DlImageSampling::kNearestNeighbor, &local_matrix));
1266 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1271 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1278 DlColor::RGBA(220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f));
1280 for (
int i = 0;
i < 5;
i++) {
1284 radius, 60.0f - radius),
1290 for (
int i = 0;
i < 5;
i++) {
1298 for (
int i = 0;
i < 5;
i++) {
1302 radius, 60.0f - radius),
1307 DlColor::RGBA(128.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1.0f));
1309 for (
int i = 0;
i < 5;
i++) {
1319 DlColor::RGBA(255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f, 1.0f));
1321 for (
int i = 0;
i < 5;
i++) {
1330 auto dl = builder.
Build();
1331 ASSERT_TRUE(OpenPlaygroundHere(dl));
1337 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1340 std::vector<DlColor> colors = {
DlColor::RGBA(0.9568, 0.2627, 0.2118, 1.0),
1342 std::vector<Scalar> stops = {
1368 builder.
SaveLayer(clip_rect, &save_paint, backdrop_filter.get());
1370 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1376 auto callback = [&]() -> sk_sp<DisplayList> {
1391 DlClipOp::kDifference);
1405 Matrix(1.0, 0.0, 0.0, 0.0,
1407 0.0, 0.0, 1.0, 0.003,
1408 0.0, 0.0, 0.0, 1.0) *
1429 return builder.
Build();
1431 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1449 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1450 DlImageSampling::kNearestNeighbor, &matrix));
1461 Matrix matrix(1, -1, 0, 0,
1466 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1467 DlImageSampling::kNearestNeighbor, &matrix));
1476 builder.
Scale(100, 100);
1481 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1482 DlImageSampling::kNearestNeighbor, &matrix));
1497 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1498 DlImageSampling::kNearestNeighbor, &matrix));
1504 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1526 builder.
SaveLayer(std::nullopt, &paint);
1532 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1538 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1546 builder.
SaveLayer(std::nullopt, &paint);
1553 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1558 MatrixImageFilterDoesntCullWhenScaledAndTranslatedFromOffscreen) {
1560 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1568 DlImageSampling::kNearestNeighbor));
1569 builder.
SaveLayer(std::nullopt, &paint);
1576 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1581 SetWindowSize({400, 400});
1584 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1591 DlImageSampling::kLinear));
1592 builder.SaveLayer(std::nullopt, &paint);
1603 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
1608 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1615 builder.
SaveLayer(std::nullopt, &paint);
1618 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1623 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1630 builder.
SaveLayer(std::nullopt, &paint);
1633 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1637 CanPerformSaveLayerWithBoundsAndLargerIntermediateIsNotAllocated) {
1661 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1666 EXPECT_EQ(GetContext()->GetCapabilities()->GetDefaultColorFormat(),
1672 GetContext()->GetCapabilities()->GetDefaultColorFormat();
1687 builder.
Scale(0.5, 0.5);
1689 DlImageSampling::kNearestNeighbor);
1698 builder.
SaveLayer(std::nullopt, &alpha);
1711 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1721 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1732 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1754 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1759 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
1762 const int color_count = 3;
1763 DlColor colors[color_count] = {
1766 DlColor::ARGB(1.0, 220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f),
1778 for (
int i = 0;
i < 4;
i++) {
1779 for (
int j = 0; j < 4; j++) {
1780 paint.
setColor(colors[(c_index++) % color_count]);
1782 i * 5 + 10, j * 5 + 10, paint);
1785 paint.
setColor(colors[(c_index++) % color_count]);
1787 paint.
setColor(colors[(c_index++) % color_count]);
1790 std::vector<DlColor> gradient_colors = {
1793 DlColor::RGBA(0x87 / 255.0, 0x01 / 255.0, 0x60 / 255.0, 1.0),
1794 DlColor::RGBA(0xac / 255.0, 0x25 / 255.0, 0x53 / 255.0, 1.0),
1795 DlColor::RGBA(0xe1 / 255.0, 0x6b / 255.0, 0x5c / 255.0, 1.0),
1796 DlColor::RGBA(0xf3 / 255.0, 0x90 / 255.0, 0x60 / 255.0, 1.0),
1797 DlColor::RGBA(0xff / 255.0, 0xb5 / 255.0, 0x6b / 250.0, 1.0)};
1798 std::vector<Scalar> stops = {
1808 CreateTextureForFixture(
"airplane.jpg",
1815 gradient_colors.size(),
1816 gradient_colors.data(),
1818 DlTileMode::kMirror));
1819 for (
int i = 1;
i <= 10;
i++) {
1822 550 +
i * 20, 550 + j * 20),
1823 i * 10, j * 10, paint);
1829 gradient_colors.size(),
1830 gradient_colors.data(),
1832 DlTileMode::kMirror));
1839 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1840 DlImageSampling::kMipmapLinear, &matrix));
1841 for (
int i = 1;
i <= 10;
i++) {
1844 720 +
i * 20, 220 + j * 20),
1845 i * 10, j * 10, paint);
1850 texture, DlTileMode::kRepeat, DlTileMode::kRepeat,
1851 DlImageSampling::kMipmapLinear, &matrix));
1856 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1860 auto callback = [&]() -> sk_sp<DisplayList> {
1862 builder.
Scale(GetContentScale().x, GetContentScale().y);
1867 auto current =
Point{25, 25};
1868 const auto offset =
Point{25, 25};
1880 builder.
DrawRect(bounds, stroke_paint);
1901 return builder.
Build();
1904 ASSERT_TRUE(OpenPlaygroundHere(
callback));
1919 builder.
SaveLayer(std::nullopt, &save_paint);
1930 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1966 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
1996 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2002 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
2006 auto draw_image_layer = [&builder, &
texture](
const DlPaint& paint) {
2007 builder.
SaveLayer(std::nullopt, &paint);
2014 draw_image_layer(effect_paint);
2017 builder.
Scale(3, 3);
2018 draw_image_layer(effect_paint);
2020 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2026 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
2035 for (
int i = 0;
i < 5;
i++) {
2038 for (
int j = 0; j < 5; j++) {
2040 Scalar x_radius = j * 15;
2044 x_radius, y_radius),
2049 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2057 builder.
SaveLayer(std::nullopt, &paint);
2072 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2080 GTEST_SKIP() <<
"Swiftshader is running out of memory on this example.";
2089 builder.
SaveLayer(std::nullopt, &paint);
2097 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
2104 auto callback = [&]() -> sk_sp<DisplayList> {
2106 ImGuiWindowFlags_AlwaysAutoResize)) {
2107 ImGui::SliderFloat(
"width", &
width, 0, 200);
2108 ImGui::SliderFloat(
"height", &
height, 0, 200);
2109 ImGui::SliderFloat(
"corner", &corner, 0, 1);
2114 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
2117 background_paint.
setColor(
DlColor(1, 0.1, 0.1, 0.1, DlColorSpace::kSRGB));
2121 std::vector<Scalar> stops = {0.0, 1.0};
2125 2, colors.data(), stops.data(),
2126 DlTileMode::kClamp);
2135 Scalar corner_x = ((1 - corner) * 50) + 50;
2136 Scalar corner_y = corner * 50 + 50;
2141 return builder.
Build();
2143 ASSERT_TRUE(OpenPlaygroundHere(
callback));
2165 builder.
SaveLayer(std::nullopt,
nullptr, image_filter.get());
2171 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)