35SkMatrix image_matrix(
const ImageAsset::FrameData& frame_data,
const SkISize& dest_size) {
36 if (!frame_data.image) {
44 static_cast<
SkMatrix::ScaleToFit>(frame_data.scaling));
46 return frame_data.matrix * size_fit_matrix;
49class FootageAnimator final :
public Animator {
55 float time_bias,
float time_scale)
56 : fAsset(
std::move(asset))
57 , fImageNode(
std::move(image_node))
58 , fImageTransformNode(
std::move(image_transform_node))
59 , fAssetSize(asset_size)
60 , fTimeBias(time_bias)
61 , fTimeScale(time_scale)
62 , fIsMultiframe(fAsset->isMultiFrame()) {}
64 StateChanged onSeek(
float t)
override {
65 if (!fIsMultiframe && fImageNode->getImage()) {
70 auto frame_data = fAsset->getFrameData((t + fTimeBias) * fTimeScale);
71 const auto m = image_matrix(frame_data, fAssetSize);
72 if (frame_data.image != fImageNode->getImage() ||
73 frame_data.sampling != fImageNode->getSamplingOptions() ||
74 m != fImageTransformNode->getMatrix()) {
76 fImageNode->setImage(std::move(frame_data.image));
77 fImageNode->setSamplingOptions(frame_data.sampling);
78 fImageTransformNode->setMatrix(
m);
90 const float fTimeBias,
92 const bool fIsMultiframe;
97const AnimationBuilder::FootageAssetInfo*
104 "Slotid found but no slots were found in the json. Using default asset.");
109 "Specified slotID not found in 'slots'. Using default asset.");
111 jimage = (*slot)[
"p"];
124 if (
auto* cached_info = fImageAssetCache.
find(res_id)) {
128 auto asset = fResourceProvider->loadImageAsset(
path->begin(),
name->begin(),
id->begin());
129 if (!asset && !slotID) {
136 asset = fSlotManager->trackImageValue(
SkString(slotID->
begin()), std::move(asset));
139 ParseDefault<int>((*jimage)[
"h"], 0));
140 return fImageAssetCache.
set(res_id, { std::move(asset),
size });
144 LayerInfo* layer_info)
const {
145 const auto* asset_info = this->loadFootageAsset(jimage);
157 || asset_info->fAsset->isMultiFrame();
158 if (requires_animator) {
162 fCurrentAnimatorScope->push_back(sk_make_sp<FootageAnimator>(asset_info->fAsset,
166 -layer_info->fInPoint,
170 auto frame_data = asset_info->fAsset->getFrameData(0);
171 if (!frame_data.image) {
176 const auto m = image_matrix(frame_data, asset_info->fSize);
177 if (!
m.isIdentity()) {
181 image_node->setImage(std::move(frame_data.image));
182 image_node->setSamplingOptions(frame_data.sampling);
188 if (!image_transform) {
197 LayerInfo* layer_info)
const {
198 const ScopedAssetRef footage_asset(
this, jlayer);
201 ? this->attachFootageAsset(*footage_asset, layer_info)
static const SkMatrix & I()
V * find(const K &key) const
const char * begin() const
void log(Logger::Level, const skjson::Value *, const char fmt[],...) const SK_PRINTF_LIKE(4
static sk_sp< Image > Make(sk_sp< SkImage > image)
static sk_sp< Matrix > Make(const T &m)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
Optional< SkRect > bounds
sk_sp< const SkImage > image
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name
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
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkSize Make(SkScalar w, SkScalar h)