Chromium Code Reviews| Index: ui/gfx/transform.cc |
| diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc |
| index 6a44391c02760477e2eeddb75b4da9e3c59980d1..9c8a005389ff5dfc7f1e4545ed021a71b499c715 100644 |
| --- a/ui/gfx/transform.cc |
| +++ b/ui/gfx/transform.cc |
| @@ -246,10 +246,13 @@ bool Transform::IsIdentityOrIntegerTranslation() const { |
| if (!IsIdentityOrTranslation()) |
| return false; |
| + float t[] = {matrix_.get(0, 3), matrix_.get(1, 3), matrix_.get(2, 3)}; |
| bool no_fractional_translation = |
| - static_cast<int>(matrix_.get(0, 3)) == matrix_.get(0, 3) && |
| - static_cast<int>(matrix_.get(1, 3)) == matrix_.get(1, 3) && |
| - static_cast<int>(matrix_.get(2, 3)) == matrix_.get(2, 3); |
| + base::IsValueInRangeForNumericType<int>(t[0]) && |
| + base::IsValueInRangeForNumericType<int>(t[1]) && |
| + base::IsValueInRangeForNumericType<int>(t[2]) && |
| + static_cast<int>(t[0]) == t[0] && static_cast<int>(t[1]) == t[1] && |
| + static_cast<int>(t[2]) == t[2]; |
|
ajuma
2016/12/19 18:01:25
Maybe update the comment in the .h file to mention
danakj
2016/12/19 18:06:22
It could actually have false positives too but I c
|
| return no_fractional_translation; |
| } |