28AnimationBuilder::ScopedAssetRef::ScopedAssetRef(
const AnimationBuilder* abuilder,
30 const auto refId = ParseDefault<SkString>(jlayer[
"refId"],
SkString());
31 if (refId.isEmpty()) {
36 const auto* asset_info = abuilder->fAssets.find(refId);
42 if (asset_info->fIsAttaching) {
44 "Asset cycle detected for: '%s'", refId.c_str());
48 asset_info->fIsAttaching =
true;
60 static constexpr size_t kMaxSamplesPerFrame = 64;
61 fMotionBlurSamples =
std::min(ParseDefault<size_t>((*jmb)[
"spf"], 1ul),
67 int camera_builder_index = -1;
71 fLayerBuilders.reserve(
SkToInt(jlayers->size()));
73 if (!jlayer)
continue;
75 const auto lbuilder_index = fLayerBuilders.size();
76 fLayerBuilders.emplace_back(*jlayer, fSize);
77 const auto& lbuilder = fLayerBuilders.back();
79 fLayerIndexMap.
set(lbuilder.index(), lbuilder_index);
82 if (lbuilder.isCamera()) {
84 if (camera_builder_index < 0) {
85 camera_builder_index =
SkToInt(lbuilder_index);
88 "Ignoring duplicate camera layer.");
96 if (camera_builder_index >= 0) {
98 fCameraTransform = fLayerBuilders[camera_builder_index].buildTransform(abuilder,
this);
99 }
else if (ParseDefault<int>(jcomp[
"ddd"], 0) && !fSize.
isEmpty()) {
108 if (layer_index < 0) {
112 if (
const auto* idx = fLayerIndexMap.
find(layer_index)) {
113 return &fLayerBuilders[
SkToInt(*idx)];
121 for (
auto& lbuilder : fLayerBuilders) {
122 lbuilder.buildTransform(abuilder,
this);
126 std::vector<sk_sp<sksg::RenderNode>> layers;
127 layers.reserve(fLayerBuilders.size());
130 for (
auto& lbuilder : fLayerBuilders) {
131 if (
auto layer = lbuilder.buildRenderTree(abuilder,
this, prev_layer)) {
132 layers.push_back(std::move(layer));
134 prev_layer = &lbuilder;
137 if (layers.empty()) {
141 if (layers.size() == 1) {
142 return std::move(layers[0]);
147 layers.shrink_to_fit();
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
constexpr int SkToInt(S x)
V * find(const K &key) const
void log(Logger::Level, const skjson::Value *, const char fmt[],...) const SK_PRINTF_LIKE(4
static sk_sp< sksg::Transform > DefaultCameraTransform(const SkSize &viewport_size)
CompositionBuilder(const AnimationBuilder &, const SkSize &, const skjson::ObjectValue &)
sk_sp< sksg::RenderNode > build(const AnimationBuilder &)
LayerBuilder * layerBuilder(int layer_index)
static sk_sp< Group > Make()
static float min(float r, float g, float b)
it will be possible to load the file into Perfetto s trace viewer 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
T ParseDefault(const skjson::Value &v, const T &defaultValue)