| Index: cc/math_util.h
|
| diff --git a/cc/math_util.h b/cc/math_util.h
|
| index 8c1ca88675dbde5e7aee2e77ab6ad0d1684beee0..24a155d74422c31ea8a3cd8f1a7c54bfc8e85e88 100644
|
| --- a/cc/math_util.h
|
| +++ b/cc/math_util.h
|
| @@ -5,6 +5,8 @@
|
| #ifndef CC_MATH_UTIL_H_
|
| #define CC_MATH_UTIL_H_
|
|
|
| +#include <cmath>
|
| +
|
| #include "base/logging.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "cc/cc_export.h"
|
| @@ -81,6 +83,9 @@ public:
|
| static float Deg2Rad(float deg) { return deg * PI_FLOAT / 180; }
|
| static float Rad2Deg(float rad) { return rad * 180 / PI_FLOAT; }
|
|
|
| + static float Round(float f) { return (f > 0.f) ? std::floor(f + 0.5f) : std::ceil(f - 0.5f); }
|
| + static double Round(double d) { return (d > 0.0) ? std::floor(d + 0.5) : std::ceil(d - 0.5); }
|
| +
|
| // Background: Existing transform code does not do the right thing in
|
| // mapRect / mapQuad / projectQuad when there is a perspective projection that causes
|
| // one of the transformed vertices to go to w < 0. In those cases, it is necessary to
|
|
|