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 #include "SkUtils.h" | 8 #include "SkUtils.h" |
9 | 9 |
10 namespace { // See Sk4px.h | 10 namespace { // See Sk4px.h |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 inline Sk4px Sk4px::zeroColors() const { | 95 inline Sk4px Sk4px::zeroColors() const { |
96 static_assert(SK_A32_SHIFT == 24, "This method assumes little-endian."); | 96 static_assert(SK_A32_SHIFT == 24, "This method assumes little-endian."); |
97 return Sk16b(0,0,0, this->kth< 3>(), | 97 return Sk16b(0,0,0, this->kth< 3>(), |
98 0,0,0, this->kth< 7>(), | 98 0,0,0, this->kth< 7>(), |
99 0,0,0, this->kth<11>(), | 99 0,0,0, this->kth<11>(), |
100 0,0,0, this->kth<15>()); | 100 0,0,0, this->kth<15>()); |
101 } | 101 } |
102 | 102 |
| 103 inline Sk4px Sk4px::Load4(const SkPMColor16 src[4]) { |
| 104 SkPMColor src32[4]; |
| 105 for (int i = 0; i < 4; i++) { src32[i] = SkPixel16ToPixel32(src[i]); } |
| 106 return Load4(src32); |
| 107 } |
| 108 inline Sk4px Sk4px::Load2(const SkPMColor16 src[2]) { |
| 109 SkPMColor src32[2]; |
| 110 for (int i = 0; i < 2; i++) { src32[i] = SkPixel16ToPixel32(src[i]); } |
| 111 return Load2(src32); |
| 112 } |
| 113 inline Sk4px Sk4px::Load1(const SkPMColor16 src[1]) { |
| 114 SkPMColor src32 = SkPixel16ToPixel32(src[0]); |
| 115 return Load1(&src32); |
| 116 } |
| 117 |
| 118 inline void Sk4px::store4(SkPMColor16 dst[4]) const { |
| 119 SkPMColor dst32[4]; |
| 120 this->store4(dst32); |
| 121 for (int i = 0; i < 4; i++) { dst[i] = SkPixel32ToPixel16(dst32[i]); } |
| 122 } |
| 123 inline void Sk4px::store2(SkPMColor16 dst[2]) const { |
| 124 SkPMColor dst32[2]; |
| 125 this->store2(dst32); |
| 126 for (int i = 0; i < 2; i++) { dst[i] = SkPixel32ToPixel16(dst32[i]); } |
| 127 } |
| 128 inline void Sk4px::store1(SkPMColor16 dst[1]) const { |
| 129 SkPMColor dst32; |
| 130 this->store1(&dst32); |
| 131 dst[0] = SkPixel32ToPixel16(dst32); |
| 132 } |
| 133 |
103 } // namespace | 134 } // namespace |
OLD | NEW |