Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Display List] Add runtime color source dl unittest entry #35554

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions display_list/display_list_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ DEFINE_SET_CLEAR_DLATTR_OP(ColorSource, Shader, source)
DEFINE_SET_CLEAR_DLATTR_OP(PathEffect, PathEffect, effect)
#undef DEFINE_SET_CLEAR_DLATTR_OP

// 4 byte header + 80 bytes for the embedded DlImageColorSource
// uses 84 total bytes (4 bytes unused)
// 4 byte header + unused 4 byte padding +
// 88 bytes for the embedded DlImageColorSource
// packs into 96 total bytes (4 bytes unused)
struct SetImageColorSourceOp : DLOp {
static const auto kType = DisplayListOpType::kSetImageColorSource;

Expand All @@ -247,8 +248,9 @@ struct SetImageColorSourceOp : DLOp {
}
};

// 56 bytes: 4 byte header, 4 byte padding, 8 for vtable, 8 * 2 for sk_sps, 24
// for the std::vector.
// 4 byte header + unused 4 byte padding +
// 56 bytes for DlRuntimeEffectColorSource
// packs into 64 total bytes (4 bytes unused)
struct SetRuntimeEffectColorSourceOp : DLOp {
static const auto kType = DisplayListOpType::kSetRuntimeEffectColorSource;

Expand Down
4 changes: 4 additions & 0 deletions display_list/display_list_test_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ std::vector<DisplayListInvocationGroup> CreateAllAttributesOps() {
[](DisplayListBuilder& b) {
b.setColorSource(kTestSource5.get());
}},
{0, 64, 0, 0,
[](DisplayListBuilder& b) {
b.setColorSource(kTestSource6.get());
}},
{0, 0, 0, 0,
[](DisplayListBuilder& b) { b.setColorSource(nullptr); }},
}},
Expand Down
9 changes: 9 additions & 0 deletions display_list/display_list_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ static const std::shared_ptr<DlColorSource> kTestSource5 =
kColors,
kStops,
DlTileMode::kDecal);
static const sk_sp<SkRuntimeEffect> kTestRuntimeEffect1 =
SkRuntimeEffect::MakeForShader(
SkString("vec4 main(vec2 p) { return vec4(0); }"))
.effect;
static const std::shared_ptr<DlColorSource> kTestSource6 =
DlColorSource::MakeRuntimeEffect(
DlRuntimeEffect::MakeSkia(kTestRuntimeEffect1),
{},
std::make_shared<std::vector<uint8_t>>());
static const DlBlendColorFilter kTestBlendColorFilter1(DlColor::kRed(),
DlBlendMode::kDstATop);
static const DlBlendColorFilter kTestBlendColorFilter2(DlColor::kBlue(),
Expand Down