Applied patch 1586499: wxCoordRound function

Centralises rounding and adds nearest-value rounding to
prntbase.cpp.
by Robert J. Lang


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-10-29 17:01:34 +00:00
parent 6ea48c514e
commit 6445acc783
11 changed files with 114 additions and 331 deletions

View File

@@ -658,6 +658,18 @@ typedef int wxCoord;
enum { wxDefaultCoord = -1 };
/* round-to-nearest (used in scaling) */
#ifdef __cplusplus
inline wxCoord wxCoordRound(const float& f)
{
return (f > 0) ? (wxCoord)(f + 0.5) : (f < 0) ? (wxCoord)(f - 0.5) : 0;
}
inline wxCoord wxCoordRound(const double& f)
{
return (f > 0) ? (wxCoord)(f + 0.5) : (f < 0) ? (wxCoord)(f - 0.5) : 0;
}
#endif
/* ---------------------------------------------------------------------------- */
/* define fixed length types */
/* ---------------------------------------------------------------------------- */