Merge pull request #2319 from dreampiggy/bugfix_5.x_image_cache_options
Bugfix 5.x image cache options
This commit is contained in:
commit
1f50833567
|
@ -31,24 +31,19 @@ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {
|
||||||
* images to a size compatible with the constrained memory of devices.
|
* images to a size compatible with the constrained memory of devices.
|
||||||
*/
|
*/
|
||||||
SDImageCacheScaleDownLargeImages = 1 << 3,
|
SDImageCacheScaleDownLargeImages = 1 << 3,
|
||||||
/**
|
|
||||||
* We usually don't apply transform on animated images as most transformers could not manage animated images.
|
|
||||||
* Use this flag to transform them anyway.
|
|
||||||
*/
|
|
||||||
SDImageCacheTransformAnimatedImage = 1 << 4,
|
|
||||||
/**
|
/**
|
||||||
* By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation.
|
* By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation.
|
||||||
* However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image.
|
* However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image.
|
||||||
*/
|
*/
|
||||||
SDImageCacheAvoidDecodeImage = 1 << 5,
|
SDImageCacheAvoidDecodeImage = 1 << 4,
|
||||||
/**
|
/**
|
||||||
* By default, we decode the animated image. This flag can force decode the first frame only and produece the static image.
|
* By default, we decode the animated image. This flag can force decode the first frame only and produece the static image.
|
||||||
*/
|
*/
|
||||||
SDImageCacheDecodeFirstFrameOnly = 1 << 6,
|
SDImageCacheDecodeFirstFrameOnly = 1 << 5,
|
||||||
/**
|
/**
|
||||||
* By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger `preloadAllAnimatedImageFrames = YES` after image load from disk cache
|
* By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger `preloadAllAnimatedImageFrames = YES` after image load from disk cache
|
||||||
*/
|
*/
|
||||||
SDImageCachePreloadAllFrames = 1 << 7
|
SDImageCachePreloadAllFrames = 1 << 6
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -588,7 +588,8 @@
|
||||||
if (options & SDWebImageQueryMemoryData) cacheOptions |= SDImageCacheQueryMemoryData;
|
if (options & SDWebImageQueryMemoryData) cacheOptions |= SDImageCacheQueryMemoryData;
|
||||||
if (options & SDWebImageQueryMemoryDataSync) cacheOptions |= SDImageCacheQueryMemoryDataSync;
|
if (options & SDWebImageQueryMemoryDataSync) cacheOptions |= SDImageCacheQueryMemoryDataSync;
|
||||||
if (options & SDWebImageQueryDiskDataSync) cacheOptions |= SDImageCacheQueryDiskDataSync;
|
if (options & SDWebImageQueryDiskDataSync) cacheOptions |= SDImageCacheQueryDiskDataSync;
|
||||||
if (options & SDWebImageTransformAnimatedImage) cacheOptions |= SDImageCacheTransformAnimatedImage;
|
if (options & SDWebImageScaleDownLargeImages) cacheOptions |= SDImageCacheScaleDownLargeImages;
|
||||||
|
if (options & SDWebImageAvoidDecodeImage) cacheOptions |= SDImageCacheAvoidDecodeImage;
|
||||||
if (options & SDWebImageDecodeFirstFrameOnly) cacheOptions |= SDImageCacheDecodeFirstFrameOnly;
|
if (options & SDWebImageDecodeFirstFrameOnly) cacheOptions |= SDImageCacheDecodeFirstFrameOnly;
|
||||||
if (options & SDWebImagePreloadAllFrames) cacheOptions |= SDImageCachePreloadAllFrames;
|
if (options & SDWebImagePreloadAllFrames) cacheOptions |= SDImageCachePreloadAllFrames;
|
||||||
return [self queryCacheOperationForKey:key options:cacheOptions context:context done:completionBlock];
|
return [self queryCacheOperationForKey:key options:cacheOptions context:context done:completionBlock];
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#endif
|
#endif
|
||||||
#import "NSImage+Compatibility.h"
|
#import "NSImage+Compatibility.h"
|
||||||
#import "UIImage+WebCache.h"
|
#import "UIImage+WebCache.h"
|
||||||
#import "SDWebImageDefine.h"
|
|
||||||
|
|
||||||
#define LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER);
|
#define LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER);
|
||||||
#define UNLOCK(lock) dispatch_semaphore_signal(lock);
|
#define UNLOCK(lock) dispatch_semaphore_signal(lock);
|
||||||
|
|
Loading…
Reference in New Issue