From bfaf8705cccb15c0c2a7704b17ba011ddba8242f Mon Sep 17 00:00:00 2001 From: "thomasvl@gmail.com" Date: Wed, 10 Sep 2008 21:04:47 +0000 Subject: - Added GTMExceptionalInlines for dealing with cases where you get warning: variable 'r' might be clobbered by 'longjmp' or 'vfork' when using certain Apple inlined functions in @synchronized/@try blocks. - Updated to Xcode 3.1 so the GTM and iPhone project have the same baseline. The code should work in other version of xcode, but the projects and xcconfig files now use 3.1 features. - Added GTMABAddressBook which is a cocoa wrapper for the 'C' AddressBook APIs on the iPhone. - Added several set environment variable statements to RunIPhoneUnitTest.sh to encourage bugs to come out of the woodwork. --- Foundation/GTMGeometryUtils.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'Foundation/GTMGeometryUtils.h') diff --git a/Foundation/GTMGeometryUtils.h b/Foundation/GTMGeometryUtils.h index 9691ffc..855b97f 100644 --- a/Foundation/GTMGeometryUtils.h +++ b/Foundation/GTMGeometryUtils.h @@ -25,7 +25,8 @@ enum { GTMScaleProportionally = 0, // Fit proportionally GTMScaleToFit, // Forced fit (distort if necessary) - GTMScaleNone // Don't scale (clip) + GTMScaleNone, // Don't scale (clip) + GTMScaleToFillProportionally = 101 // Scale proportionally to fill area }; typedef NSUInteger GTMScaling; @@ -398,6 +399,27 @@ CG_INLINE NSRect GTMNSAlignRectangles(NSRect alignee, NSRect aligner, alignment)); } +/// Align a rectangle to another +// +// Args: +// scalee - rect to be scaled +// 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) { + + return GTMCGRectToNSRect( + GTMCGAlignRectangles( + GTMCGScaleRectangleToSize(GTMNSRectToCGRect(scalee), + GTMNSSizeToCGSize(scaler.size), + scaling), + GTMNSRectToCGRect(scaler), + alignment)); +} + /// Scale rectangle // // Args: -- cgit v1.2.3