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

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

Issue 704923003: start again on Sk4x with portable version and unit tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: memcpy Created 6 years, 1 month 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 | « gyp/tests.gypi ('k') | src/core/Sk4x_portable.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « gyp/tests.gypi ('k') | src/core/Sk4x_portable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698