34std::tuple<std::vector<DlRect>,
35 std::vector<RSTransform>,
36 sk_sp<DlImageImpeller>>
37CreateTestData(
const AiksTest* test) {
41 auto size = atlas->GetImpellerTexture(test->GetContext())->GetSize();
45 std::vector<DlRect> texture_coordinates = {
51 std::vector<RSTransform> transforms = {
52 MakeTranslation(0, 0), MakeTranslation(half_width, 0),
53 MakeTranslation(0, half_height),
54 MakeTranslation(half_width, half_height)};
55 return std::make_tuple(texture_coordinates, transforms, atlas);
62 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
64 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
65 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
66 nullptr, 4, DlBlendMode::kSrcOver,
67 DlImageSampling::kNearestNeighbor,
nullptr);
69 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
74 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
79 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
80 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
81 colors.data(), 4, DlBlendMode::kModulate,
82 DlImageSampling::kNearestNeighbor,
nullptr);
84 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
90 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
95 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
96 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
97 colors.data(), 4, DlBlendMode::kSrcATop,
98 DlImageSampling::kNearestNeighbor,
nullptr);
100 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
107 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
111 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
112 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
113 nullptr, 4, DlBlendMode::kSrcOver,
114 DlImageSampling::kNearestNeighbor,
nullptr,
117 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
122 auto size = atlas->GetImpellerTexture(GetContext())->GetSize();
123 std::vector<DlRect> texture_coordinates = {
125 std::vector<RSTransform> transforms = {MakeTranslation(0, 0)};
128 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
129 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
130 nullptr, 1, DlBlendMode::kSrcOver,
131 DlImageSampling::kNearestNeighbor,
nullptr);
133 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
140 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
142 builder.
Scale(0.25, 0.25);
143 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
144 nullptr, 4, DlBlendMode::kModulate,
145 DlImageSampling::kNearestNeighbor,
nullptr);
147 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
154 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
158 builder.
Scale(0.25, 0.25);
159 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
160 colors.data(), 4, DlBlendMode::kModulate,
161 DlImageSampling::kNearestNeighbor,
nullptr);
163 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
169 if (!EnsureContextSupportsWideGamut()) {
170 GTEST_SKIP() <<
"This backend doesn't yet support wide gamut.";
174 EXPECT_EQ(GetContext()->GetCapabilities()->GetDefaultColorFormat(),
178 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
182 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
183 colors.data(), 4, DlBlendMode::kPlus,
184 DlImageSampling::kNearestNeighbor,
nullptr);
186 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
190 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
193 transforms.data(), texture_coordinates.data(),
nullptr,
205 EXPECT_EQ(vertex_buffer.vertex_count, texture_coordinates.size() * 6);
209 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
211 std::vector<DlColor> colors;
212 colors.reserve(texture_coordinates.size());
213 for (
auto i = 0u;
i < texture_coordinates.size();
i++) {
217 transforms.data(), texture_coordinates.data(),
229 EXPECT_EQ(vertex_buffer.vertex_count, texture_coordinates.size() * 6);
233 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
235 std::vector<DlColor> colors;
236 colors.reserve(texture_coordinates.size());
237 for (
auto i = 0u;
i < texture_coordinates.size();
i++) {
241 transforms.data(), texture_coordinates.data(),
251 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
253 std::vector<DlColor> colors;
254 colors.reserve(texture_coordinates.size());
255 for (
auto i = 0u;
i < texture_coordinates.size();
i++) {
259 transforms.data(), texture_coordinates.data(),
266 sk_sp<DlImageImpeller>
texture =
276 DlPaint paint_with_filter = paint;
291 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
295 sk_sp<DlImageImpeller>
texture =
304 1.0, 1.0, 1.0, 1.0, 0
312 DlPaint paint_with_filter = paint;
327 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
332 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
337 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
338 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
339 colors.data(), 4, DlBlendMode::kColorBurn,
340 DlImageSampling::kNearestNeighbor,
nullptr);
342 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)
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.
std::shared_ptr< ContextGLES > context
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)