1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added an overload for calling roundToInt with an int. Added a a Point::roundToInt method.

This commit is contained in:
jules 2014-06-14 11:32:02 +01:00
parent db02a89fda
commit 590cca9776
2 changed files with 8 additions and 0 deletions

View file

@ -364,6 +364,11 @@ inline int roundToInt (const FloatType value) noexcept
#endif
}
inline int roundToInt (int value) noexcept
{
return value;
}
#if JUCE_MSVC
#ifndef __INTEL_COMPILER
#pragma float_control (pop)

View file

@ -213,6 +213,9 @@ public:
/** Casts this point to a Point<double> object. */
Point<double> toDouble() const noexcept { return Point<double> (static_cast<double> (x), static_cast<double> (y)); }
/** Casts this point to a Point<int> object using roundToInt() to convert the values. */
Point<int> roundToInt() const noexcept { return Point<int> (juce::roundToInt (x), juce::roundToInt (y)); }
/** Returns the point as a string in the form "x, y". */
String toString() const { return String (x) + ", " + String (y); }