25 : fImageAsset(
std::move(asset)) {}
39 fImageAsset = std::move(asset);
50 : fRevalidator(
std::move(revalidator)) {}
55 auto c4f = SkColor4f::FromColor(c);
57 const auto valueGroup = fColorMap.find(slotID);
59 for (
auto& cPair : *valueGroup) {
61 cPair.adapter->onSync();
63 fRevalidator->revalidate();
71 const auto imageGroup = fImageMap.find(slotID);
73 for (
auto& imageAsset : *imageGroup) {
74 imageAsset->setImageAsset(
i);
76 fRevalidator->revalidate();
83 const auto valueGroup = fScalarMap.find(slotID);
85 for (
auto& sPair : *valueGroup) {
87 sPair.adapter->onSync();
89 fRevalidator->revalidate();
96 const auto valueGroup = fVec2Map.find(slotID);
98 for (
auto& vPair : *valueGroup) {
100 vPair.adapter->onSync();
102 fRevalidator->revalidate();
109 const auto adapterGroup = fTextMap.find(slotID);
111 for (
auto& textAdapter : *adapterGroup) {
112 textAdapter->setText(t);
114 fRevalidator->revalidate();
121 const auto valueGroup = fColorMap.find(slotID);
122 return valueGroup && !valueGroup->empty() ? std::optional<SkColor>(*(valueGroup->at(0).value))
127 const SlotID& slotID)
const {
128 const auto imageGroup = fImageMap.find(slotID);
129 return imageGroup && !imageGroup->empty() ? imageGroup->at(0)->getImageAsset() :
nullptr;
133 const auto valueGroup = fScalarMap.find(slotID);
134 return valueGroup && !valueGroup->empty() ? std::optional<float>(*(valueGroup->at(0).value))
139 const auto valueGroup = fVec2Map.find(slotID);
140 return valueGroup && !valueGroup->empty() ? std::optional<SkV2>(*(valueGroup->at(0).value))
145 const SlotID& slotID)
const {
146 const auto adapterGroup = fTextMap.find(slotID);
147 return adapterGroup && !adapterGroup->empty() ?
148 std::optional<TextPropertyValue>(adapterGroup->at(0)->getText()) :
152void skottie::SlotManager::trackColorValue(
const SlotID& slotID,
ColorValue* colorValue,
154 fColorMap[slotID].push_back({colorValue, std::move(adapter)});
160 auto proxy = sk_make_sp<ImageAssetProxy>(std::move(imageAsset));
161 fImageMap[slotID].push_back(proxy);
165void skottie::SlotManager::trackScalarValue(
const SlotID& slotID,
ScalarValue* scalarValue,
167 fScalarMap[slotID].push_back({scalarValue, std::move(adapter)});
170void skottie::SlotManager::trackVec2Value(
const SlotID& slotID,
Vec2Value* vec2Value,
172 fVec2Map[slotID].push_back({vec2Value, std::move(adapter)});
175void skottie::SlotManager::trackTextValue(
const SlotID& slotID,
177 fTextMap[slotID].push_back(std::move(adapter));
182 for (
const auto& c : fColorMap) {
185 for (
const auto&
s : fScalarMap) {
188 for (
const auto& v : fVec2Map) {
191 for (
const auto&
i : fImageMap) {
194 for (
const auto& t : fTextMap) {
static const SkMatrix & I()
ImageAssetProxy(sk_sp< skresources::ImageAsset > asset)
void setImageAsset(sk_sp< skresources::ImageAsset > asset)
bool isMultiFrame() override
sk_sp< const skresources::ImageAsset > getImageAsset() const
FrameData getFrameData(float t) override
std::optional< SkV2 > getVec2Slot(const SlotID &) const
bool setColorSlot(const SlotID &, SkColor)
std::optional< TextPropertyValue > getTextSlot(const SlotID &) const
SlotInfo getSlotInfo() const
SlotManager(sk_sp< skottie::internal::SceneGraphRevalidator >)
bool setScalarSlot(const SlotID &, float)
sk_sp< const skresources::ImageAsset > getImageSlot(const SlotID &) const
std::optional< float > getScalarSlot(const SlotID &) const
bool setImageSlot(const SlotID &, const sk_sp< skresources::ImageAsset > &)
bool setVec2Slot(const SlotID &, SkV2)
bool setTextSlot(const SlotID &, const TextPropertyValue &)
std::optional< SkColor > getColorSlot(const SlotID &) const
virtual FrameData getFrameData(float t)
SkSamplingOptions(SkFilterMode::kLinear))
TArray< SlotID > fTextSlotIDs
TArray< SlotID > fColorSlotIDs
TArray< SlotID > fVec2SlotIDs
TArray< SlotID > fImageSlotIDs
TArray< SlotID > fScalarSlotIDs