OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #ifndef Sk4fGradientPriv_DEFINED | 8 #ifndef Sk4fGradientPriv_DEFINED |
9 #define Sk4fGradientPriv_DEFINED | 9 #define Sk4fGradientPriv_DEFINED |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 template <ApplyPremul premul> | 136 template <ApplyPremul premul> |
137 struct DstTraits<DstType::F16, premul> { | 137 struct DstTraits<DstType::F16, premul> { |
138 using PM = PremulTraits<premul>; | 138 using PM = PremulTraits<premul>; |
139 using Type = uint64_t; | 139 using Type = uint64_t; |
140 | 140 |
141 static Sk4f load(const SkPM4f& c) { | 141 static Sk4f load(const SkPM4f& c) { |
142 return c.to4f(); | 142 return c.to4f(); |
143 } | 143 } |
144 | 144 |
145 static void store(const Sk4f& c, Type* dst) { | 145 static void store(const Sk4f& c, Type* dst) { |
146 *dst = SkFloatToHalf_01(PM::apply(c)); | 146 *dst = SkFloatToHalf_finite(PM::apply(c)); |
147 } | 147 } |
148 | 148 |
149 static void store(const Sk4f& c, Type* dst, int n) { | 149 static void store(const Sk4f& c, Type* dst, int n) { |
150 sk_memset64(dst, SkFloatToHalf_01(PM::apply(c)), n); | 150 sk_memset64(dst, SkFloatToHalf_finite(PM::apply(c)), n); |
151 } | 151 } |
152 | 152 |
153 static void store4x(const Sk4f& c0, const Sk4f& c1, | 153 static void store4x(const Sk4f& c0, const Sk4f& c1, |
154 const Sk4f& c2, const Sk4f& c3, | 154 const Sk4f& c2, const Sk4f& c3, |
155 Type* dst) { | 155 Type* dst) { |
156 store(c0, dst + 0); | 156 store(c0, dst + 0); |
157 store(c1, dst + 1); | 157 store(c1, dst + 1); |
158 store(c2, dst + 2); | 158 store(c2, dst + 2); |
159 store(c3, dst + 3); | 159 store(c3, dst + 3); |
160 } | 160 } |
(...skipping 25 matching lines...) Expand all Loading... |
186 store(c0, dst + 0); | 186 store(c0, dst + 0); |
187 store(c1, dst + 1); | 187 store(c1, dst + 1); |
188 store(c2, dst + 2); | 188 store(c2, dst + 2); |
189 store(c3, dst + 3); | 189 store(c3, dst + 3); |
190 } | 190 } |
191 }; | 191 }; |
192 | 192 |
193 } // anonymous namespace | 193 } // anonymous namespace |
194 | 194 |
195 #endif // Sk4fGradientPriv_DEFINED | 195 #endif // Sk4fGradientPriv_DEFINED |
OLD | NEW |