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

Unified Diff: src/core/SkMatrix.cpp

Issue 1532963002: Make SkMatrix::get*Scale[s]() fail on NaN (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add SK_WARN_UNUSED_RESULT Created 5 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 | « include/core/SkMatrix.h ('k') | tests/MatrixTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMatrix.cpp
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 67ae052e06d0197175dd2ad3d4be48b9df1e6ed0..dfeb721d45e68394f4bf2db1906c11d708f044e3 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -1488,9 +1488,15 @@ template <MinMaxOrBoth MIN_MAX_OR_BOTH> bool get_scale_factor(SkMatrix::TypeMask
results[1] = apluscdiv2 + x;
}
}
+ if (SkScalarIsNaN(results[0])) {
+ return false;
+ }
SkASSERT(results[0] >= 0);
results[0] = SkScalarSqrt(results[0]);
if (kBoth_MinMaxOrBoth == MIN_MAX_OR_BOTH) {
+ if (SkScalarIsNaN(results[1])) {
+ return false;
+ }
SkASSERT(results[1] >= 0);
results[1] = SkScalarSqrt(results[1]);
}
« no previous file with comments | « include/core/SkMatrix.h ('k') | tests/MatrixTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698