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

Unified Diff: cc/base/index_rect.cc

Issue 2704303005: Pyramid sequence for testing
Patch Set: test4 Created 3 years, 9 months 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/base/index_rect.h ('k') | cc/base/pyramid_sequence.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/index_rect.cc
diff --git a/cc/base/index_rect.cc b/cc/base/index_rect.cc
index 0c64c42a1b03efab8c0efc881e98216a4e578351..0d65af27349bfb0f417c6bbfc42b6ff4d27a4c76 100644
--- a/cc/base/index_rect.cc
+++ b/cc/base/index_rect.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "base/numerics/saturated_arithmetic.h"
#include "base/strings/stringprintf.h"
namespace cc {
@@ -22,6 +23,13 @@ bool IndexRect::Contains(int index_x, int index_y) const {
index_y <= bottom_;
}
+void IndexRect::Inset(int left, int right, int top, int bottom) {
+ left_ = base::SaturatedAddition(left_, left);
+ right_ = base::SaturatedSubtraction(right_, right);
+ top_ = base::SaturatedAddition(top_, top);
+ bottom_ = base::SaturatedSubtraction(bottom_, bottom);
+}
+
std::string IndexRect::ToString() const {
return base::StringPrintf("%d,%d,%d,%d", left(), right(), top(), bottom());
}
« no previous file with comments | « cc/base/index_rect.h ('k') | cc/base/pyramid_sequence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698