OLD | NEW |
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 // It is important _not_ to put header guards here. | 8 // It is important _not_ to put header guards here. |
9 // This file will be intentionally included three times. | 9 // This file will be intentionally included three times. |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 M(Sk2x<T>) add(const Sk2x<T>& o) const { | 37 M(Sk2x<T>) add(const Sk2x<T>& o) const { |
38 return Sk2x<T>(fVec[0] + o.fVec[0], fVec[1] + o.fVec[1]); | 38 return Sk2x<T>(fVec[0] + o.fVec[0], fVec[1] + o.fVec[1]); |
39 } | 39 } |
40 M(Sk2x<T>) subtract(const Sk2x<T>& o) const { | 40 M(Sk2x<T>) subtract(const Sk2x<T>& o) const { |
41 return Sk2x<T>(fVec[0] - o.fVec[0], fVec[1] - o.fVec[1]); | 41 return Sk2x<T>(fVec[0] - o.fVec[0], fVec[1] - o.fVec[1]); |
42 } | 42 } |
43 M(Sk2x<T>) multiply(const Sk2x<T>& o) const { | 43 M(Sk2x<T>) multiply(const Sk2x<T>& o) const { |
44 return Sk2x<T>(fVec[0] * o.fVec[0], fVec[1] * o.fVec[1]); | 44 return Sk2x<T>(fVec[0] * o.fVec[0], fVec[1] * o.fVec[1]); |
45 } | 45 } |
| 46 M(Sk2x<T>) divide(const Sk2x<T>& o) const { |
| 47 return Sk2x<T>(fVec[0] / o.fVec[0], fVec[1] / o.fVec[1]); |
| 48 } |
46 | 49 |
47 M(Sk2x<T>) Min(const Sk2x<T>& a, const Sk2x<T>& b) { | 50 M(Sk2x<T>) Min(const Sk2x<T>& a, const Sk2x<T>& b) { |
48 return Sk2x<T>(SkTMin(a.fVec[0], b.fVec[0]), SkTMin(a.fVec[1], b.fVec[1])); | 51 return Sk2x<T>(SkTMin(a.fVec[0], b.fVec[0]), SkTMin(a.fVec[1], b.fVec[1])); |
49 } | 52 } |
50 M(Sk2x<T>) Max(const Sk2x<T>& a, const Sk2x<T>& b) { | 53 M(Sk2x<T>) Max(const Sk2x<T>& a, const Sk2x<T>& b) { |
51 return Sk2x<T>(SkTMax(a.fVec[0], b.fVec[0]), SkTMax(a.fVec[1], b.fVec[1])); | 54 return Sk2x<T>(SkTMax(a.fVec[0], b.fVec[0]), SkTMax(a.fVec[1], b.fVec[1])); |
52 } | 55 } |
53 | 56 |
54 #undef M | 57 #undef M |
55 | 58 |
56 #define M template <> inline | 59 #define M template <> inline |
57 | 60 |
58 M Sk2f Sk2f::rsqrt() const { return Sk2f(sk_float_rsqrt(fVec[0]), sk_float_rsqrt
(fVec[1])); } | 61 M Sk2f Sk2f::rsqrt() const { return Sk2f(sk_float_rsqrt(fVec[0]), sk_float_rsqrt
(fVec[1])); } |
59 M Sk2f Sk2f:: sqrt() const { return Sk2f( sqrtf(fVec[0]), sqrtf
(fVec[1])); } | 62 M Sk2f Sk2f:: sqrt() const { return Sk2f( sqrtf(fVec[0]), sqrtf
(fVec[1])); } |
60 | 63 |
61 M Sk2d Sk2d::rsqrt() const { return Sk2d(1.0/::sqrt(fVec[0]), 1.0/::sqrt(fVec[1]
)); } | 64 M Sk2d Sk2d::rsqrt() const { return Sk2d(1.0/::sqrt(fVec[0]), 1.0/::sqrt(fVec[1]
)); } |
62 M Sk2d Sk2d:: sqrt() const { return Sk2d( ::sqrt(fVec[0]), ::sqrt(fVec[1]
)); } | 65 M Sk2d Sk2d:: sqrt() const { return Sk2d( ::sqrt(fVec[0]), ::sqrt(fVec[1]
)); } |
63 | 66 |
64 #undef M | 67 #undef M |
65 | 68 |
66 #endif | 69 #endif |
OLD | NEW |