Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #ifndef Sk4x_DEFINED | |
| 2 #define Sk4x_DEFINED | |
| 3 | |
| 4 #include "SkTypes.h" | |
| 5 | |
| 6 #define SK4X_PREAMBLE 1 | |
| 7 #include "Sk4x_portable.h" | |
| 8 #undef SK4X_PREAMBLE | |
| 9 | |
| 10 template <typename T> class Sk4x; | |
| 11 typedef Sk4x<float> Sk4f; | |
| 12 typedef Sk4x<int> Sk4i; | |
|
reed1
2014/11/07 18:01:23
just for documentation purpose, should we use <int
mtklein
2014/11/07 18:07:36
Yep, great idea. Done.
| |
| 13 | |
| 14 template <typename T> class Sk4x { | |
| 15 public: | |
| 16 Sk4x(); // Uninitialized; use Sk4x(0,0,0,0) for zero. | |
| 17 Sk4x(T, T, T, T); | |
| 18 | |
| 19 Sk4x(const Sk4x&); | |
| 20 Sk4x& operator=(const Sk4x&); | |
| 21 | |
| 22 static Sk4x Load (const T[4]); | |
| 23 static Sk4x LoadAligned(const T[4]); | |
| 24 | |
| 25 void store (T[4]) const; | |
| 26 void storeAligned(T[4]) const; | |
| 27 | |
| 28 template <typename Dst> Dst reinterpret() const; | |
| 29 template <typename Dst> Dst cast() const; | |
| 30 | |
| 31 bool allTrue() const; | |
| 32 bool anyTrue() const; | |
| 33 | |
| 34 Sk4x bitNot() const; | |
| 35 Sk4x bitAnd(const Sk4x&) const; | |
| 36 Sk4x bitOr(const Sk4x&) const; | |
| 37 Sk4x add(const Sk4x&) const; | |
| 38 Sk4x subtract(const Sk4x&) const; | |
| 39 Sk4x multiply(const Sk4x&) const; | |
| 40 Sk4x divide(const Sk4x&) const; | |
| 41 | |
| 42 Sk4i equal(const Sk4x&) const; | |
| 43 Sk4i notEqual(const Sk4x&) const; | |
| 44 Sk4i lessThan(const Sk4x&) const; | |
| 45 Sk4i greaterThan(const Sk4x&) const; | |
| 46 Sk4i lessThanEqual(const Sk4x&) const; | |
| 47 Sk4i greaterThanEqual(const Sk4x&) const; | |
| 48 | |
| 49 static Sk4x Min(const Sk4x& a, const Sk4x& b); | |
| 50 static Sk4x Max(const Sk4x& a, const Sk4x& b); | |
| 51 | |
| 52 // Swizzles follow OpenCL xyzw convention. | |
| 53 Sk4x zwxy() const; | |
| 54 | |
| 55 // When there's a second argument, it's abcd. | |
| 56 static Sk4x XYAB(const Sk4x& xyzw, const Sk4x& abcd); | |
| 57 static Sk4x ZWCD(const Sk4x& xyzw, const Sk4x& abcd); | |
| 58 | |
| 59 private: | |
| 60 // It's handy to have Sk4f and Sk4i be mutual friends. | |
| 61 template <typename S> friend class Sk4x; | |
| 62 | |
| 63 #define SK4X_PRIVATE 1 | |
| 64 #include "Sk4x_portable.h" | |
| 65 #undef SK4X_PRIVATE | |
| 66 }; | |
| 67 | |
| 68 #include "Sk4x_portable.h" | |
| 69 | |
| 70 #endif//Sk4x_DEFINED | |
| OLD | NEW |