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()));
168 EXPECT_EQ(GetContext()->GetCapabilities()->GetDefaultColorFormat(),
172 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
176 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
177 colors.data(), 4, DlBlendMode::kPlus,
178 DlImageSampling::kNearestNeighbor,
nullptr);
180 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
184 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
187 transforms.data(), texture_coordinates.data(),
nullptr,
199 EXPECT_EQ(vertex_buffer.vertex_count, texture_coordinates.size() * 6);
203 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
205 std::vector<DlColor> colors;
206 colors.reserve(texture_coordinates.size());
207 for (
auto i = 0u;
i < texture_coordinates.size();
i++) {
211 transforms.data(), texture_coordinates.data(),
223 EXPECT_EQ(vertex_buffer.vertex_count, texture_coordinates.size() * 6);
227 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
229 std::vector<DlColor> colors;
230 colors.reserve(texture_coordinates.size());
231 for (
auto i = 0u;
i < texture_coordinates.size();
i++) {
235 transforms.data(), texture_coordinates.data(),
245 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
247 std::vector<DlColor> colors;
248 colors.reserve(texture_coordinates.size());
249 for (
auto i = 0u;
i < texture_coordinates.size();
i++) {
253 transforms.data(), texture_coordinates.data(),
260 sk_sp<DlImageImpeller>
texture =
270 DlPaint paint_with_filter = paint;
285 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
289 sk_sp<DlImageImpeller>
texture =
298 1.0, 1.0, 1.0, 1.0, 0
306 DlPaint paint_with_filter = paint;
321 ASSERT_TRUE(OpenPlaygroundHere(builder.
Build()));
326 auto [texture_coordinates, transforms, atlas] = CreateTestData(
this);
331 builder.
Scale(GetContentScale().
x, GetContentScale().
y);
332 builder.
DrawAtlas(atlas, transforms.data(), texture_coordinates.data(),
333 colors.data(), 4, DlBlendMode::kColorBurn,
334 DlImageSampling::kNearestNeighbor,
nullptr);
336 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)