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 "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkNx.h" | 10 #include "SkNx.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 dx(0.002f), | 55 dx(0.002f), |
56 dcdx(dc*dx), | 56 dcdx(dc*dx), |
57 dcdx4(dcdx+dcdx+dcdx+dcdx); | 57 dcdx4(dcdx+dcdx+dcdx+dcdx); |
58 | 58 |
59 for (int n = 0; n < loops; n++) { | 59 for (int n = 0; n < loops; n++) { |
60 Sk4f a = c0 + dc*fx + Sk4f(0.5f), // add an extra 0.5f to get round
ing for free. | 60 Sk4f a = c0 + dc*fx + Sk4f(0.5f), // add an extra 0.5f to get round
ing for free. |
61 b = a + dcdx, | 61 b = a + dcdx, |
62 c = b + dcdx, | 62 c = b + dcdx, |
63 d = c + dcdx; | 63 d = c + dcdx; |
64 for (size_t i = 0; i < SK_ARRAY_COUNT(fDevice); i += 4) { | 64 for (size_t i = 0; i < SK_ARRAY_COUNT(fDevice); i += 4) { |
65 a.toBytes((uint8_t*)(fDevice+i+0)); | 65 Sk4f::ToBytes((uint8_t*)(fDevice+i), a, b, c, d); |
66 b.toBytes((uint8_t*)(fDevice+i+1)); | |
67 c.toBytes((uint8_t*)(fDevice+i+2)); | |
68 d.toBytes((uint8_t*)(fDevice+i+3)); | |
69 a = a + dcdx4; | 66 a = a + dcdx4; |
70 b = b + dcdx4; | 67 b = b + dcdx4; |
71 c = c + dcdx4; | 68 c = c + dcdx4; |
72 d = d + dcdx4; | 69 d = d + dcdx4; |
73 } | 70 } |
74 } | 71 } |
75 } | 72 } |
76 }; | 73 }; |
77 DEF_BENCH(return new Sk4fGradientBench;) | 74 DEF_BENCH(return new Sk4fGradientBench;) |
OLD | NEW |