| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 return x; | 78 return x; |
| 79 } | 79 } |
| 80 static uint8_t Compact(unsigned x) { | 80 static uint8_t Compact(unsigned x) { |
| 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_01(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_01(x); | 91 return SkFloatToHalf_finite(x); |
| 92 } | 92 } |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 template <typename T> T add_121(const T& a, const T& b, const T& c) { | 95 template <typename T> T add_121(const T& a, const T& b, const T& c) { |
| 96 return a + b + b + c; | 96 return a + b + b + c; |
| 97 } | 97 } |
| 98 | 98 |
| 99 template <typename T> T shift_right(const T& x, int bits) { | 99 template <typename T> T shift_right(const T& x, int bits) { |
| 100 return x >> bits; | 100 return x >> bits; |
| 101 } | 101 } |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 return false; | 625 return false; |
| 626 } | 626 } |
| 627 if (index > fCount - 1) { | 627 if (index > fCount - 1) { |
| 628 return false; | 628 return false; |
| 629 } | 629 } |
| 630 if (levelPtr) { | 630 if (levelPtr) { |
| 631 *levelPtr = fLevels[index]; | 631 *levelPtr = fLevels[index]; |
| 632 } | 632 } |
| 633 return true; | 633 return true; |
| 634 } | 634 } |
| OLD | NEW |