Index: cc/base/index_rect.cc |
diff --git a/cc/base/index_rect.cc b/cc/base/index_rect.cc |
index 0c64c42a1b03efab8c0efc881e98216a4e578351..a2613ed49ef6323d4bbc2fcf31162e5751a84d90 100644 |
--- a/cc/base/index_rect.cc |
+++ b/cc/base/index_rect.cc |
@@ -7,6 +7,7 @@ |
#include <algorithm> |
#include "base/strings/stringprintf.h" |
+#include "ui/gfx/geometry/safe_integer_conversions.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_ = gfx::SafeAdd(left_, left); |
+ right_ = gfx::SafeSubtract(right_, right); |
+ top_ = gfx::SafeAdd(top_, top); |
+ bottom_ = gfx::SafeSubtract(bottom_, bottom); |
+} |
+ |
std::string IndexRect::ToString() const { |
return base::StringPrintf("%d,%d,%d,%d", left(), right(), top(), bottom()); |
} |