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

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

Issue 1024993002: Sk2x::invert() and Sk2x::approxInvert() (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: invert() and approxInvert() 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 | src/opts/Sk2x_neon.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef Sk2x_DEFINED 8 #ifndef Sk2x_DEFINED
9 #define Sk2x_DEFINED 9 #define Sk2x_DEFINED
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 Sk2x& operator -=(const Sk2x& o) { return (*this = *this - o); } 60 Sk2x& operator -=(const Sk2x& o) { return (*this = *this - o); }
61 Sk2x& operator *=(const Sk2x& o) { return (*this = *this * o); } 61 Sk2x& operator *=(const Sk2x& o) { return (*this = *this * o); }
62 Sk2x& operator /=(const Sk2x& o) { return (*this = *this / o); } 62 Sk2x& operator /=(const Sk2x& o) { return (*this = *this / o); }
63 63
64 Sk2x negate() const { return Sk2x((T)0) - *this; } 64 Sk2x negate() const { return Sk2x((T)0) - *this; }
65 Sk2x operator -() const { return this->negate(); } 65 Sk2x operator -() const { return this->negate(); }
66 66
67 Sk2x rsqrt() const; // Approximate 1/this->sqrt(). 67 Sk2x rsqrt() const; // Approximate 1/this->sqrt().
68 Sk2x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but le ss precise. 68 Sk2x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but le ss precise.
69 69
70 Sk2x invert() const; // 1/this.
71 Sk2x approxInvert() const; // Approximate 1/this, usually faster but less p recise.
72
70 static Sk2x Min(const Sk2x&, const Sk2x&); 73 static Sk2x Min(const Sk2x&, const Sk2x&);
71 static Sk2x Max(const Sk2x&, const Sk2x&); 74 static Sk2x Max(const Sk2x&, const Sk2x&);
72 75
73 private: 76 private:
74 #define SK2X_PRIVATE 1 77 #define SK2X_PRIVATE 1
75 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD) 78 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD)
76 #include "../opts/Sk2x_sse.h" 79 #include "../opts/Sk2x_sse.h"
77 #elif defined(SK_ARM_HAS_NEON) && !defined(SKNX_NO_SIMD) 80 #elif defined(SK_ARM_HAS_NEON) && !defined(SKNX_NO_SIMD)
78 #include "../opts/Sk2x_neon.h" 81 #include "../opts/Sk2x_neon.h"
79 #else 82 #else
80 #include "../opts/Sk2x_none.h" 83 #include "../opts/Sk2x_none.h"
81 #endif 84 #endif
82 #undef SK2X_PRIVATE 85 #undef SK2X_PRIVATE
83 }; 86 };
84 87
85 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD) 88 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD)
86 #include "../opts/Sk2x_sse.h" 89 #include "../opts/Sk2x_sse.h"
87 #elif defined(SK_ARM_HAS_NEON) && !defined(SKNX_NO_SIMD) 90 #elif defined(SK_ARM_HAS_NEON) && !defined(SKNX_NO_SIMD)
88 #include "../opts/Sk2x_neon.h" 91 #include "../opts/Sk2x_neon.h"
89 #else 92 #else
90 #include "../opts/Sk2x_none.h" 93 #include "../opts/Sk2x_none.h"
91 #endif 94 #endif
92 95
93 #endif//Sk2x_DEFINED 96 #endif//Sk2x_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/opts/Sk2x_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698