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:
@@ -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 */
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user