Chromium Code Reviews| Index: ui/gfx/safe_integer_conversions.cc |
| diff --git a/ui/gfx/safe_floor_ceil.cc b/ui/gfx/safe_integer_conversions.cc |
| similarity index 78% |
| rename from ui/gfx/safe_floor_ceil.cc |
| rename to ui/gfx/safe_integer_conversions.cc |
| index c8ac9e1c9e524e8508fcdb0ac3f0bc4a50e5cd14..cdb69e91adad0cf988abe4dffbfcd583e1695d4a 100644 |
| --- a/ui/gfx/safe_floor_ceil.cc |
| +++ b/ui/gfx/safe_integer_conversions.cc |
| @@ -25,5 +25,14 @@ int ToCeiledInt(float value) { |
| return ClampToInt(std::ceil(value)); |
| } |
| +int ToRoundedInt(float value) { |
|
tfarina
2012/10/10 00:26:02
Looks like this is what SymmetricRound() is trying
danakj
2012/10/10 00:28:04
cool :)
|
| + float rounded; |
| + if (value >= 0.0f) |
| + rounded = std::floor(value + 0.5f); |
| + else |
| + rounded = std::ceil(value - 0.5f); |
| + return ClampToInt(rounded); |
| +} |
| + |
| } // namespace gfx |
|
tfarina
2012/10/10 00:26:02
rm extra blank line.
danakj
2012/10/10 00:28:04
Done.
|