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

Unified Diff: cc/stubs/skia_utils.h

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector Created 8 years, 1 month 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 | « cc/stubs/int_point.h ('k') | cc/test/layer_test_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/stubs/skia_utils.h
diff --git a/cc/stubs/skia_utils.h b/cc/stubs/skia_utils.h
index d7b1fbfb03e533f82bed9d1739540164573c79e7..8404fa322ced67ca195f15b50dae9af6a2aed21e 100644
--- a/cc/stubs/skia_utils.h
+++ b/cc/stubs/skia_utils.h
@@ -5,11 +5,23 @@
#ifndef CC_STUBS_SKIAUTILS_H_
#define CC_STUBS_SKIAUTILS_H_
+#include <limits>
+
+#include "third_party/skia/include/core/SkScalar.h"
+
namespace cc {
+// Skia has problems when passed infinite, etc floats, filter them to 0.
inline SkScalar FloatToSkScalar(float f)
{
- return SkFloatToScalar(isfinite(f) ? f : 0);
+ // This checks if |f| is NaN.
+ if (f != f)
+ return 0;
+ if (f == std::numeric_limits<double>::infinity())
+ return 0;
+ if (f == -std::numeric_limits<double>::infinity())
+ return 0;
+ return SkFloatToScalar(f);
}
}
« no previous file with comments | « cc/stubs/int_point.h ('k') | cc/test/layer_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698