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

Unified Diff: ui/gfx/geometry/vector2d.cc

Issue 2499783002: Move SaturatedArithmetic from Blink to base (Closed)
Patch Set: Revert flag addition Created 4 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 | « ui/gfx/geometry/size.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/vector2d.cc
diff --git a/ui/gfx/geometry/vector2d.cc b/ui/gfx/geometry/vector2d.cc
index aec4d28b9b0fec0f0cdebe65f9462ac68466f4f3..2b4875c39cb4a9905f2ed0699fcb9164ee8fe2d6 100644
--- a/ui/gfx/geometry/vector2d.cc
+++ b/ui/gfx/geometry/vector2d.cc
@@ -6,8 +6,8 @@
#include <cmath>
+#include "base/numerics/saturated_arithmetic.h"
#include "base/strings/stringprintf.h"
-#include "ui/gfx/geometry/safe_integer_conversions.h"
namespace gfx {
@@ -16,13 +16,13 @@ bool Vector2d::IsZero() const {
}
void Vector2d::Add(const Vector2d& other) {
- x_ = SafeAdd(other.x_, x_);
- y_ = SafeAdd(other.y_, y_);
+ x_ = base::SaturatedAddition(other.x_, x_);
+ y_ = base::SaturatedAddition(other.y_, y_);
}
void Vector2d::Subtract(const Vector2d& other) {
- x_ = SafeSubtract(x_, other.x_);
- y_ = SafeSubtract(y_, other.y_);
+ x_ = base::SaturatedSubtraction(x_, other.x_);
+ y_ = base::SaturatedSubtraction(y_, other.y_);
}
int64_t Vector2d::LengthSquared() const {
« no previous file with comments | « ui/gfx/geometry/size.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698