diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-01-25 21:53:53 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-01-25 21:53:53 +0000 |
commit | 6d428d3e6e4238786a38caca6002dae92637958d (patch) | |
tree | addb027981e858f56d36e5a5dc250c55869dbd9e | |
parent | 27accef223a27fba437f5e825d99edbae20a045b (diff) |
Make SkRegion::operator== a member function, rather than a privately-declared
friend. Without this, calling code has access to operator==, but can fail to
link because the implementation is assumed to have static linkage.
http://codereview.appspot.com/5577047/
git-svn-id: http://skia.googlecode.com/svn/trunk@3088 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | include/core/SkRegion.h | 6 | ||||
-rw-r--r-- | src/core/SkRegion.cpp | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h index 9d89d94188..7623b82262 100644 --- a/include/core/SkRegion.h +++ b/include/core/SkRegion.h @@ -45,13 +45,13 @@ public: * Return true if the two regions are equal. i.e. The enclose exactly * the same area. */ - friend bool operator==(const SkRegion& a, const SkRegion& b); + bool operator==(const SkRegion& other) const; /** * Return true if the two regions are not equal. */ - friend bool operator!=(const SkRegion& a, const SkRegion& b) { - return !(a == b); + bool operator!=(const SkRegion& other) const { + return !(*this == other); } /** diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp index 0a8ab6557e..dee652ba3b 100644 --- a/src/core/SkRegion.cpp +++ b/src/core/SkRegion.cpp @@ -455,18 +455,18 @@ bool SkRegion::intersects(const SkRegion& rgn) const { ///////////////////////////////////////////////////////////////////////////////////// -bool operator==(const SkRegion& a, const SkRegion& b) { - SkDEBUGCODE(a.validate();) +bool SkRegion::operator==(const SkRegion& b) const { + SkDEBUGCODE(validate();) SkDEBUGCODE(b.validate();) - if (&a == &b) { + if (this == &b) { return true; } - if (a.fBounds != b.fBounds) { + if (fBounds != b.fBounds) { return false; } - const SkRegion::RunHead* ah = a.fRunHead; + const SkRegion::RunHead* ah = fRunHead; const SkRegion::RunHead* bh = b.fRunHead; // this catches empties and rects being equal |