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 #ifndef Sk4px_DEFINED | 8 #ifndef Sk4px_DEFINED |
9 #define Sk4px_DEFINED | 9 #define Sk4px_DEFINED |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 Wide widenLo() const; // ARGB -> 0A 0R 0G 0B | 78 Wide widenLo() const; // ARGB -> 0A 0R 0G 0B |
79 Wide widenHi() const; // ARGB -> A0 R0 G0 B0 | 79 Wide widenHi() const; // ARGB -> A0 R0 G0 B0 |
80 Wide mulWiden(const Sk16b&) const; // 8-bit x 8-bit -> 16-bit components. | 80 Wide mulWiden(const Sk16b&) const; // 8-bit x 8-bit -> 16-bit components. |
81 | 81 |
82 // The only 8-bit multiply we use is 8-bit x 8-bit -> 16-bit. Might as well
make it pithy. | 82 // The only 8-bit multiply we use is 8-bit x 8-bit -> 16-bit. Might as well
make it pithy. |
83 Wide operator * (const Sk4px& o) const { return this->mulWiden(o); } | 83 Wide operator * (const Sk4px& o) const { return this->mulWiden(o); } |
84 | 84 |
85 // These just keep the types as Sk4px so the user doesn't have to keep casti
ng. | 85 // These just keep the types as Sk4px so the user doesn't have to keep casti
ng. |
86 Sk4px operator + (const Sk4px& o) const { return INHERITED::operator+(o); } | 86 Sk4px operator + (const Sk4px& o) const { return INHERITED::operator+(o); } |
87 Sk4px operator - (const Sk4px& o) const { return INHERITED::operator-(o); } | 87 Sk4px operator - (const Sk4px& o) const { return INHERITED::operator-(o); } |
| 88 Sk4px operator < (const Sk4px& o) const { return INHERITED::operator<(o); } |
| 89 Sk4px thenElse(const Sk4px& t, const Sk4px& e) const { return INHERITED::the
nElse(t,e); } |
88 | 90 |
89 // Generally faster than (*this * o).div255(). | 91 // Generally faster than (*this * o).div255(). |
90 // May be incorrect by +-1, but is always exactly correct when *this or o is
0 or 255. | 92 // May be incorrect by +-1, but is always exactly correct when *this or o is
0 or 255. |
91 Sk4px approxMulDiv255(const Sk16b& o) const { | 93 Sk4px approxMulDiv255(const Sk16b& o) const { |
92 // (x*y + x) / 256 meets these criteria. (As of course does (x*y + y) /
256 by symmetry.) | 94 // (x*y + x) / 256 meets these criteria. (As of course does (x*y + y) /
256 by symmetry.) |
93 return this->widenLo().addNarrowHi(*this * o); | 95 return this->widenLo().addNarrowHi(*this * o); |
94 } | 96 } |
95 | 97 |
96 // A generic driver that maps fn over a src array into a dst array. | 98 // A generic driver that maps fn over a src array into a dst array. |
97 // fn should take an Sk4px (4 src pixels) and return an Sk4px (4 dst pixels)
. | 99 // fn should take an Sk4px (4 src pixels) and return an Sk4px (4 dst pixels)
. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 195 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
194 #include "../opts/Sk4px_SSE2.h" | 196 #include "../opts/Sk4px_SSE2.h" |
195 #elif defined(SK_ARM_HAS_NEON) | 197 #elif defined(SK_ARM_HAS_NEON) |
196 #include "../opts/Sk4px_NEON.h" | 198 #include "../opts/Sk4px_NEON.h" |
197 #else | 199 #else |
198 #include "../opts/Sk4px_none.h" | 200 #include "../opts/Sk4px_none.h" |
199 #endif | 201 #endif |
200 #endif | 202 #endif |
201 | 203 |
202 #endif//Sk4px_DEFINED | 204 #endif//Sk4px_DEFINED |
OLD | NEW |