Skip to content

Commit

Permalink
minor CWCenteredRect() refactoring in multiply by 0.5 instead of divi…
Browse files Browse the repository at this point in the history
…de by 2
  • Loading branch information
Machx committed Feb 10, 2012
1 parent 378756b commit 9beb73a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Source/CWGraphicsFoundation.m
Expand Up @@ -29,15 +29,6 @@ of this software and associated documentation files (the "Software"), to deal

#import "CWGraphicsFoundation.h"

CGRect CWCenteredRect(CGRect smallRect, CGRect largeRect)
{
CGRect centeredRect;
centeredRect.size = smallRect.size;
centeredRect.origin.x = (largeRect.size.width - smallRect.size.width) / 2.0;
centeredRect.origin.y = (largeRect.size.height - smallRect.size.height) / 2.0;
return centeredRect;
}

/**
Easy way to return the CGContextRef inside a NSView
*/
Expand All @@ -50,6 +41,15 @@ inline CGContextRef CWCurrentCGContext()
#endif
}

CGRect CWCenteredRect(CGRect smallRect, CGRect largeRect)
{
CGRect centeredRect;
centeredRect.size = smallRect.size;
centeredRect.origin.x = (largeRect.size.width - smallRect.size.width) * 0.5;
centeredRect.origin.y = (largeRect.size.height - smallRect.size.height) * 0.5;
return centeredRect;
}

/**
Adds a rounded rect path to a CGContextRef
*/
Expand Down

0 comments on commit 9beb73a

Please sign in to comment.