Permalink
Browse files

Fix CGFloat/float issue for 10.5 and 10.6

* Use an approach from the Cairo project, recommend to me
  by Eloy Duran via email.
  • Loading branch information...
1 parent 882e5f2 commit 52e91267f1bb55170f25195fb510b462bf84f7df @kelan committed Jul 17, 2011
Showing with 10 additions and 1 deletion.
  1. +10 −1 Code/YRKSpinningProgressIndicatorLayer.m
View
11 Code/YRKSpinningProgressIndicatorLayer.m
@@ -279,7 +279,15 @@ - (CGPoint)finAnchorPointForCurrentBounds
CGColorRef CGColorCreateFromNSColor(NSColor *nscolor)
{
- float components[4];
+// make this work with both 10.5 and 10.6 SDKs, based on a trick used
+// by Cairo, and recommened to me by Eloy Duran (via email)
+// http://lists.cairographics.org/archives/cairo-bugs/2009-December/003385.html
+#ifdef CGFLOAT_DEFINED
+#define yrkspil_float_t CGFloat
+#else
+#define yrkspil_float_t float
+#endif
+ yrkspil_float_t components[4];
NSColor *deviceColor = [nscolor colorUsingColorSpaceName: NSDeviceRGBColorSpace];
[deviceColor getRed: &components[0] green: &components[1] blue: &components[2] alpha: &components[3]];
@@ -288,6 +296,7 @@ CGColorRef CGColorCreateFromNSColor(NSColor *nscolor)
CGColorSpaceRelease(colorSpace);
return cgcolor;
+#undef yrkspil_float_t
}

0 comments on commit 52e9126

Please sign in to comment.