diff options
-rw-r--r-- | ui/gfx/transform.cc | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc index d85d86f..b62dced 100644 --- a/ui/gfx/transform.cc +++ b/ui/gfx/transform.cc @@ -6,19 +6,9 @@ #include "ui/gfx/point3.h" #include "ui/gfx/rect.h" +#include "ui/gfx/safe_integer_conversions.h" #include "ui/gfx/skia_util.h" -namespace { - -static int SymmetricRound(float x) { - return static_cast<int>( - x > 0 - ? std::floor(x + 0.5f) - : std::ceil(x - 0.5f)); -} - -} // namespace - namespace gfx { Transform::Transform() { @@ -192,16 +182,12 @@ void Transform::TransformPointInternal(const SkMatrix44& xform, void Transform::TransformPointInternal(const SkMatrix44& xform, Point& point) const { - SkScalar p[4] = { - SkIntToScalar(point.x()), - SkIntToScalar(point.y()), - 0, - 1 }; + SkScalar p[4] = { SkIntToScalar(point.x()), SkIntToScalar(point.y()), + 0, 1 }; xform.map(p); - point.SetPoint(SymmetricRound(p[0]), - SymmetricRound(p[1])); + point.SetPoint(ToRoundedInt(p[0]), ToRoundedInt(p[1])); } } // namespace gfx |