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
This commit is contained in:
reed@google.com 2012-01-25 21:53:53 +00:00
Родитель 27accef223
Коммит 6d428d3e6e
2 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -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);
}
/**

Просмотреть файл

@ -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