OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkPMFloat.h" | 9 #include "SkPMFloat.h" |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 for (int n = 0; n < loops; n++) { | 114 for (int n = 0; n < loops; n++) { |
115 Sk4f a = c0 + dc*fx + Sk4f(0.5f), // The +0.5f lets us call trunc()
instead of get(). | 115 Sk4f a = c0 + dc*fx + Sk4f(0.5f), // The +0.5f lets us call trunc()
instead of get(). |
116 b = a + dcdx, | 116 b = a + dcdx, |
117 c = b + dcdx, | 117 c = b + dcdx, |
118 d = c + dcdx; | 118 d = c + dcdx; |
119 for (size_t i = 0; i < SK_ARRAY_COUNT(fDevice); i += 4) { | 119 for (size_t i = 0; i < SK_ARRAY_COUNT(fDevice); i += 4) { |
120 fDevice[i+0] = SkPMFloat(a).trunc(); | 120 fDevice[i+0] = SkPMFloat(a).trunc(); |
121 fDevice[i+1] = SkPMFloat(b).trunc(); | 121 fDevice[i+1] = SkPMFloat(b).trunc(); |
122 fDevice[i+2] = SkPMFloat(c).trunc(); | 122 fDevice[i+2] = SkPMFloat(c).trunc(); |
123 fDevice[i+3] = SkPMFloat(d).trunc(); | 123 fDevice[i+3] = SkPMFloat(d).trunc(); |
124 a += dcdx4; | 124 a = a + dcdx4; |
125 b += dcdx4; | 125 b = b + dcdx4; |
126 c += dcdx4; | 126 c = c + dcdx4; |
127 d += dcdx4; | 127 d = d + dcdx4; |
128 } | 128 } |
129 } | 129 } |
130 } | 130 } |
131 }; | 131 }; |
132 | 132 |
133 DEF_BENCH(return new PMFloatGradientBench;) | 133 DEF_BENCH(return new PMFloatGradientBench;) |
OLD | NEW |