diff options
author | thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-01-09 20:34:30 +0000 |
---|---|---|
committer | thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-01-09 20:34:30 +0000 |
commit | 4fd103b5de98d2f469b982677ea389e7ee7d64b3 (patch) | |
tree | d0eb379fdc78996bc2e201515d26c7521d1fc8dc /AppKit/GTMNSImage+Scaling.m | |
parent | 84d1232477f398339e48ea504c45048e9328ef9b (diff) |
- turned off _debug framework support in tests since we now capture a lot more
in log validation.
- Added GTM_SUPPORT_GC for controlling the inclusion of GC related code.
- If you are using GTMUnitTestDevLog, it also tries to capture logs from
NSAssert.
- Added GTM_FOREACH_OBJECT/GTM_FOREACH_KEY that uses NSEnumerator and
objectEnumerator/keyEnumerator on 10.4, but on 10.5+/iPhone uses
FastEnumeration.
- GTMNSWorkspace+Running gives a variety of ways of determining the attributes
of running processes.
Diffstat (limited to 'AppKit/GTMNSImage+Scaling.m')
-rw-r--r-- | AppKit/GTMNSImage+Scaling.m | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/AppKit/GTMNSImage+Scaling.m b/AppKit/GTMNSImage+Scaling.m index 5f31190..8283b29 100644 --- a/AppKit/GTMNSImage+Scaling.m +++ b/AppKit/GTMNSImage+Scaling.m @@ -36,8 +36,7 @@ CGFloat repDistance = CGFLOAT_MAX; NSImageRep *thisRep; - NSEnumerator *repEnum = [reps objectEnumerator]; - while ((thisRep = [repEnum nextObject])) { + GTM_FOREACH_OBJECT(thisRep, reps) { CGFloat thisDistance; thisDistance = MIN(size.width - [thisRep size].width, size.height - [thisRep size].height); @@ -62,8 +61,7 @@ NSArray *reps = [self representations]; NSImageRep *thisRep; - NSEnumerator *repEnum = [reps objectEnumerator]; - while ((thisRep = [repEnum nextObject])) { + GTM_FOREACH_OBJECT(thisRep, reps) { if (NSEqualSizes([thisRep size], size)) { return thisRep; } @@ -155,12 +153,18 @@ } - (void)gtm_removeRepresentationsLargerThanSize:(NSSize)size { - NSEnumerator *e = [[self representations] reverseObjectEnumerator]; + NSMutableArray *repsToRemove = [NSMutableArray array]; NSImageRep *thisRep; - while((thisRep = [e nextObject]) ) { + // Remove them in a second loop so we don't change things will doing the + // initial loop. + GTM_FOREACH_OBJECT(thisRep, [self representations]) { if ([thisRep size].width > size.width - && [thisRep size].height > size.height) - [self removeRepresentation:thisRep]; + && [thisRep size].height > size.height) { + [repsToRemove addObject:thisRep]; + } + } + GTM_FOREACH_OBJECT(thisRep, repsToRemove) { + [self removeRepresentation:thisRep]; } } |