Skip to content

Commit

Permalink
Inject XML drawable decoder and factory
Browse files Browse the repository at this point in the history
Reviewed By: oprisnik

Differential Revision: D67878073

fbshipit-source-id: d9a7dcc82bae33f270654991efd63dec8a5fc957
  • Loading branch information
Abbondanzo authored and facebook-github-bot committed Jan 8, 2025
1 parent 43b2160 commit 7896b72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ public ImagePipelineFactory(ImagePipelineConfigInterface config) {
FrescoSystrace.endSection();
}
mDiskCachesStoreSupplier = mConfig.getDiskCachesStoreSupplier();
if (mConfig.getExperiments().isBinaryXmlEnabled()) {
ImageFormatChecker.getInstance().setBinaryXmlEnabled(true);
}
}

@Nullable
Expand Down Expand Up @@ -249,8 +252,6 @@ private ImageDecoder getImageDecoder() {
}

ImageDecoder xmlDecoder = getXmlImageDecoder();
ImageFormatChecker imageFormatChecker = ImageFormatChecker.getInstance();
imageFormatChecker.setBinaryXmlEnabled(mConfig.getExperiments().isBinaryXmlEnabled());

if (mConfig.getImageDecoderConfig() == null) {
mImageDecoder =
Expand All @@ -264,8 +265,9 @@ private ImageDecoder getImageDecoder() {
getPlatformDecoder(),
mConfig.getImageDecoderConfig().getCustomImageDecoders());
// Add custom image formats if needed
imageFormatChecker.setCustomImageFormatCheckers(
mConfig.getImageDecoderConfig().getCustomImageFormats());
ImageFormatChecker.getInstance()
.setCustomImageFormatCheckers(
mConfig.getImageDecoderConfig().getCustomImageFormats());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ public DefaultImageDecoder(
@Nullable final ImageDecoder xmlDecoder,
final PlatformDecoder platformDecoder,
@Nullable Map<ImageFormat, ImageDecoder> customDecoders) {
mAnimatedGifDecoder = animatedGifDecoder;
mAnimatedWebPDecoder = animatedWebPDecoder;
mXmlDecoder = xmlDecoder;
mPlatformDecoder = platformDecoder;
mCustomDecoders = customDecoders;
mEnableEncodedImageColorSpaceUsage = Suppliers.BOOLEAN_FALSE;
this(
animatedGifDecoder,
animatedWebPDecoder,
xmlDecoder,
platformDecoder,
customDecoders,
Suppliers.BOOLEAN_FALSE);
}

public DefaultImageDecoder(
Expand Down

0 comments on commit 7896b72

Please sign in to comment.