зеркало из https://github.com/mozilla/moz-skia.git
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:
Родитель
27accef223
Коммит
6d428d3e6e
|
@ -45,13 +45,13 @@ public:
|
||||||
* Return true if the two regions are equal. i.e. The enclose exactly
|
* Return true if the two regions are equal. i.e. The enclose exactly
|
||||||
* the same area.
|
* 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.
|
* Return true if the two regions are not equal.
|
||||||
*/
|
*/
|
||||||
friend bool operator!=(const SkRegion& a, const SkRegion& b) {
|
bool operator!=(const SkRegion& other) const {
|
||||||
return !(a == b);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -455,18 +455,18 @@ bool SkRegion::intersects(const SkRegion& rgn) const {
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool operator==(const SkRegion& a, const SkRegion& b) {
|
bool SkRegion::operator==(const SkRegion& b) const {
|
||||||
SkDEBUGCODE(a.validate();)
|
SkDEBUGCODE(validate();)
|
||||||
SkDEBUGCODE(b.validate();)
|
SkDEBUGCODE(b.validate();)
|
||||||
|
|
||||||
if (&a == &b) {
|
if (this == &b) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (a.fBounds != b.fBounds) {
|
if (fBounds != b.fBounds) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkRegion::RunHead* ah = a.fRunHead;
|
const SkRegion::RunHead* ah = fRunHead;
|
||||||
const SkRegion::RunHead* bh = b.fRunHead;
|
const SkRegion::RunHead* bh = b.fRunHead;
|
||||||
|
|
||||||
// this catches empties and rects being equal
|
// this catches empties and rects being equal
|
||||||
|
|
Загрузка…
Ссылка в новой задаче