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

Side by Side Diff: bench/Sk4fBench.cpp

Issue 1685773002: Sk4f: add floor() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add a bench Created 4 years, 10 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 | « no previous file | src/core/SkNx.h » ('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 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 22 matching lines...) Expand all
33 while (loops --> 0) { 33 while (loops --> 0) {
34 fs = SkNx_cast<float>(SkNx_cast<T>(fs)); 34 fs = SkNx_cast<float>(SkNx_cast<T>(fs));
35 } 35 }
36 fs.store((float*)blackhole); 36 fs.store((float*)blackhole);
37 } 37 }
38 }; 38 };
39 DEF_BENCH(return new Sk4fRoundtripBench<uint8_t>;) 39 DEF_BENCH(return new Sk4fRoundtripBench<uint8_t>;)
40 DEF_BENCH(return new Sk4fRoundtripBench<uint16_t>;) 40 DEF_BENCH(return new Sk4fRoundtripBench<uint16_t>;)
41 DEF_BENCH(return new Sk4fRoundtripBench<int>;) 41 DEF_BENCH(return new Sk4fRoundtripBench<int>;)
42 42
43 struct Sk4fFloorBench : public Benchmark {
44 Sk4fFloorBench() {}
45
46 const char* onGetName() override { return "Sk4f_floor"; }
47 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
48
49 void onDraw(int loops, SkCanvas* canvas) override {
50 Sk4f fs(1,2,3,4);
51 while (loops --> 0) {
52 fs = fs.floor();
53 }
54 fs.store((float*)blackhole);
55 }
56 };
57 DEF_BENCH(return new Sk4fFloorBench;)
58
43 struct Sk4fGradientBench : public Benchmark { 59 struct Sk4fGradientBench : public Benchmark {
44 const char* onGetName() override { return "Sk4f_gradient"; } 60 const char* onGetName() override { return "Sk4f_gradient"; }
45 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; } 61 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
46 62
47 SkPMColor fDevice[100]; 63 SkPMColor fDevice[100];
48 void onDraw(int loops, SkCanvas*) override { 64 void onDraw(int loops, SkCanvas*) override {
49 Sk4f c0(0,0,255,255), 65 Sk4f c0(0,0,255,255),
50 c1(255,0,0,255), 66 c1(255,0,0,255),
51 dc = c1 - c0, 67 dc = c1 - c0,
52 fx(0.1f), 68 fx(0.1f),
(...skipping 10 matching lines...) Expand all
63 Sk4f_ToBytes((uint8_t*)(fDevice+i), a, b, c, d); 79 Sk4f_ToBytes((uint8_t*)(fDevice+i), a, b, c, d);
64 a = a + dcdx4; 80 a = a + dcdx4;
65 b = b + dcdx4; 81 b = b + dcdx4;
66 c = c + dcdx4; 82 c = c + dcdx4;
67 d = d + dcdx4; 83 d = d + dcdx4;
68 } 84 }
69 } 85 }
70 } 86 }
71 }; 87 };
72 DEF_BENCH(return new Sk4fGradientBench;) 88 DEF_BENCH(return new Sk4fGradientBench;)
OLDNEW
« no previous file with comments | « no previous file | src/core/SkNx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698