| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/range/range.h" | 5 #include "ui/gfx/range/range.h" |
| 6 | 6 |
| 7 #include <inttypes.h> |
| 8 |
| 7 #include <algorithm> | 9 #include <algorithm> |
| 8 #include <limits> | 10 #include <limits> |
| 9 | 11 |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 11 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 12 | 14 |
| 13 namespace gfx { | 15 namespace gfx { |
| 14 | 16 |
| 15 Range::Range() | 17 Range::Range() |
| 16 : start_(0), | 18 : start_(0), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 uint32_t min = std::max(GetMin(), range.GetMin()); | 72 uint32_t min = std::max(GetMin(), range.GetMin()); |
| 71 uint32_t max = std::min(GetMax(), range.GetMax()); | 73 uint32_t max = std::min(GetMax(), range.GetMax()); |
| 72 | 74 |
| 73 if (min >= max) // No intersection. | 75 if (min >= max) // No intersection. |
| 74 return InvalidRange(); | 76 return InvalidRange(); |
| 75 | 77 |
| 76 return Range(min, max); | 78 return Range(min, max); |
| 77 } | 79 } |
| 78 | 80 |
| 79 std::string Range::ToString() const { | 81 std::string Range::ToString() const { |
| 80 return base::StringPrintf("{%d,%d}", start(), end()); | 82 return base::StringPrintf("{%" PRIu32 ",%" PRIu32 "}", start(), end()); |
| 81 } | 83 } |
| 82 | 84 |
| 83 std::ostream& operator<<(std::ostream& os, const Range& range) { | 85 std::ostream& operator<<(std::ostream& os, const Range& range) { |
| 84 return os << range.ToString(); | 86 return os << range.ToString(); |
| 85 } | 87 } |
| 86 | 88 |
| 87 } // namespace gfx | 89 } // namespace gfx |
| OLD | NEW |