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

Unified Diff: bench/PMFloatBench.cpp

Issue 1032243002: SkPMFloat::trunc() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove isValid assert in _none trunc() Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « HASHTAGS ('k') | src/core/SkPMFloat.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/PMFloatBench.cpp
diff --git a/bench/PMFloatBench.cpp b/bench/PMFloatBench.cpp
index d748144c4bc728a52adea863afc05c96cf84cc1c..09819e9962f6b55edeb260d9007f0cde4810fe05 100644
--- a/bench/PMFloatBench.cpp
+++ b/bench/PMFloatBench.cpp
@@ -112,15 +112,15 @@ struct PMFloatGradientBench : public Benchmark {
dcdx4(dcdx+dcdx+dcdx+dcdx);
for (int n = 0; n < loops; n++) {
- Sk4f a = c0 + dc*fx, // TODO: add 0.5f, here call trunc() instead of get().
+ Sk4f a = c0 + dc*fx + Sk4f(0.5f), // The +0.5f lets us call trunc() instead of get().
b = a + dcdx,
c = b + dcdx,
d = c + dcdx;
for (size_t i = 0; i < SK_ARRAY_COUNT(fDevice); i += 4) {
- fDevice[i+0] = SkPMFloat(a).get();
- fDevice[i+1] = SkPMFloat(b).get();
- fDevice[i+2] = SkPMFloat(c).get();
- fDevice[i+3] = SkPMFloat(d).get();
+ fDevice[i+0] = SkPMFloat(a).trunc();
+ fDevice[i+1] = SkPMFloat(b).trunc();
+ fDevice[i+2] = SkPMFloat(c).trunc();
+ fDevice[i+3] = SkPMFloat(d).trunc();
a += dcdx4;
b += dcdx4;
c += dcdx4;
« no previous file with comments | « HASHTAGS ('k') | src/core/SkPMFloat.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698