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_finite(PM::apply(c)); | 146 SkFloatToHalf_finite(PM::apply(c)).store(dst); |
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_finite(PM::apply(c)), n); | 150 uint64_t color; |
| 151 SkFloatToHalf_finite(PM::apply(c)).store(&color); |
| 152 sk_memset64(dst, color, n); |
151 } | 153 } |
152 | 154 |
153 static void store4x(const Sk4f& c0, const Sk4f& c1, | 155 static void store4x(const Sk4f& c0, const Sk4f& c1, |
154 const Sk4f& c2, const Sk4f& c3, | 156 const Sk4f& c2, const Sk4f& c3, |
155 Type* dst) { | 157 Type* dst) { |
156 store(c0, dst + 0); | 158 store(c0, dst + 0); |
157 store(c1, dst + 1); | 159 store(c1, dst + 1); |
158 store(c2, dst + 2); | 160 store(c2, dst + 2); |
159 store(c3, dst + 3); | 161 store(c3, dst + 3); |
160 } | 162 } |
(...skipping 25 matching lines...) Expand all Loading... |
186 store(c0, dst + 0); | 188 store(c0, dst + 0); |
187 store(c1, dst + 1); | 189 store(c1, dst + 1); |
188 store(c2, dst + 2); | 190 store(c2, dst + 2); |
189 store(c3, dst + 3); | 191 store(c3, dst + 3); |
190 } | 192 } |
191 }; | 193 }; |
192 | 194 |
193 } // anonymous namespace | 195 } // anonymous namespace |
194 | 196 |
195 #endif // Sk4fGradientPriv_DEFINED | 197 #endif // Sk4fGradientPriv_DEFINED |
OLD | NEW |