The poster image should not trigger a frameChange callback

This commit is contained in:
DreamPiggy 2022-12-26 18:50:05 +08:00
parent 3312bf5e67
commit b5db7fac68
1 changed files with 2 additions and 4 deletions

View File

@ -145,18 +145,16 @@
if (!self.currentFrame && [self.animatedProvider isKindOfClass:[UIImage class]]) { if (!self.currentFrame && [self.animatedProvider isKindOfClass:[UIImage class]]) {
UIImage *image = (UIImage *)self.animatedProvider; UIImage *image = (UIImage *)self.animatedProvider;
// Use the poster image if available // Cache the poster image if available, but should not callback to avoid caller thread issues
#if SD_MAC #if SD_MAC
UIImage *posterFrame = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp]; UIImage *posterFrame = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];
#else #else
UIImage *posterFrame = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation]; UIImage *posterFrame = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation];
#endif #endif
if (posterFrame) { if (posterFrame) {
self.currentFrame = posterFrame;
SD_LOCK(self->_lock); SD_LOCK(self->_lock);
self.frameBuffer[@(self.currentFrameIndex)] = self.currentFrame; self.frameBuffer[@(self.currentFrameIndex)] = posterFrame;
SD_UNLOCK(self->_lock); SD_UNLOCK(self->_lock);
[self handleFrameChange];
} }
} }