Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: src/core/Sk2x.h

Issue 1024473005: Try out operator overloads for Sk2x. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: simpler math Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkGeometry.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/Sk2x.h
diff --git a/src/core/Sk2x.h b/src/core/Sk2x.h
index 99cd45ebe80403177615e4cd4835305b690a0ae6..5e78c503d5aa5c0cd88e7408dca3252dea68defa 100644
--- a/src/core/Sk2x.h
+++ b/src/core/Sk2x.h
@@ -49,6 +49,14 @@ public:
Sk2x subtract(const Sk2x&) const;
Sk2x multiply(const Sk2x&) const;
+ Sk2x operator +(const Sk2x& o) const { return this->add(o); }
+ Sk2x operator -(const Sk2x& o) const { return this->subtract(o); }
+ Sk2x operator *(const Sk2x& o) const { return this->multiply(o); }
+
+ Sk2x& operator +=(const Sk2x& o) { return (*this = *this + o); }
+ Sk2x& operator -=(const Sk2x& o) { return (*this = *this - o); }
+ Sk2x& operator *=(const Sk2x& o) { return (*this = *this * o); }
+
Sk2x rsqrt() const; // Approximate 1/this->sqrt().
Sk2x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but less precise.
« no previous file with comments | « no previous file | src/core/SkGeometry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698