1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-25 02:04:23 +00:00

Fixed some obscure rounding errors in Rectangle.

This commit is contained in:
jules 2013-07-30 17:16:56 +01:00
parent 32c98223ac
commit 8c7a35addb

View file

@ -698,10 +698,10 @@ public:
template <typename IntType>
Rectangle<IntType> getSmallestIntegerContainerWithType() const noexcept
{
const IntType x1 = static_cast <IntType> (std::floor (static_cast<float> (pos.x)));
const IntType y1 = static_cast <IntType> (std::floor (static_cast<float> (pos.y)));
const IntType x2 = static_cast <IntType> (std::ceil (static_cast<float> (pos.x + w)));
const IntType y2 = static_cast <IntType> (std::ceil (static_cast<float> (pos.y + h)));
const IntType x1 = static_cast<IntType> (std::floor (pos.x));
const IntType y1 = static_cast<IntType> (std::floor (pos.y));
const IntType x2 = static_cast<IntType> (std::ceil (pos.x + w));
const IntType y2 = static_cast<IntType> (std::ceil (pos.y + h));
return Rectangle<IntType> (x1, y1, x2 - x1, y2 - y1);
}