Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: src/effects/gradients/Sk4fGradientPriv.h

Issue 2256023002: Flush denorm half floats to zero. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix threshold, clean up tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkXfermodeF16.cpp ('k') | tests/Float16Test.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 template <ApplyPremul premul> 134 template <ApplyPremul premul>
135 struct DstTraits<DstType::F16, premul> { 135 struct DstTraits<DstType::F16, premul> {
136 using PM = PremulTraits<premul>; 136 using PM = PremulTraits<premul>;
137 using Type = uint64_t; 137 using Type = uint64_t;
138 138
139 static Sk4f load(const SkPM4f& c) { 139 static Sk4f load(const SkPM4f& c) {
140 return c.to4f(); 140 return c.to4f();
141 } 141 }
142 142
143 static void store(const Sk4f& c, Type* dst) { 143 static void store(const Sk4f& c, Type* dst) {
144 SkFloatToHalf_finite(PM::apply(c)).store(dst); 144 SkFloatToHalf_finite_ftz(PM::apply(c)).store(dst);
145 } 145 }
146 146
147 static void store(const Sk4f& c, Type* dst, int n) { 147 static void store(const Sk4f& c, Type* dst, int n) {
148 uint64_t color; 148 uint64_t color;
149 SkFloatToHalf_finite(PM::apply(c)).store(&color); 149 SkFloatToHalf_finite_ftz(PM::apply(c)).store(&color);
150 sk_memset64(dst, color, n); 150 sk_memset64(dst, color, 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);
(...skipping 26 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « src/core/SkXfermodeF16.cpp ('k') | tests/Float16Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698