Fix the progressive decoding bug on macOS. Including image orientation & SDAnimatedimageView

This commit is contained in:
DreamPiggy 2018-05-21 14:56:55 +08:00
parent 0a0bdc92db
commit a34133b864
2 changed files with 4 additions and 1 deletions

View File

@ -46,7 +46,7 @@
// AppKit design is different from UIKit. Where CGImage based image rep does not respect to any orientation. Only data based image rep which contains the EXIF metadata can automatically detect orientation.
// This should be nonnull, until the memory is exhausted cause `CGBitmapContextCreate` failed.
CGImageRef rotatedCGImage = [SDImageCoderHelper CGImageCreateDecoded:cgImage orientation:orientation];
imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
imageRep = [[NSBitmapImageRep alloc] initWithCGImage:rotatedCGImage];
CGImageRelease(rotatedCGImage);
} else {
imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];

View File

@ -322,6 +322,9 @@ dispatch_semaphore_signal(self->_lock);
}
[self.layer setNeedsDisplay];
#if SD_MAC
[self.layer displayIfNeeded]; // macOS's imageViewLayer is not equal to self.layer. But `[super setImage:]` will impliedly mark it needsDisplay. We call `[self.layer displayIfNeeded]` to immediately refresh the imageViewLayer to avoid flashing
#endif
}
}