Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1740)

Unified Diff: ui/gfx/transform.cc

Issue 11358181: Use nearest neighbor filtering for non-translated quads (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Change CHECK() into DCHECK(). Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/transform.h ('k') | ui/gfx/transform_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « ui/gfx/transform.h ('k') | ui/gfx/transform_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698