gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Graphics Rounding (was Re: Pixel-aligned autoresizing)


From: Eric Wasylishen
Subject: Re: Graphics Rounding (was Re: Pixel-aligned autoresizing)
Date: Tue, 12 Jul 2011 15:18:24 -0600

Hi,
I committed the change which I proposed earlier, introducing the following in 
GSGuiPrivate.h:

/**
 * 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);
}

and switching uses of rint[f] to this function. The jumping buttons in 
SimpleAgenda are fixed now.

Eric


reply via email to

[Prev in Thread] Current Thread [Next in Thread]