| 208 | } |
| 209 | |
| 210 | AssetAttributes::AssetAttributes(AttributeIds& attributeIds, snap::valdi_core::AssetOutputType assetOutputType) |
| 211 | : _attributeIds(attributeIds), _assetOutputType(assetOutputType) {} |
| 212 | |
| 213 | void AssetAttributes::bind(AttributeHandlerById& attributes, Ref<MeasureDelegate>& outMeasureDelegate) { |
| 214 | auto srcAttributeId = _attributeIds.getIdForName("src"); |
| 215 | auto filterAttributeId = _attributeIds.getIdForName("filter"); |
| 216 | auto fontProviderAttributeId = _attributeIds.getIdForName("fontProvider"); |
| 217 | |
| 218 | std::vector<CompositeAttributePart> parts; |
| 219 | parts.emplace_back(srcAttributeId, true, true); |
| 220 | parts.emplace_back(_attributeIds.getIdForName("onAssetLoad"), true); |
| 221 | parts.emplace_back(_attributeIds.getIdForName("flipOnRtl"), true); |
| 222 | |
| 223 | if (_assetOutputType == snap::valdi_core::AssetOutputType::Lottie) { |
| 224 | parts.emplace_back(fontProviderAttributeId, true); |
| 225 | } else { |
| 226 | parts.emplace_back(filterAttributeId, true); |
| 227 | } |
| 228 | |
| 229 | auto srcOnLoad = STRING_LITERAL("srcOnLoad"); |
| 230 | auto compositeAttribute = |
| 231 | Valdi::makeShared<CompositeAttribute>(_attributeIds.getIdForName(srcOnLoad), srcOnLoad, std::move(parts)); |
| 232 | |
| 233 | Valdi::bindCompositeAttribute(_attributeIds, |
| 234 | attributes, |
| 235 | compositeAttribute, |
| 236 | makeShared<AssetSrcAttributeHandlerDelegate>(_assetOutputType), |
| 237 | true); |
| 238 | |
| 239 | auto& srcOnLoadHandler = attributes[_attributeIds.getIdForName(srcOnLoad)]; |
| 240 | srcOnLoadHandler.setShouldReevaluateOnColorPaletteChange(true); |
| 241 | |
| 242 | auto& srcHandler = attributes[srcAttributeId]; |
| 243 | srcHandler.appendPostprocessor(postprocessAsset); |
| 244 | srcHandler.setShouldReevaluateOnColorPaletteChange(true); |
| 245 | |
| 246 | if (_assetOutputType != snap::valdi_core::AssetOutputType::Lottie) { |
| 247 | auto& filterHandler = attributes[filterAttributeId]; |
| 248 | filterHandler.appendPreprocessor(preprocessFilter, false); |
nothing calls this directly
no test coverage detected