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