Index: ui/gfx/transform.cc |
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc |
index f8f8ce1a3a1e59a625c2a03d6beac794bb47c1f8..fc03dc263517fbd30992d6efbcd2b81a8cae665c 100644 |
--- a/ui/gfx/transform.cc |
+++ b/ui/gfx/transform.cc |
@@ -241,6 +241,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 { |
bool has_no_perspective = !matrix_.getDouble(3, 0) && |
!matrix_.getDouble(3, 1) && |