| 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 |
| 11 |
| 10 static_assert(sizeof(Sk4px) == 16, "This file uses memcpy / sk_memset32, so exac
t size matters."); | 12 static_assert(sizeof(Sk4px) == 16, "This file uses memcpy / sk_memset32, so exac
t size matters."); |
| 11 | 13 |
| 12 inline Sk4px::Sk4px(SkPMColor px) { | 14 inline Sk4px::Sk4px(SkPMColor px) { |
| 13 sk_memset32((uint32_t*)this, px, 4); | 15 sk_memset32((uint32_t*)this, px, 4); |
| 14 } | 16 } |
| 15 | 17 |
| 16 inline Sk4px Sk4px::Load4(const SkPMColor px[4]) { | 18 inline Sk4px Sk4px::Load4(const SkPMColor px[4]) { |
| 17 Sk4px px4 = Sk16b(); | 19 Sk4px px4 = Sk16b(); |
| 18 memcpy(&px4, px, 16); | 20 memcpy(&px4, px, 16); |
| 19 return px4; | 21 return px4; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 89 } |
| 88 | 90 |
| 89 inline Sk4px Sk4px::zeroColors() const { | 91 inline Sk4px Sk4px::zeroColors() const { |
| 90 static_assert(SK_A32_SHIFT == 24, "This method assumes little-endian."); | 92 static_assert(SK_A32_SHIFT == 24, "This method assumes little-endian."); |
| 91 return Sk16b(0,0,0, this->kth< 3>(), | 93 return Sk16b(0,0,0, this->kth< 3>(), |
| 92 0,0,0, this->kth< 7>(), | 94 0,0,0, this->kth< 7>(), |
| 93 0,0,0, this->kth<11>(), | 95 0,0,0, this->kth<11>(), |
| 94 0,0,0, this->kth<15>()); | 96 0,0,0, this->kth<15>()); |
| 95 } | 97 } |
| 96 | 98 |
| 99 } // namespace |
| OLD | NEW |