diff options
author | mtklein <mtklein@chromium.org> | 2015-03-20 06:00:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-20 06:00:57 -0700 |
commit | 26bf90e5d63024585a8261b224ea4387079e2751 (patch) | |
tree | daca59ff18e927659eea86be2831d1e584a5ba15 /src | |
parent | adf9990cb56ca389f37f02ac637496083b3c3cfc (diff) |
operator overloads for Sk4x, use them all where possible
BUG=skia:
NOTRY=true
Review URL: https://codereview.chromium.org/1024633003
Diffstat (limited to 'src')
-rw-r--r-- | src/core/Sk4x.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/Sk4x.h b/src/core/Sk4x.h index d280c1b378..f006d70e24 100644 --- a/src/core/Sk4x.h +++ b/src/core/Sk4x.h @@ -52,6 +52,22 @@ public: Sk4x multiply(const Sk4x&) const; Sk4x divide(const Sk4x&) const; + // TODO: why doesn't MSVC like operator~() ? + //Sk4x operator ~() const { return this->bitNot(); } + Sk4x operator &(const Sk4x& o) const { return this->bitAnd(o); } + Sk4x operator |(const Sk4x& o) const { return this->bitOr (o); } + Sk4x operator +(const Sk4x& o) const { return this->add(o); } + Sk4x operator -(const Sk4x& o) const { return this->subtract(o); } + Sk4x operator *(const Sk4x& o) const { return this->multiply(o); } + Sk4x operator /(const Sk4x& o) const { return this->divide(o); } + + Sk4x& operator &=(const Sk4x& o) { return (*this = *this & o); } + Sk4x& operator |=(const Sk4x& o) { return (*this = *this | o); } + Sk4x& operator +=(const Sk4x& o) { return (*this = *this + o); } + Sk4x& operator -=(const Sk4x& o) { return (*this = *this - o); } + Sk4x& operator *=(const Sk4x& o) { return (*this = *this * o); } + Sk4x& operator /=(const Sk4x& o) { return (*this = *this / o); } + Sk4x rsqrt() const; // Approximate reciprocal sqrt(). Sk4x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but less precise. @@ -62,6 +78,13 @@ public: Sk4i lessThanEqual(const Sk4x&) const; Sk4i greaterThanEqual(const Sk4x&) const; + Sk4i operator ==(const Sk4x& o) const { return this->equal(o); } + Sk4i operator !=(const Sk4x& o) const { return this->notEqual(o); } + Sk4i operator <(const Sk4x& o) const { return this->lessThan(o); } + Sk4i operator >(const Sk4x& o) const { return this->greaterThan(o); } + Sk4i operator <=(const Sk4x& o) const { return this->lessThanEqual(o); } + Sk4i operator >=(const Sk4x& o) const { return this->greaterThanEqual(o); } + static Sk4x Min(const Sk4x& a, const Sk4x& b); static Sk4x Max(const Sk4x& a, const Sk4x& b); |