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

Side by Side Diff: src/core/Sk4x.h

Issue 1024633003: operator overloads for Sk4x, use them all where possible (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: weird, msvc doesnt like operator~() 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/PMFloatTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef Sk4x_DEFINED 1 #ifndef Sk4x_DEFINED
2 #define Sk4x_DEFINED 2 #define Sk4x_DEFINED
3 3
4 #include "SkTypes.h" 4 #include "SkTypes.h"
5 5
6 #define SK4X_PREAMBLE 1 6 #define SK4X_PREAMBLE 1
7 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 7 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
8 #include "../opts/Sk4x_sse.h" 8 #include "../opts/Sk4x_sse.h"
9 #elif defined(SK_ARM_HAS_NEON) 9 #elif defined(SK_ARM_HAS_NEON)
10 #include "../opts/Sk4x_neon.h" 10 #include "../opts/Sk4x_neon.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 Sk4x bitNot() const; 46 Sk4x bitNot() const;
47 Sk4x bitAnd(const Sk4x&) const; 47 Sk4x bitAnd(const Sk4x&) const;
48 Sk4x bitOr(const Sk4x&) const; 48 Sk4x bitOr(const Sk4x&) const;
49 // TODO: Sk4x bitAndNot(const Sk4x&) const; is efficient in SSE. 49 // TODO: Sk4x bitAndNot(const Sk4x&) const; is efficient in SSE.
50 Sk4x add(const Sk4x&) const; 50 Sk4x add(const Sk4x&) const;
51 Sk4x subtract(const Sk4x&) const; 51 Sk4x subtract(const Sk4x&) const;
52 Sk4x multiply(const Sk4x&) const; 52 Sk4x multiply(const Sk4x&) const;
53 Sk4x divide(const Sk4x&) const; 53 Sk4x divide(const Sk4x&) const;
54 54
55 // TODO: why doesn't MSVC like operator~() ?
56 //Sk4x operator ~() const { return this->bitNot(); }
57 Sk4x operator &(const Sk4x& o) const { return this->bitAnd(o); }
58 Sk4x operator |(const Sk4x& o) const { return this->bitOr (o); }
59 Sk4x operator +(const Sk4x& o) const { return this->add(o); }
60 Sk4x operator -(const Sk4x& o) const { return this->subtract(o); }
61 Sk4x operator *(const Sk4x& o) const { return this->multiply(o); }
62 Sk4x operator /(const Sk4x& o) const { return this->divide(o); }
63
64 Sk4x& operator &=(const Sk4x& o) { return (*this = *this & o); }
65 Sk4x& operator |=(const Sk4x& o) { return (*this = *this | o); }
66 Sk4x& operator +=(const Sk4x& o) { return (*this = *this + o); }
67 Sk4x& operator -=(const Sk4x& o) { return (*this = *this - o); }
68 Sk4x& operator *=(const Sk4x& o) { return (*this = *this * o); }
69 Sk4x& operator /=(const Sk4x& o) { return (*this = *this / o); }
70
55 Sk4x rsqrt() const; // Approximate reciprocal sqrt(). 71 Sk4x rsqrt() const; // Approximate reciprocal sqrt().
56 Sk4x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but le ss precise. 72 Sk4x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but le ss precise.
57 73
58 Sk4i equal(const Sk4x&) const; 74 Sk4i equal(const Sk4x&) const;
59 Sk4i notEqual(const Sk4x&) const; 75 Sk4i notEqual(const Sk4x&) const;
60 Sk4i lessThan(const Sk4x&) const; 76 Sk4i lessThan(const Sk4x&) const;
61 Sk4i greaterThan(const Sk4x&) const; 77 Sk4i greaterThan(const Sk4x&) const;
62 Sk4i lessThanEqual(const Sk4x&) const; 78 Sk4i lessThanEqual(const Sk4x&) const;
63 Sk4i greaterThanEqual(const Sk4x&) const; 79 Sk4i greaterThanEqual(const Sk4x&) const;
64 80
81 Sk4i operator ==(const Sk4x& o) const { return this->equal(o); }
82 Sk4i operator !=(const Sk4x& o) const { return this->notEqual(o); }
83 Sk4i operator <(const Sk4x& o) const { return this->lessThan(o); }
84 Sk4i operator >(const Sk4x& o) const { return this->greaterThan(o); }
85 Sk4i operator <=(const Sk4x& o) const { return this->lessThanEqual(o); }
86 Sk4i operator >=(const Sk4x& o) const { return this->greaterThanEqual(o); }
87
65 static Sk4x Min(const Sk4x& a, const Sk4x& b); 88 static Sk4x Min(const Sk4x& a, const Sk4x& b);
66 static Sk4x Max(const Sk4x& a, const Sk4x& b); 89 static Sk4x Max(const Sk4x& a, const Sk4x& b);
67 90
68 // Swizzles follow OpenCL xyzw convention. 91 // Swizzles follow OpenCL xyzw convention.
69 Sk4x zwxy() const; 92 Sk4x zwxy() const;
70 93
71 // When there's a second argument, it's abcd. 94 // When there's a second argument, it's abcd.
72 static Sk4x XYAB(const Sk4x& xyzw, const Sk4x& abcd); 95 static Sk4x XYAB(const Sk4x& xyzw, const Sk4x& abcd);
73 static Sk4x ZWCD(const Sk4x& xyzw, const Sk4x& abcd); 96 static Sk4x ZWCD(const Sk4x& xyzw, const Sk4x& abcd);
74 97
(...skipping 18 matching lines...) Expand all
93 116
94 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 117 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
95 #include "../opts/Sk4x_sse.h" 118 #include "../opts/Sk4x_sse.h"
96 #elif defined(SK_ARM_HAS_NEON) 119 #elif defined(SK_ARM_HAS_NEON)
97 #include "../opts/Sk4x_neon.h" 120 #include "../opts/Sk4x_neon.h"
98 #else 121 #else
99 #include "../opts/Sk4x_none.h" 122 #include "../opts/Sk4x_none.h"
100 #endif 123 #endif
101 124
102 #endif//Sk4x_DEFINED 125 #endif//Sk4x_DEFINED
OLDNEW
« no previous file with comments | « no previous file | tests/PMFloatTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698