aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMGeometryUtils.h
diff options
context:
space:
mode:
authorGravatar thomasvl <thomasvl@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-05-09 18:53:09 +0000
committerGravatar thomasvl <thomasvl@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-05-09 18:53:09 +0000
commitf90bcf3263b80b96754977ddbd5309704cf817fb (patch)
tree585db4c1126cea3bd0ff9b338628d33febe36e59 /Foundation/GTMGeometryUtils.h
parente5c365c04b9f2f6d04b2c5bd828f39fab2882e7d (diff)
Flush out suppport for 64bit, GC support.
Added some more xcode configs related to the above. Removed some classes that the unittesting doesn't need (and aren't able to support 64bit). add base64, httpfetcher, and progress monitor stream.
Diffstat (limited to 'Foundation/GTMGeometryUtils.h')
-rw-r--r--Foundation/GTMGeometryUtils.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/Foundation/GTMGeometryUtils.h b/Foundation/GTMGeometryUtils.h
index 32c8745..a58ac13 100644
--- a/Foundation/GTMGeometryUtils.h
+++ b/Foundation/GTMGeometryUtils.h
@@ -19,15 +19,17 @@
// the License.
//
-#include <Foundation/Foundation.h>
+#import <Foundation/Foundation.h>
+#import "GTMDefines.h"
-typedef enum {
+enum {
GTMScaleProportionally = 0, // Fit proportionally
GTMScaleToFit, // Forced fit (distort if necessary)
GTMScaleNone // Don't scale (clip)
-} GTMScaling;
+};
+typedef NSUInteger GTMScaling;
-typedef enum {
+enum {
GTMRectAlignCenter = 0,
GTMRectAlignTop,
GTMRectAlignTopLeft,
@@ -37,7 +39,8 @@ typedef enum {
GTMRectAlignBottomLeft,
GTMRectAlignBottomRight,
GTMRectAlignRight
-} GTMRectAlignment;
+};
+typedef NSUInteger GTMRectAlignment;
#pragma mark Miscellaneous
@@ -49,10 +52,14 @@ typedef enum {
//
// Returns:
// Distance
-CG_INLINE float GTMDistanceBetweenPoints(NSPoint pt1, NSPoint pt2) {
- float dX = pt1.x - pt2.x;
- float dY = pt1.y - pt2.y;
+CG_INLINE CGFloat GTMDistanceBetweenPoints(NSPoint pt1, NSPoint pt2) {
+ CGFloat dX = pt1.x - pt2.x;
+ CGFloat dY = pt1.y - pt2.y;
+#if CGFLOAT_IS_DOUBLE
+ return sqrt(dX * dX + dY * dY);
+#else
return sqrtf(dX * dX + dY * dY);
+#endif
}
#pragma mark -
@@ -314,7 +321,7 @@ CG_INLINE CGRect GTMCGRectOfSize(CGSize size) {
//
// Returns:
// Converted Rect
-CG_INLINE NSRect GTMNSRectScale(NSRect inRect, float xScale, float yScale) {
+CG_INLINE NSRect GTMNSRectScale(NSRect inRect, CGFloat xScale, CGFloat yScale) {
return NSMakeRect(inRect.origin.x, inRect.origin.y,
inRect.size.width * xScale, inRect.size.height * yScale);
}
@@ -328,7 +335,7 @@ CG_INLINE NSRect GTMNSRectScale(NSRect inRect, float xScale, float yScale) {
//
// Returns:
// Converted Rect
-CG_INLINE CGRect GTMCGRectScale(CGRect inRect, float xScale, float yScale) {
+CG_INLINE CGRect GTMCGRectScale(CGRect inRect, CGFloat xScale, CGFloat yScale) {
return CGRectMake(inRect.origin.x, inRect.origin.y,
inRect.size.width * xScale, inRect.size.height * yScale);
}