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

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

Issue 1025463002: Sk2x (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: missing inline 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 | « gyp/tests.gypi ('k') | src/opts/Sk2x_none.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 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef Sk2x_DEFINED
9 #define Sk2x_DEFINED
10
11 #include "SkTypes.h"
12
13 #define SK2X_PREAMBLE 1
14 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
15 #include "../opts/Sk2x_sse.h"
16 #else
17 #include "../opts/Sk2x_none.h"
18 #endif
19 #undef SK2X_PREAMBLE
20
21 template <typename T> class Sk2x;
22 typedef Sk2x<float> Sk2f;
23 typedef Sk2x<double> Sk2d;
24
25 #if SK_SCALAR_IS_FLOAT
26 typedef Sk2f Sk2s;
27 #elif SK_SCALAR_IS_DOUBLE
28 typedef Sk2d Sk2s;
29 #endif
30
31 // This API is meant to be manageably small, not comprehensive.
32 // Please talk to mtklein if you find yourself wanting more.
33 template <typename T> class Sk2x {
34 public:
35 Sk2x(); // Uninitialized; use Sk2x(0) for zero.
36 explicit Sk2x(T); // Same as Sk2x(T,T);
37 Sk2x(T, T);
38
39 Sk2x(const Sk2x& o) { *this = o; }
40 Sk2x& operator=(const Sk2x&);
41
42 // These assume no particular alignment.
43 static Sk2x Load(const T[2]);
44 void store(T[2]) const;
45
46 Sk2x add(const Sk2x&) const;
47 Sk2x subtract(const Sk2x&) const;
48 Sk2x multiply(const Sk2x&) const;
49
50 Sk2x rsqrt() const; // Approximate 1/this->sqrt().
51 Sk2x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but le ss precise.
52
53 static Sk2x Min(const Sk2x&, const Sk2x&);
54 static Sk2x Max(const Sk2x&, const Sk2x&);
55
56 private:
57 #define SK2X_PRIVATE 1
58 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
59 #include "../opts/Sk2x_sse.h"
60 #else
61 #include "../opts/Sk2x_none.h"
62 #endif
63 #undef SK2X_PRIVATE
64 };
65
66 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
67 #include "../opts/Sk2x_sse.h"
68 #else
69 #include "../opts/Sk2x_none.h"
70 #endif
71
72 #endif//Sk2x_DEFINED
OLDNEW
« no previous file with comments | « gyp/tests.gypi ('k') | src/opts/Sk2x_none.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698