diff options
author | garykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 22:50:00 +0000 |
---|---|---|
committer | garykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 22:50:00 +0000 |
commit | 88552a9c89b99b93211ac5e679a0c13420e294db (patch) | |
tree | be326ad62f7c9c9b3dfdea155a306005af00356a /gfx | |
parent | ce3b22e8da4fa9ca838423bacd54e45c3030d518 (diff) | |
download | chromium_src-88552a9c89b99b93211ac5e679a0c13420e294db.zip chromium_src-88552a9c89b99b93211ac5e679a0c13420e294db.tar.gz chromium_src-88552a9c89b99b93211ac5e679a0c13420e294db.tar.bz2 |
Initial pass at integrating Differ into the chromoting host code.
BUG=none
TEST=run Win host; x11 client
Review URL: http://codereview.chromium.org/3013015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/point.h | 10 | ||||
-rw-r--r-- | gfx/rect.cc | 12 | ||||
-rw-r--r-- | gfx/rect.h | 8 |
3 files changed, 30 insertions, 0 deletions
diff --git a/gfx/point.h b/gfx/point.h index e93dc0c..5c6cb72 100644 --- a/gfx/point.h +++ b/gfx/point.h @@ -73,6 +73,16 @@ class Point { return !(*this == rhs); } + // A point is less than another point if its y-value is closer + // to the origin. If the y-values are the same, then point with + // the x-value closer to the origin is considered less than the + // other. + // This comparison is required to use Points in sets, or sorted + // vectors. + bool operator<(const Point& rhs) const { + return (y_ == rhs.y_) ? (x_ < rhs.x_) : (y_ < rhs.y_); + } + #if defined(OS_WIN) POINT ToPOINT() const; #elif defined(OS_MACOSX) diff --git a/gfx/rect.cc b/gfx/rect.cc index 6053b9e..c081dea 100644 --- a/gfx/rect.cc +++ b/gfx/rect.cc @@ -117,6 +117,18 @@ bool Rect::operator==(const Rect& other) const { return origin_ == other.origin_ && size_ == other.size_; } +bool Rect::operator<(const Rect& other) const { + if (origin_ == other.origin_) { + if (width() == other.width()) { + return height() < other.height(); + } else { + return width() < other.width(); + } + } else { + return origin_ < other.origin_; + } +} + #if defined(OS_WIN) RECT Rect::ToRECT() const { RECT r; @@ -102,6 +102,14 @@ class Rect { return !(*this == other); } + // A rect is less than another rect if its origin is less than + // the other rect's origin. If the origins are equal, then the + // shortest rect is less than the other. If the origin and the + // height are equal, then the narrowest rect is less than. + // This comparison is required to use Rects in sets, or sorted + // vectors. + bool operator<(const Rect& other) const; + #if defined(OS_WIN) // Construct an equivalent Win32 RECT object. RECT ToRECT() const; |