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.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Foundation/GTMGeometryUtils.m') diff --git a/Foundation/GTMGeometryUtils.m b/Foundation/GTMGeometryUtils.m index 9ac2933..07de80c 100644 --- a/Foundation/GTMGeometryUtils.m +++ b/Foundation/GTMGeometryUtils.m @@ -78,6 +78,8 @@ CGRect GTMCGAlignRectangles(CGRect alignee, CGRect aligner, GTMRectAlignment ali CGRect GTMCGScaleRectangleToSize(CGRect scalee, CGSize size, GTMScaling scaling) { switch (scaling) { + + case GTMScaleToFillProportionally: case GTMScaleProportionally: { CGFloat height = CGRectGetHeight(scalee); CGFloat width = CGRectGetWidth(scalee); @@ -85,12 +87,14 @@ CGRect GTMCGScaleRectangleToSize(CGRect scalee, CGSize size, GTMScaling scaling) (height > size.height || width > size.width)) { CGFloat horiz = size.width / width; CGFloat vert = size.height / height; - CGFloat newScale = horiz < vert ? horiz : vert; + BOOL expand = (scaling == GTMScaleToFillProportionally); + // We use the smaller scale unless expand is true. In that case, larger. + CGFloat newScale = ((horiz < vert) ^ expand) ? horiz : vert; scalee = GTMCGRectScale(scalee, newScale, newScale); } break; } - + case GTMScaleToFit: scalee.size = size; break; -- cgit v1.2.3