OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkMipMap.h" | 8 #include "SkMipMap.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 return (uint8_t)x; | 81 return (uint8_t)x; |
82 } | 82 } |
83 }; | 83 }; |
84 | 84 |
85 struct ColorTypeFilter_F16 { | 85 struct ColorTypeFilter_F16 { |
86 typedef uint64_t Type; // SkHalf x4 | 86 typedef uint64_t Type; // SkHalf x4 |
87 static Sk4f Expand(uint64_t x) { | 87 static Sk4f Expand(uint64_t x) { |
88 return SkHalfToFloat_finite(x); | 88 return SkHalfToFloat_finite(x); |
89 } | 89 } |
90 static uint64_t Compact(const Sk4f& x) { | 90 static uint64_t Compact(const Sk4f& x) { |
91 return SkFloatToHalf_finite(x); | 91 uint64_t r; |
| 92 SkFloatToHalf_finite(x).store(&r); |
| 93 return r; |
92 } | 94 } |
93 }; | 95 }; |
94 | 96 |
95 template <typename T> T add_121(const T& a, const T& b, const T& c) { | 97 template <typename T> T add_121(const T& a, const T& b, const T& c) { |
96 return a + b + b + c; | 98 return a + b + b + c; |
97 } | 99 } |
98 | 100 |
99 template <typename T> T shift_right(const T& x, int bits) { | 101 template <typename T> T shift_right(const T& x, int bits) { |
100 return x >> bits; | 102 return x >> bits; |
101 } | 103 } |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 return false; | 627 return false; |
626 } | 628 } |
627 if (index > fCount - 1) { | 629 if (index > fCount - 1) { |
628 return false; | 630 return false; |
629 } | 631 } |
630 if (levelPtr) { | 632 if (levelPtr) { |
631 *levelPtr = fLevels[index]; | 633 *levelPtr = fLevels[index]; |
632 } | 634 } |
633 return true; | 635 return true; |
634 } | 636 } |
OLD | NEW |