aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkPoint.h
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-07 13:51:05 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-07 13:51:05 +0000
commite3987da2d293c4a6d0ccaac1c4066c20fb652ee6 (patch)
tree7879a857c96348757e5d02182ceec453ca8a826d /include/core/SkPoint.h
parentc56a83ca9c1011fadd25475188fc2ea08930ec41 (diff)
make CanNormalize inline for the float build (big speedup for PathIter)
git-svn-id: http://skia.googlecode.com/svn/trunk@3845 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkPoint.h')
-rw-r--r--include/core/SkPoint.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/core/SkPoint.h b/include/core/SkPoint.h
index 4570e25613..cc483a62ac 100644
--- a/include/core/SkPoint.h
+++ b/include/core/SkPoint.h
@@ -213,7 +213,13 @@ struct SK_API SkPoint {
* Return true if the computed length of the vector is >= the internal
* tolerance (used to avoid dividing by tiny values).
*/
- static bool CanNormalize(SkScalar dx, SkScalar dy);
+ static bool CanNormalize(SkScalar dx, SkScalar dy)
+#ifdef SK_SCALAR_IS_FLOAT
+ // Simple enough (and performance critical sometimes) so we inline it.
+ { return (dx*dx + dy*dy) > (SK_ScalarNearlyZero * SK_ScalarNearlyZero); }
+#else
+ ;
+#endif
bool canNormalize() const {
return CanNormalize(fX, fY);