Index: ui/gfx/range/range_f.cc |
diff --git a/ui/gfx/range/range_f.cc b/ui/gfx/range/range_f.cc |
index 665dc8b6f29aa1332415e5b1b6c2803691e2313e..b3bfc6956927b8cf0110b9376506b168585162ce 100644 |
--- a/ui/gfx/range/range_f.cc |
+++ b/ui/gfx/range/range_f.cc |
@@ -8,67 +8,12 @@ |
#include <algorithm> |
#include <cmath> |
-#include <limits> |
#include "base/format_macros.h" |
#include "base/strings/stringprintf.h" |
namespace gfx { |
-RangeF::RangeF() |
- : start_(0.0f), |
- end_(0.0f) { |
-} |
- |
-RangeF::RangeF(float start, float end) |
- : start_(start), |
- end_(end) { |
-} |
- |
-RangeF::RangeF(float position) |
- : start_(position), |
- end_(position) { |
-} |
- |
-// static |
-const RangeF RangeF::InvalidRange() { |
- return RangeF(std::numeric_limits<float>::max()); |
-} |
- |
-bool RangeF::IsValid() const { |
- return *this != InvalidRange(); |
-} |
- |
-float RangeF::GetMin() const { |
- return std::min(start(), end()); |
-} |
- |
-float RangeF::GetMax() const { |
- return std::max(start(), end()); |
-} |
- |
-bool RangeF::operator==(const RangeF& other) const { |
- return start() == other.start() && end() == other.end(); |
-} |
- |
-bool RangeF::operator!=(const RangeF& other) const { |
- return !(*this == other); |
-} |
- |
-bool RangeF::EqualsIgnoringDirection(const RangeF& other) const { |
- return GetMin() == other.GetMin() && GetMax() == other.GetMax(); |
-} |
- |
-bool RangeF::Intersects(const RangeF& range) const { |
- return IsValid() && range.IsValid() && |
- !(range.GetMax() < GetMin() || range.GetMin() >= GetMax()); |
-} |
- |
-bool RangeF::Contains(const RangeF& range) const { |
- return IsValid() && range.IsValid() && |
- GetMin() <= range.GetMin() && range.GetMax() <= GetMax(); |
-} |
- |
RangeF RangeF::Intersect(const RangeF& range) const { |
float min = std::max(GetMin(), range.GetMin()); |
float max = std::min(GetMax(), range.GetMax()); |
@@ -85,21 +30,20 @@ RangeF RangeF::Intersect(const Range& range) const { |
} |
Range RangeF::Floor() const { |
- size_t start = start_ > 0.0f ? static_cast<size_t>(std::floor(start_)) : 0; |
- size_t end = end_ > 0.0f ? static_cast<size_t>(std::floor(end_)) : 0; |
+ uint32_t start = start_ > 0 ? static_cast<uint32_t>(std::floor(start_)) : 0; |
+ uint32_t end = end_ > 0 ? static_cast<uint32_t>(std::floor(end_)) : 0; |
return Range(start, end); |
} |
Range RangeF::Ceil() const { |
- size_t start = start_ > 0.0f ? static_cast<size_t>(std::ceil(start_)) : 0; |
- size_t end = end_ > 0.0f ? static_cast<size_t>(std::ceil(end_)) : 0; |
+ uint32_t start = start_ > 0 ? static_cast<uint32_t>(std::ceil(start_)) : 0; |
+ uint32_t end = end_ > 0 ? static_cast<uint32_t>(std::ceil(end_)) : 0; |
return Range(start, end); |
} |
Range RangeF::Round() const { |
- size_t start = |
- start_ > 0.0f ? static_cast<size_t>(std::floor(start_ + 0.5f)) : 0; |
- size_t end = end_ > 0.0f ? static_cast<size_t>(std::floor(end_ + 0.5f)) : 0; |
+ uint32_t start = start_ > 0 ? static_cast<uint32_t>(std::round(start_)) : 0; |
+ uint32_t end = end_ > 0 ? static_cast<uint32_t>(std::round(end_)) : 0; |
return Range(start, end); |
} |