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

Unified Diff: ui/gfx/transform.cc

Issue 11644008: Migrate from MathUtil::inverse() to gfx::Transform::GetInverse() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 7 years, 12 months 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 a4a4e64bb7497a0f84d7b7a50a1eb490671a7c4f..c2b6ba2fa9dffe86b6d2e7795ea3096f1479161f 100644
--- a/ui/gfx/transform.cc
+++ b/ui/gfx/transform.cc
@@ -245,7 +245,14 @@ bool Transform::IsBackFaceVisible() const {
}
bool Transform::GetInverse(Transform* transform) const {
- return matrix_.invert(&transform->matrix_);
+ if (!matrix_.invert(&transform->matrix_)) {
+ // Initialize the return value to identity if this matrix turned
+ // out to be un-invertible.
+ transform->MakeIdentity();
+ return false;
+ }
+
+ return true;
}
void Transform::Transpose() {
« 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