34std::tuple<std::vector<DlRect>,
35 std::vector<RSTransform>,
36 sk_sp<DlImageImpeller>> CreateTestData(
const AiksTest* test) {
40 auto size = atlas->impeller_texture()->GetSize();
44 std::vector<DlRect> texture_coordinates = {
50 std::vector<RSTransform> transforms = {
51 MakeTranslation(0, 0), MakeTranslation(half_width, 0),
52 MakeTranslation(0, half_height),
53 MakeTranslation(half_width, half_height)};
54 return std::make_tuple(texture_coordinates, transforms, atlas);
61 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
63 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
64 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
65 nullptr, 4, DlBlendMode::kSrcOver,
66 DlImageSampling::kNearestNeighbor,
nullptr);
68 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
73 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
78 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
79 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
80 colors.data(), 4, DlBlendMode::kModulate,
81 DlImageSampling::kNearestNeighbor,
nullptr);
83 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
89 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
94 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
95 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
96 colors.data(), 4, DlBlendMode::kSrcATop,
97 DlImageSampling::kNearestNeighbor,
nullptr);
99 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
106 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
110 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
111 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
112 nullptr, 4, DlBlendMode::kSrcOver,
113 DlImageSampling::kNearestNeighbor,
nullptr,
116 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
121 auto size = atlas->impeller_texture()->GetSize();
122 std::vector<DlRect> texture_coordinates = {
124 std::vector<RSTransform> transforms = {MakeTranslation(0, 0)};
127 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
128 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
129 nullptr, 1, DlBlendMode::kSrcOver,
130 DlImageSampling::kNearestNeighbor,
nullptr);
132 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
139 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
141 builder.
Scale(0.25, 0.25);
142 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
143 nullptr, 4, DlBlendMode::kModulate,
144 DlImageSampling::kNearestNeighbor,
nullptr);
146 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
153 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
157 builder.
Scale(0.25, 0.25);
158 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
159 colors.data(), 4, DlBlendMode::kModulate,
160 DlImageSampling::kNearestNeighbor,
nullptr);
162 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
167 EXPECT_EQ(GetContext()->GetCapabilities()->GetDefaultColorFormat(),
171 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
175 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
176 colors.data(), 4, DlBlendMode::kPlus,
177 DlImageSampling::kNearestNeighbor,
nullptr);
179 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
183 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
186 texture_coordinates.data(),
nullptr, transforms.size(),
197 EXPECT_EQ(vertex_buffer.vertex_count, texture_coordinates.size() * 6);
201 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
203 std::vector<DlColor> colors;
204 colors.reserve(texture_coordinates.size());
205 for (
auto i = 0u;
i < texture_coordinates.size();
i++) {
209 atlas->impeller_texture(), transforms.data(), texture_coordinates.data(),
220 EXPECT_EQ(vertex_buffer.vertex_count, texture_coordinates.size() * 6);
224 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
226 std::vector<DlColor> colors;
227 colors.reserve(texture_coordinates.size());
228 for (
auto i = 0u;
i < texture_coordinates.size();
i++) {
232 texture_coordinates.data(), colors.data(),
241 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
243 std::vector<DlColor> colors;
244 colors.reserve(texture_coordinates.size());
245 for (
auto i = 0u;
i < texture_coordinates.size();
i++) {
249 texture_coordinates.data(), colors.data(),
255 sk_sp<DlImageImpeller>
texture =
265 DlPaint paint_with_filter = paint;
280 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
284 sk_sp<DlImageImpeller>
texture =
293 1.0, 1.0, 1.0, 1.0, 0
301 DlPaint paint_with_filter = paint;
316 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
321 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
326 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
327 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
328 colors.data(), 4, DlBlendMode::kColorBurn,
329 DlImageSampling::kNearestNeighbor,
nullptr);
331 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
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 DrawAtlas(const sk_sp< DlImage > &atlas, const DlRSTransform xform[], const DlRect tex[], const DlColor colors[], int count, DlBlendMode mode, DlImageSampling sampling, const DlRect *cullRect, const DlPaint *paint=nullptr) override
void Scale(DlScalar sx, DlScalar sy) override
void Translate(DlScalar tx, DlScalar ty) override
void DrawPaint(const DlPaint &paint) override
sk_sp< DisplayList > Build()
static std::shared_ptr< const DlColorFilter > MakeBlend(DlColor color, DlBlendMode mode)
static std::shared_ptr< const DlColorFilter > MakeMatrix(const float matrix[20])
DlPaint & setAlpha(uint8_t alpha)
DlPaint & setImageFilter(std::nullptr_t filter)
DlPaint & setColorFilter(std::nullptr_t filter)
HostBuffer & GetTransientsDataBuffer() const
Retrieve the current host buffer for transient storage of other non-index data.
A wrapper around data provided by a drawAtlas call.
VertexBuffer CreateBlendVertexBuffer(HostBuffer &host_buffer) const override
bool ShouldUseBlend() const override
Whether the blend shader should be used.
bool ShouldSkip() const override
VertexBuffer CreateSimpleVertexBuffer(HostBuffer &host_buffer) const override
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
impeller::Matrix DlMatrix
impeller::Degrees DlDegrees
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
TEST_P(AiksTest, DrawAtlasNoColor)
@ kNone
Does not use the index buffer.
static const constexpr ColorMatrix kColorInversion
A color matrix which inverts colors.
static constexpr DlColor kWhite()
static constexpr DlColor kBlue()
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 kYellow()
static constexpr DlColor kLightGrey()
static constexpr DlColor kRed()
static constexpr DlColor kGreen()
static constexpr DlColor kDarkGrey()
A 4x4 matrix using column-major storage.
static constexpr TRect MakeSize(const TSize< U > &size)
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)