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 inline Sk4px::Sk4px(SkPMColor px) : INHERITED(_mm_set1_epi32(px)) {} | 8 inline Sk4px::Sk4px(SkPMColor px) : INHERITED(_mm_set1_epi32(px)) {} |
9 | 9 |
10 inline Sk4px Sk4px::Load4(const SkPMColor px[4]) { | 10 inline Sk4px Sk4px::Load4(const SkPMColor px[4]) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 as = _mm_or_si128(as, _mm_slli_si128(as, 1)); // __33 __22 __11
__00 | 69 as = _mm_or_si128(as, _mm_slli_si128(as, 1)); // __33 __22 __11
__00 |
70 as = _mm_or_si128(as, _mm_slli_si128(as, 2)); // 3333 2222 1111
0000 | 70 as = _mm_or_si128(as, _mm_slli_si128(as, 2)); // 3333 2222 1111
0000 |
71 return Sk16b(as); | 71 return Sk16b(as); |
72 } | 72 } |
73 #endif | 73 #endif |
74 | 74 |
75 inline Sk4px Sk4px::Load2Alphas(const SkAlpha a[2]) { | 75 inline Sk4px Sk4px::Load2Alphas(const SkAlpha a[2]) { |
76 uint32_t as = *(const uint16_t*)a; // Aa -> Aa00 | 76 uint32_t as = *(const uint16_t*)a; // Aa -> Aa00 |
77 return Load4Alphas((const SkAlpha*)&as); | 77 return Load4Alphas((const SkAlpha*)&as); |
78 } | 78 } |
| 79 |
| 80 inline Sk4px Sk4px::zeroColors() const { |
| 81 return Sk16b(_mm_and_si128(_mm_set1_epi32(0xFF << SK_A32_SHIFT), this->fVec)
); |
| 82 } |
| 83 |
| 84 inline Sk4px Sk4px::zeroAlphas() const { |
| 85 // andnot(a,b) == ~a & b |
| 86 return Sk16b(_mm_andnot_si128(_mm_set1_epi32(0xFF << SK_A32_SHIFT), this->fV
ec)); |
| 87 } |
OLD | NEW |