Fix some indentation issues
This commit is contained in:
parent
a883c63e9c
commit
938c2e0f3f
|
@ -54,11 +54,9 @@
|
|||
extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image);
|
||||
|
||||
#define dispatch_main_sync_safe(block)\
|
||||
if ([NSThread isMainThread])\
|
||||
{\
|
||||
if ([NSThread isMainThread]) {\
|
||||
block();\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
else {\
|
||||
dispatch_sync(dispatch_get_main_queue(), block);\
|
||||
}
|
||||
|
|
|
@ -13,33 +13,40 @@
|
|||
typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
|
||||
SDWebImageDownloaderLowPriority = 1 << 0,
|
||||
SDWebImageDownloaderProgressiveDownload = 1 << 1,
|
||||
|
||||
/**
|
||||
* By default, request prevent the of NSURLCache. With this flag, NSURLCache
|
||||
* is used with default policies.
|
||||
*/
|
||||
SDWebImageDownloaderUseNSURLCache = 1 << 2,
|
||||
|
||||
/**
|
||||
* Call completion block with nil image/imageData if the image was read from NSURLCache
|
||||
* (to be combined with `SDWebImageDownloaderUseNSURLCache`).
|
||||
*/
|
||||
|
||||
SDWebImageDownloaderIgnoreCachedResponse = 1 << 3,
|
||||
/**
|
||||
* In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for
|
||||
* extra time in background to let the request finish. If the background task expires the operation will be cancelled.
|
||||
*/
|
||||
|
||||
SDWebImageDownloaderContinueInBackground = 1 << 4,
|
||||
|
||||
/**
|
||||
* Handles cookies stored in NSHTTPCookieStore by setting
|
||||
* NSMutableURLRequest.HTTPShouldHandleCookies = YES;
|
||||
*/
|
||||
SDWebImageDownloaderHandleCookies = 1 << 5,
|
||||
|
||||
/**
|
||||
* Enable to allow untrusted SSL ceriticates.
|
||||
* Useful for testing purposes. Use with caution in production.
|
||||
*/
|
||||
SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6,
|
||||
|
||||
/**
|
||||
*
|
||||
* Put the image in the high priority queue.
|
||||
*/
|
||||
SDWebImageDownloaderHighPriority = 1 << 7,
|
||||
|
||||
|
@ -47,14 +54,15 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
|
|||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {
|
||||
SDWebImageDownloaderFIFOExecutionOrder,
|
||||
/**
|
||||
* Default value. All download operations will execute in queue style (first-in-first-out).
|
||||
*/
|
||||
SDWebImageDownloaderLIFOExecutionOrder
|
||||
SDWebImageDownloaderFIFOExecutionOrder,
|
||||
|
||||
/**
|
||||
* All download operations will execute in stack style (last-in-first-out).
|
||||
*/
|
||||
SDWebImageDownloaderLIFOExecutionOrder
|
||||
};
|
||||
|
||||
extern NSString *const SDWebImageDownloadStartNotification;
|
||||
|
|
|
@ -17,20 +17,24 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
|
|||
* This flag disable this blacklisting.
|
||||
*/
|
||||
SDWebImageRetryFailed = 1 << 0,
|
||||
|
||||
/**
|
||||
* By default, image downloads are started during UI interactions, this flags disable this feature,
|
||||
* leading to delayed download on UIScrollView deceleration for instance.
|
||||
*/
|
||||
SDWebImageLowPriority = 1 << 1,
|
||||
|
||||
/**
|
||||
* This flag disables on-disk caching
|
||||
*/
|
||||
SDWebImageCacheMemoryOnly = 1 << 2,
|
||||
|
||||
/**
|
||||
* This flag enables progressive download, the image is displayed progressively during download as a browser would do.
|
||||
* By default, the image is only displayed once completely downloaded.
|
||||
*/
|
||||
SDWebImageProgressiveDownload = 1 << 3,
|
||||
|
||||
/**
|
||||
* Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed.
|
||||
* The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation.
|
||||
|
@ -46,16 +50,19 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
|
|||
* extra time in background to let the request finish. If the background task expires the operation will be cancelled.
|
||||
*/
|
||||
SDWebImageContinueInBackground = 1 << 5,
|
||||
|
||||
/**
|
||||
* Handles cookies stored in NSHTTPCookieStore by setting
|
||||
* NSMutableURLRequest.HTTPShouldHandleCookies = YES;
|
||||
*/
|
||||
SDWebImageHandleCookies = 1 << 6,
|
||||
|
||||
/**
|
||||
* Enable to allow untrusted SSL ceriticates.
|
||||
* Useful for testing purposes. Use with caution in production.
|
||||
*/
|
||||
SDWebImageAllowInvalidSSLCertificates = 1 << 7,
|
||||
|
||||
/**
|
||||
* By default, image are loaded in the order they were queued. This flag move them to
|
||||
* the front of the queue and is loaded immediately instead of waiting for the current queue to be loaded (which
|
||||
|
@ -113,10 +120,8 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
[manager downloadWithURL:imageURL
|
||||
options:0
|
||||
progress:nil
|
||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
|
||||
{
|
||||
if (image)
|
||||
{
|
||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
|
||||
if (image) {
|
||||
// do something with image
|
||||
}
|
||||
}];
|
||||
|
@ -139,8 +144,7 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
*
|
||||
* @code
|
||||
|
||||
[[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url)
|
||||
{
|
||||
[[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url) {
|
||||
url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path];
|
||||
return [url absoluteString];
|
||||
}];
|
||||
|
|
|
@ -18,11 +18,9 @@ static void FreeImageData(void *info, const void *data, size_t size)
|
|||
|
||||
@implementation UIImage (WebP)
|
||||
|
||||
+ (UIImage *)sd_imageWithWebPData:(NSData *)data
|
||||
{
|
||||
+ (UIImage *)sd_imageWithWebPData:(NSData *)data {
|
||||
WebPDecoderConfig config;
|
||||
if (!WebPInitDecoderConfig(&config))
|
||||
{
|
||||
if (!WebPInitDecoderConfig(&config)) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -30,15 +28,13 @@ static void FreeImageData(void *info, const void *data, size_t size)
|
|||
config.options.use_threads = 1;
|
||||
|
||||
// Decode the WebP image data into a RGBA value array.
|
||||
if (WebPDecode(data.bytes, data.length, &config) != VP8_STATUS_OK)
|
||||
{
|
||||
if (WebPDecode(data.bytes, data.length, &config) != VP8_STATUS_OK) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
int width = config.input.width;
|
||||
int height = config.input.height;
|
||||
if (config.options.use_scaling)
|
||||
{
|
||||
if (config.options.use_scaling) {
|
||||
width = config.options.scaled_width;
|
||||
height = config.options.scaled_height;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
|
||||
|
||||
if (cell == nil)
|
||||
{
|
||||
if (cell == nil) {
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier]
|
||||
autorelease];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue