Index: ui/gfx/transform.cc |
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc |
index 8fe437301d20aff6d51e7b8af85af63e1364558c..54793eae75bcb67c39e11603e77e31747141af97 100644 |
--- a/ui/gfx/transform.cc |
+++ b/ui/gfx/transform.cc |
@@ -248,6 +248,18 @@ bool Transform::IsIdentityOrTranslation() const { |
return has_no_perspective && has_no_rotation_or_skew && has_no_scale; |
} |
+bool Transform::IsIdentityOrIntegerTranslation() const { |
+ if (!IsIdentityOrTranslation()) |
+ return false; |
+ |
+ bool no_fractional_translation = |
+ static_cast<int>(matrix_.getDouble(0, 3)) == matrix_.getDouble(0, 3) && |
+ static_cast<int>(matrix_.getDouble(1, 3)) == matrix_.getDouble(1, 3) && |
+ static_cast<int>(matrix_.getDouble(2, 3)) == matrix_.getDouble(2, 3); |
+ |
+ return no_fractional_translation; |
+} |
+ |
bool Transform::IsScaleOrTranslation() const { |
if (matrix_.isIdentity()) |
return true; |