Permalink
Browse files

Avoid atomic properties on iPhone platforms

  • Loading branch information...
1 parent dc64ee2 commit bc5d3188805be18ebd1cc00fda2e6e906c578ddd @royratcliffe committed Mar 5, 2010
Showing with 28 additions and 9 deletions.
  1. +15 −8 RRCausticColorMatcher.h
  2. +3 −0 RRCausticColorMatcher.m
  3. +10 −1 RRGlossCausticShader.h
View
@@ -27,6 +27,13 @@
#import <UIKit/UIKit.h>
#else
#import <AppKit/AppKit.h>
+#if !defined(NS_NONATOMIC_IPHONEONLY)
+ #if TARGET_OS_IPHONE
+ #define NS_NONATOMIC_IPHONEONLY nonatomic
+ #else
+ #define NS_NONATOMIC_IPHONEONLY
+ #endif
+#endif
#endif
@interface RRCausticColorMatcher : NSObject<NSCoding>
@@ -73,13 +80,13 @@
- (void)matchForHSB:(const CGFloat *)hsb caustic:(CGFloat *)outHSB;
// Does the work.
-@property(assign) CGFloat causticHue;
-@property(assign) CGFloat graySaturationThreshold;
-@property(assign) CGFloat causticSaturationForGrays;
-@property(assign) CGFloat redHueThreshold;
-@property(assign) CGFloat blueHueThreshold;
-@property(assign) CGFloat blueCausticHue;
-@property(assign) CGFloat causticFractionDomainFactor;
-@property(assign) CGFloat causticFractionRangeFactor;
+@property(assign, NS_NONATOMIC_IPHONEONLY) CGFloat causticHue;
+@property(assign, NS_NONATOMIC_IPHONEONLY) CGFloat graySaturationThreshold;
+@property(assign, NS_NONATOMIC_IPHONEONLY) CGFloat causticSaturationForGrays;
+@property(assign, NS_NONATOMIC_IPHONEONLY) CGFloat redHueThreshold;
+@property(assign, NS_NONATOMIC_IPHONEONLY) CGFloat blueHueThreshold;
+@property(assign, NS_NONATOMIC_IPHONEONLY) CGFloat blueCausticHue;
+@property(assign, NS_NONATOMIC_IPHONEONLY) CGFloat causticFractionDomainFactor;
+@property(assign, NS_NONATOMIC_IPHONEONLY) CGFloat causticFractionRangeFactor;
@end
View
@@ -55,6 +55,9 @@ - (NSColor *)matchForColor:(NSColor *)aColor
{
CGFloat hsba[4];
+ // The given colour, aColor, may not have an RGB triple hence not directly
+ // possible to convert to HSB; the conversion requires access to red, green
+ // and blue components. Start by moving the incoming colour to RGB space.
#if TARGET_OS_IPHONE
aColor = [aColor colorUsingColorSpaceModel:kCGColorSpaceModelRGB];
#else
View
@@ -27,6 +27,15 @@
#import <UIKit/UIKit.h>
#else
#import <AppKit/AppKit.h>
+// Be pedantic. Avoid atomic attributes on iPhone platforms. Note, Mac OS X
+// versions prior to 10.6 Snow Leopard do not define NS_NONATOMIC_IPHONEONLY.
+#if !defined(NS_NONATOMIC_IPHONEONLY)
+ #if TARGET_OS_IPHONE
+ #define NS_NONATOMIC_IPHONEONLY nonatomic
+ #else
+ #define NS_NONATOMIC_IPHONEONLY
+ #endif
+#endif
#endif
@class RRCausticColorMatcher;
@@ -97,6 +106,6 @@
// override the default caustic matching behaviour. Developers might want to
// customise the colour matching algorithmically as well as by tweaking
// parameters.
-@property(readonly) RRCausticColorMatcher *matcher;
+@property(readonly, NS_NONATOMIC_IPHONEONLY) RRCausticColorMatcher *matcher;
@end

0 comments on commit bc5d318

Please sign in to comment.