aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMGeometryUtils.h
diff options
context:
space:
mode:
authorGravatar thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-10-22 19:16:19 +0000
committerGravatar thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-10-22 19:16:19 +0000
commit11938e47355bfbf3b81f1ff5b15f1222b83d4f47 (patch)
tree3794c78559472e4b2efe5eabc0e094d7c14a9743 /Foundation/GTMGeometryUtils.h
parent90eba8f973c0b77f36dc7084163ff0d43675a1a8 (diff)
- GTM_INLINE will make sure a function gets inlined, and provides a consistent
way for all GTM code to do it. - Added GTMDebugThreadValidation to allow you to enforce the fact that your code must run in the main thread in DEBUG builds. - Updated some internals of the iPhone unittesting so it doesn't double print the test descriptions, file names, or lines numbers of a test failure line. Also includes the test names in the error output. - Changed the xcconfigs so that know it's easier to set different settings at the different levels and not accidentally overwrite settings set at lower levels in the "settings collapse". Also tightened up warnings significantly. - Changed how gtm_unitTestExposedBindingsTestValues works. If you have an implementation of gtm_unitTestExposedBindingsTestValues in your own code you will need to update to the new way of calling. See implementations in GTMNSObject+BindingUnitTesting.m for details. - Added support for grabbing the build number for a particular OS in GTMSystemVersion and easily comparing it to known build numbers, and switched some types from in GTMSystemVersion from "int" to SInt32 to make 64 bit work better. - Added support for SnowLeopard (10A96). We build cleanly with the 10.6 SDKs and all radar checks were updated accordingly. Build All script was also updated to build on SnowLeopard if you have the SDK available. - Turned off building ppc64 GTM because the SnowLeopard SDK currently doesn't have ppc64 support, so SenTestCase isn't defined. This makes it impossible to build the ppc64 10.5 config on SnowLeopard. We have left the setting in the xcconfig for those of you who need it, but have disabled it in the GTM project settings. - Turned on stack smashing protection on the debug builds for all Leopard and above. - Added ability to easily do leak checking by defining the GTM_ENABLE_LEAKS environment variable. It isn't on by default because several of Apple's frameworks leak. You can work around these false positives by using the GTM_LEAKS_SYMBOLS_TO_IGNORE environment variable. Also if you turn on leaks make sure to turn off zombies by defining the GTM_DISABLE_ZOMBIES variable, otherwise every memory allocation you do will look like a leak.
Diffstat (limited to 'Foundation/GTMGeometryUtils.h')
-rw-r--r--Foundation/GTMGeometryUtils.h64
1 files changed, 32 insertions, 32 deletions
diff --git a/Foundation/GTMGeometryUtils.h b/Foundation/GTMGeometryUtils.h
index 855b97f..c3d6b1a 100644
--- a/Foundation/GTMGeometryUtils.h
+++ b/Foundation/GTMGeometryUtils.h
@@ -52,7 +52,7 @@ typedef NSUInteger GTMRectAlignment;
//
// Returns:
// point located in the middle of min X side of rect
-CG_INLINE CGPoint GTMCGMidMinX(CGRect rect) {
+GTM_INLINE CGPoint GTMCGMidMinX(CGRect rect) {
return CGPointMake(CGRectGetMinX(rect), CGRectGetMidY(rect));
}
@@ -63,7 +63,7 @@ CG_INLINE CGPoint GTMCGMidMinX(CGRect rect) {
//
// Returns:
// point located in the middle of max X side of rect
-CG_INLINE CGPoint GTMCGMidMaxX(CGRect rect) {
+GTM_INLINE CGPoint GTMCGMidMaxX(CGRect rect) {
return CGPointMake(CGRectGetMaxX(rect), CGRectGetMidY(rect));
}
@@ -74,7 +74,7 @@ CG_INLINE CGPoint GTMCGMidMaxX(CGRect rect) {
//
// Returns:
// point located in the middle of max Y side of rect
-CG_INLINE CGPoint GTMCGMidMaxY(CGRect rect) {
+GTM_INLINE CGPoint GTMCGMidMaxY(CGRect rect) {
return CGPointMake(CGRectGetMidX(rect), CGRectGetMaxY(rect));
}
@@ -85,7 +85,7 @@ CG_INLINE CGPoint GTMCGMidMaxY(CGRect rect) {
//
// Returns:
// point located in the middle of min Y side of rect
-CG_INLINE CGPoint GTMCGMidMinY(CGRect rect) {
+GTM_INLINE CGPoint GTMCGMidMinY(CGRect rect) {
return CGPointMake(CGRectGetMidX(rect), CGRectGetMinY(rect));
}
@@ -96,7 +96,7 @@ CG_INLINE CGPoint GTMCGMidMinY(CGRect rect) {
//
// Returns:
// point located in the center of rect
-CG_INLINE CGPoint GTMCGCenter(CGRect rect) {
+GTM_INLINE CGPoint GTMCGCenter(CGRect rect) {
return CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));
}
@@ -110,7 +110,7 @@ CG_INLINE CGPoint GTMCGCenter(CGRect rect) {
//
// Returns:
// size of rectangle
-CG_INLINE CGSize GTMCGRectSize(CGRect rect) {
+GTM_INLINE CGSize GTMCGRectSize(CGRect rect) {
return CGSizeMake(CGRectGetWidth(rect), CGRectGetHeight(rect));
}
@@ -121,7 +121,7 @@ CG_INLINE CGSize GTMCGRectSize(CGRect rect) {
//
// Returns:
// rectangle of size (origin 0,0)
-CG_INLINE CGRect GTMCGRectOfSize(CGSize size) {
+GTM_INLINE CGRect GTMCGRectOfSize(CGSize size) {
return CGRectMake(0.0f, 0.0f, size.width, size.height);
}
@@ -137,7 +137,7 @@ CG_INLINE CGRect GTMCGRectOfSize(CGSize size) {
//
// Returns:
// Converted Rect
-CG_INLINE CGRect GTMCGRectScale(CGRect inRect, CGFloat xScale, CGFloat yScale) {
+GTM_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);
}
@@ -171,7 +171,7 @@ CGRect GTMCGScaleRectangleToSize(CGRect scalee, CGSize size,
//
// Returns:
// Distance
-CG_INLINE CGFloat GTMCGDistanceBetweenPoints(CGPoint pt1, CGPoint pt2) {
+GTM_INLINE CGFloat GTMCGDistanceBetweenPoints(CGPoint pt1, CGPoint pt2) {
CGFloat dX = pt1.x - pt2.x;
CGFloat dY = pt1.y - pt2.y;
#if CGFLOAT_IS_DOUBLE
@@ -200,7 +200,7 @@ CG_INLINE CGFloat GTMCGDistanceBetweenPoints(CGPoint pt1, CGPoint pt2) {
//
// Returns:
// Converted NSPoint
-CG_INLINE NSPoint GTMCGPointToNSPoint(CGPoint inPoint) {
+GTM_INLINE NSPoint GTMCGPointToNSPoint(CGPoint inPoint) {
_GTMCompileAssert(sizeof(NSPoint) == sizeof(CGPoint), NSPoint_and_CGPoint_must_be_the_same_size);
union convertUnion {NSPoint ns; CGPoint cg;};
return ((union convertUnion *)&inPoint)->ns;
@@ -216,7 +216,7 @@ CG_INLINE NSPoint GTMCGPointToNSPoint(CGPoint inPoint) {
//
// Returns:
// Converted CGPoint
-CG_INLINE CGPoint GTMNSPointToCGPoint(NSPoint inPoint) {
+GTM_INLINE CGPoint GTMNSPointToCGPoint(NSPoint inPoint) {
_GTMCompileAssert(sizeof(NSPoint) == sizeof(CGPoint), NSPoint_and_CGPoint_must_be_the_same_size);
union convertUnion {NSPoint ns; CGPoint cg;};
return ((union convertUnion *)&inPoint)->cg;
@@ -235,7 +235,7 @@ CG_INLINE CGPoint GTMNSPointToCGPoint(NSPoint inPoint) {
//
// Returns:
// Converted NSRect
-CG_INLINE NSRect GTMCGRectToNSRect(CGRect inRect) {
+GTM_INLINE NSRect GTMCGRectToNSRect(CGRect inRect) {
_GTMCompileAssert(sizeof(NSRect) == sizeof(CGRect), NSRect_and_CGRect_must_be_the_same_size);
union convertUnion {NSRect ns; CGRect cg;};
return ((union convertUnion *)&inRect)->ns;
@@ -251,7 +251,7 @@ CG_INLINE NSRect GTMCGRectToNSRect(CGRect inRect) {
//
// Returns:
// Converted CGRect
-CG_INLINE CGRect GTMNSRectToCGRect(NSRect inRect) {
+GTM_INLINE CGRect GTMNSRectToCGRect(NSRect inRect) {
_GTMCompileAssert(sizeof(NSRect) == sizeof(CGRect), NSRect_and_CGRect_must_be_the_same_size);
union convertUnion {NSRect ns; CGRect cg;};
return ((union convertUnion *)&inRect)->cg;
@@ -268,7 +268,7 @@ CG_INLINE CGRect GTMNSRectToCGRect(NSRect inRect) {
//
// Returns:
// Converted NSSize
-CG_INLINE NSSize GTMCGSizeToNSSize(CGSize inSize) {
+GTM_INLINE NSSize GTMCGSizeToNSSize(CGSize inSize) {
_GTMCompileAssert(sizeof(NSSize) == sizeof(CGSize), NSSize_and_CGSize_must_be_the_same_size);
union convertUnion {NSSize ns; CGSize cg;};
return ((union convertUnion *)&inSize)->ns;
@@ -281,7 +281,7 @@ CG_INLINE NSSize GTMCGSizeToNSSize(CGSize inSize) {
//
// Returns:
// Converted CGSize
-CG_INLINE CGSize GTMNSSizeToCGSize(NSSize inSize) {
+GTM_INLINE CGSize GTMNSSizeToCGSize(NSSize inSize) {
_GTMCompileAssert(sizeof(NSSize) == sizeof(CGSize), NSSize_and_CGSize_must_be_the_same_size);
union convertUnion {NSSize ns; CGSize cg;};
return ((union convertUnion *)&inSize)->cg;
@@ -297,7 +297,7 @@ CG_INLINE CGSize GTMNSSizeToCGSize(NSSize inSize) {
//
// Returns:
// point located in the middle of min X side of rect
-CG_INLINE NSPoint GTMNSMidMinX(NSRect rect) {
+GTM_INLINE NSPoint GTMNSMidMinX(NSRect rect) {
return NSMakePoint(NSMinX(rect), NSMidY(rect));
}
@@ -308,7 +308,7 @@ CG_INLINE NSPoint GTMNSMidMinX(NSRect rect) {
//
// Returns:
// point located in the middle of max X side of rect
-CG_INLINE NSPoint GTMNSMidMaxX(NSRect rect) {
+GTM_INLINE NSPoint GTMNSMidMaxX(NSRect rect) {
return NSMakePoint(NSMaxX(rect), NSMidY(rect));
}
@@ -319,7 +319,7 @@ CG_INLINE NSPoint GTMNSMidMaxX(NSRect rect) {
//
// Returns:
// point located in the middle of max Y side of rect
-CG_INLINE NSPoint GTMNSMidMaxY(NSRect rect) {
+GTM_INLINE NSPoint GTMNSMidMaxY(NSRect rect) {
return NSMakePoint(NSMidX(rect), NSMaxY(rect));
}
@@ -330,7 +330,7 @@ CG_INLINE NSPoint GTMNSMidMaxY(NSRect rect) {
//
// Returns:
// point located in the middle of min Y side of rect
-CG_INLINE NSPoint GTMNSMidMinY(NSRect rect) {
+GTM_INLINE NSPoint GTMNSMidMinY(NSRect rect) {
return NSMakePoint(NSMidX(rect), NSMinY(rect));
}
@@ -341,7 +341,7 @@ CG_INLINE NSPoint GTMNSMidMinY(NSRect rect) {
//
// Returns:
// point located in the center of rect
-CG_INLINE NSPoint GTMNSCenter(NSRect rect) {
+GTM_INLINE NSPoint GTMNSCenter(NSRect rect) {
return NSMakePoint(NSMidX(rect), NSMidY(rect));
}
@@ -355,7 +355,7 @@ CG_INLINE NSPoint GTMNSCenter(NSRect rect) {
//
// Returns:
// size of rectangle
-CG_INLINE NSSize GTMNSRectSize(NSRect rect) {
+GTM_INLINE NSSize GTMNSRectSize(NSRect rect) {
return NSMakeSize(NSWidth(rect), NSHeight(rect));
}
@@ -366,7 +366,7 @@ CG_INLINE NSSize GTMNSRectSize(NSRect rect) {
//
// Returns:
// rectangle of size (origin 0,0)
-CG_INLINE NSRect GTMNSRectOfSize(NSSize size) {
+GTM_INLINE NSRect GTMNSRectOfSize(NSSize size) {
return NSMakeRect(0.0f, 0.0f, size.width, size.height);
}
@@ -382,7 +382,7 @@ CG_INLINE NSRect GTMNSRectOfSize(NSSize size) {
//
// Returns:
// Converted Rect
-CG_INLINE NSRect GTMNSRectScale(NSRect inRect, CGFloat xScale, CGFloat yScale) {
+GTM_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);
}
@@ -392,8 +392,8 @@ CG_INLINE NSRect GTMNSRectScale(NSRect inRect, CGFloat xScale, CGFloat yScale) {
// Args:
// alignee - rect to be aligned
// aligner - rect to be aligned from
-CG_INLINE NSRect GTMNSAlignRectangles(NSRect alignee, NSRect aligner,
- GTMRectAlignment alignment) {
+GTM_INLINE NSRect GTMNSAlignRectangles(NSRect alignee, NSRect aligner,
+ GTMRectAlignment alignment) {
return GTMCGRectToNSRect(GTMCGAlignRectangles(GTMNSRectToCGRect(alignee),
GTMNSRectToCGRect(aligner),
alignment));
@@ -406,10 +406,10 @@ CG_INLINE NSRect GTMNSAlignRectangles(NSRect alignee, NSRect aligner,
// scaler - rect to scale to
// scaling - way to scale the rectangle
// alignment - way to align the scaled rectangle
-CG_INLINE NSRect GTMNSScaleRectToRect(NSRect scalee,
- NSRect scaler,
- GTMScaling scaling,
- GTMRectAlignment alignment) {
+GTM_INLINE NSRect GTMNSScaleRectToRect(NSRect scalee,
+ NSRect scaler,
+ GTMScaling scaling,
+ GTMRectAlignment alignment) {
return GTMCGRectToNSRect(
GTMCGAlignRectangles(
@@ -426,8 +426,8 @@ CG_INLINE NSRect GTMNSScaleRectToRect(NSRect scalee,
// scalee - rect to be scaled
// size - size to scale to
// scaling - way to scale the rectangle
-CG_INLINE NSRect GTMNSScaleRectangleToSize(NSRect scalee, NSSize size,
- GTMScaling scaling) {
+GTM_INLINE NSRect GTMNSScaleRectangleToSize(NSRect scalee, NSSize size,
+ GTMScaling scaling) {
return GTMCGRectToNSRect(GTMCGScaleRectangleToSize(GTMNSRectToCGRect(scalee),
GTMNSSizeToCGSize(size),
scaling));
@@ -444,7 +444,7 @@ CG_INLINE NSRect GTMNSScaleRectangleToSize(NSRect scalee, NSSize size,
//
// Returns:
// Distance
-CG_INLINE CGFloat GTMNSDistanceBetweenPoints(NSPoint pt1, NSPoint pt2) {
+GTM_INLINE CGFloat GTMNSDistanceBetweenPoints(NSPoint pt1, NSPoint pt2) {
return GTMCGDistanceBetweenPoints(GTMNSPointToCGPoint(pt1),
GTMNSPointToCGPoint(pt2));
}