Created
May 28, 2011 16:34
-
-
Save novi/997013 to your computer and use it in GitHub Desktop.
CGRectIntegralの謎
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)testRect | |
{ | |
CGRect r = CGRectMake(1.222, 1.3333, 1, 1.000); | |
NSLog(@"%@", NSStringFromCGRect(r)); | |
NSLog(@"%@", NSStringFromCGRect(CGRectIntegral(r))); | |
NSLog(@"%@", NSStringFromCGRect(CGRectMake(floorf(r.origin.x), floorf(r.origin.y), floorf(r.size.width), floorf(r.size.height)))); | |
NSLog(@"%@", NSStringFromCGRect(CGRectMake(ceilf(r.origin.x), ceilf(r.origin.y), ceilf(r.size.width), ceilf(r.size.height)))); | |
STAssertTrue(CGRectEqualToRect(r, CGRectIntegral(r)), nil, nil); | |
} | |
// http://svn.gna.org/svn/gnustep/libs/opal/trunk/Source/OpalGraphics/CGGeometry.m | |
// GNUStep曰く結果はこれで正しい | |
/* | |
{{1.222, 1.3333}, {1, 1}} | |
{{1, 1}, {2, 2}} | |
{{1, 1}, {1, 1}} | |
{{2, 2}, {2, 1}} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment