Skip to content

Commit c18c2c8

Browse files
committed
Fix the logic for Animated WebP images which contains a subsequence blend from the first frame, impact the SDAnimatedImage
1 parent e5c9608 commit c18c2c8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

SDWebImageWebPCoder/Classes/SDImageWebPCoder.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ @interface SDWebPCoderFrame : NSObject
4646
@property (nonatomic, assign) NSUInteger offsetY; // Frame origin.y in canvas (left-bottom based)
4747
@property (nonatomic, assign) BOOL hasAlpha; // Whether frame contains alpha
4848
@property (nonatomic, assign) BOOL isFullSize; // Whether frame size is equal to canvas size
49-
@property (nonatomic, assign) WebPMuxAnimBlend blend; // Frame dispose method
50-
@property (nonatomic, assign) WebPMuxAnimDispose dispose; // Frame blend operation
49+
@property (nonatomic, assign) BOOL shouldBlend; // Frame dispose method
50+
@property (nonatomic, assign) BOOL shouldDispose; // Frame blend operation
5151
@property (nonatomic, assign) NSUInteger blendFromIndex; // The nearest previous frame index which blend mode is WEBP_MUX_BLEND
5252

5353
@end
@@ -719,20 +719,20 @@ - (BOOL)scanAndCheckFramesValidWithDemuxer:(WebPDemuxer *)demuxer {
719719
frame.width = iter.width;
720720
frame.height = iter.height;
721721
frame.hasAlpha = iter.has_alpha;
722-
frame.dispose = iter.dispose_method;
723-
frame.blend = iter.blend_method;
722+
frame.shouldDispose = iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND;
723+
frame.shouldBlend = iter.blend_method == WEBP_MUX_BLEND;
724724
frame.offsetX = iter.x_offset;
725725
frame.offsetY = canvasHeight - iter.y_offset - iter.height;
726726

727727
BOOL sizeEqualsToCanvas = (iter.width == canvasWidth && iter.height == canvasHeight);
728728
BOOL offsetIsZero = (iter.x_offset == 0 && iter.y_offset == 0);
729729
frame.isFullSize = (sizeEqualsToCanvas && offsetIsZero);
730730

731-
if ((!frame.blend || !frame.hasAlpha) && frame.isFullSize) {
731+
if ((!frame.shouldBlend || !frame.hasAlpha) && frame.isFullSize) {
732732
lastBlendIndex = iterIndex;
733733
frame.blendFromIndex = iterIndex;
734734
} else {
735-
if (frame.dispose && frame.isFullSize) {
735+
if (frame.shouldDispose && frame.isFullSize) {
736736
frame.blendFromIndex = lastBlendIndex;
737737
lastBlendIndex = iterIndex + 1;
738738
} else {

0 commit comments

Comments
 (0)