From ac719faec84637b1d3145be82f21467230687e0c Mon Sep 17 00:00:00 2001 From: Brandon Li Date: Thu, 24 Jun 2021 16:20:33 -0400 Subject: [PATCH] Decode alternative image types in ASImageNode at render time --- Cartfile | 2 +- Cartfile.resolved | 6 +++--- Source/ASImageNode.mm | 11 +++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Cartfile b/Cartfile index ea145be2c..43ee55ada 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ -github "pinterest/PINRemoteImage" "3.0.0-beta.14" +github "pinterest/PINRemoteImage" "3.0.3" github "pinterest/PINCache" "3.0.1-beta.7" diff --git a/Cartfile.resolved b/Cartfile.resolved index 640420c35..b701ca63b 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -git "https://chromium.googlesource.com/webm/libwebp" "v0.6.0" +git "https://chromium.googlesource.com/webm/libwebp" "v1.1.0" github "pinterest/PINCache" "3.0.1-beta.7" -github "pinterest/PINOperation" "1.1.2" -github "pinterest/PINRemoteImage" "3.0.0-beta.14" +github "pinterest/PINOperation" "1.2.1" +github "pinterest/PINRemoteImage" "3.0.3" diff --git a/Source/ASImageNode.mm b/Source/ASImageNode.mm index 95ac20143..33e00ed01 100644 --- a/Source/ASImageNode.mm +++ b/Source/ASImageNode.mm @@ -12,6 +12,7 @@ #import #import +#import #import #import #import @@ -30,6 +31,11 @@ // TODO: It would be nice to remove this dependency; it's the only subclass using more than +FrameworkSubclasses.h #import +#if AS_PIN_REMOTE_IMAGE +#import +#import +#endif + typedef void (^ASImageNodeDrawParametersBlock)(ASWeakMapEntry *entry); @interface ASImageNodeDrawParameters : NSObject { @@ -362,6 +368,11 @@ + (UIImage *)displayWithParameters:(id)parameter isCancelled:(NS_NOESC BOOL hasValidCropBounds = cropEnabled && !CGRectIsEmpty(cropDisplayBounds); CGRect bounds = (hasValidCropBounds ? cropDisplayBounds : drawParameterBounds); +#if PIN_TARGET_IOS && AS_PIN_REMOTE_IMAGE + if (image.pin_encodedImageData) { + image = [image pin_decodedImageUsingCustomDecodersWithSize:bounds.size]; + } +#endif ASDisplayNodeAssert(contentsScale > 0, @"invalid contentsScale at display time");