mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 06:40:38 +00:00
* Source/GSGuiPrivate.h: New rounding rounding function
GSRoundTowardsInfinity which is simply floor(x+0.5) * Source/NSBrowser.m: * Source/NSSliderCell.m: * Source/NSButtonCell.m: * Source/NSClipView.m: * Source/NSOutlineView.m: * Source/NSRulerView.m: Switch rint[f] to GSRoundTowardsInfinity git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33539 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0024ee69e2
commit
22bfbcc946
8 changed files with 45 additions and 19 deletions
|
@ -32,6 +32,7 @@
|
|||
|
||||
#import <Foundation/NSBundle.h>
|
||||
#include "GNUstepBase/preface.h"
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* Return the gnustep-gui bundle used to load gnustep-gui resources.
|
||||
|
@ -71,5 +72,21 @@ static inline NSString *GSGuiLocalizedString (NSString *key, NSString *comment)
|
|||
#endif
|
||||
#define NSLocalizedString(key,comment) GSGuiLocalizedString (key, comment)
|
||||
|
||||
/**
|
||||
* Rounds to the nearest integer, and in the case of ties, round to the
|
||||
* larger integer. This is the recommended rounding function for rounding
|
||||
* graphics points.
|
||||
*
|
||||
* For example:
|
||||
* GSRoundTowardsInfinity(0.8) == 1.0
|
||||
* GSRoundTowardsInfinity(0.5) == 1.0
|
||||
* GSRoundTowardsInfinity(0.1) == 0.0
|
||||
* GSRoundTowardsInfinity(-2.5) == -2.0
|
||||
*/
|
||||
static inline CGFloat GSRoundTowardsInfinity(CGFloat x)
|
||||
{
|
||||
return floor(x + 0.5);
|
||||
}
|
||||
|
||||
#endif /* _GNUstep_H_GSGuiPrivate */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue