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

Unified Diff: ui/gfx/rect_base.h

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 2 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
Index: ui/gfx/rect_base.h
diff --git a/ui/gfx/rect_base.h b/ui/gfx/rect_base.h
index a9ddda4b43f1e0cfddd41ec16c19fc758fba64fd..0a3298c06b67fbbdb6209ca30c5647fc1bfc280c 100644
--- a/ui/gfx/rect_base.h
+++ b/ui/gfx/rect_base.h
@@ -22,6 +22,7 @@ template<typename Class,
typename PointClass,
typename SizeClass,
typename InsetsClass,
+ typename VectorClass,
typename Type>
class UI_EXPORT RectBase {
public:
@@ -46,6 +47,10 @@ class UI_EXPORT RectBase {
Type right() const { return x() + width(); }
Type bottom() const { return y() + height(); }
+ VectorClass OffsetFromOrigin() const {
+ return VectorClass(x(), y());
+ }
+
void SetRect(Type x, Type y, Type width, Type height);
// Shrink the rectangle by a horizontal and vertical distance on all sides.
@@ -61,8 +66,8 @@ class UI_EXPORT RectBase {
// Move the rectangle by a horizontal and vertical distance.
void Offset(Type horizontal, Type vertical);
- void Offset(const PointClass& point) {
- Offset(point.x(), point.y());
+ void Offset(const VectorClass& distance) {
+ Offset(distance.x(), distance.y());
}
InsetsClass InsetsFrom(const Class& inner) const {

Powered by Google App Engine
This is Rietveld 408576698