Do not enable webp when not explicitly activated by a macro (fix #415)

This commit is contained in:
Olivier Poitrey 2013-06-10 21:37:05 +02:00
parent 90d120258e
commit 5ecb8d56af
4 changed files with 8 additions and 0 deletions

View File

@ -806,6 +806,7 @@
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1", "DEBUG=1",
"SD_WEBP=1",
"$(inherited)", "$(inherited)",
); );
GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_SYMBOLS_PRIVATE_EXTERN = NO;
@ -837,6 +838,7 @@
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)"; ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
GCC_PREPROCESSOR_DEFINITIONS = "SD_WEBP=1";
GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;

View File

@ -25,10 +25,12 @@
image = [[UIImage alloc] initWithData:data]; image = [[UIImage alloc] initWithData:data];
} }
#ifdef SD_WEBP
if (!image) // TODO: detect webp signature if (!image) // TODO: detect webp signature
{ {
image = [UIImage sd_imageWithWebPData:data]; image = [UIImage sd_imageWithWebPData:data];
} }
#endif
return image; return image;
} }

View File

@ -6,6 +6,7 @@
// Copyright (c) 2013 Dailymotion. All rights reserved. // Copyright (c) 2013 Dailymotion. All rights reserved.
// //
#ifdef SD_WEBP
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface UIImage (WebP) @interface UIImage (WebP)
@ -13,3 +14,4 @@
+ (UIImage *)sd_imageWithWebPData:(NSData *)data; + (UIImage *)sd_imageWithWebPData:(NSData *)data;
@end @end
#endif

View File

@ -6,6 +6,7 @@
// Copyright (c) 2013 Dailymotion. All rights reserved. // Copyright (c) 2013 Dailymotion. All rights reserved.
// //
#ifdef SD_WEBP
#import "UIImage+WebP.h" #import "UIImage+WebP.h"
#import "webp/decode.h" #import "webp/decode.h"
@ -60,3 +61,4 @@ static void FreeImageData(void *info, const void *data, size_t size)
} }
@end @end
#endif