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

Side by Side Diff: bench/Sk4fBench.cpp

Issue 1679343004: Revert of Sk4f: add floor() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
59 struct Sk4fGradientBench : public Benchmark { 43 struct Sk4fGradientBench : public Benchmark {
60 const char* onGetName() override { return "Sk4f_gradient"; } 44 const char* onGetName() override { return "Sk4f_gradient"; }
61 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; } 45 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
62 46
63 SkPMColor fDevice[100]; 47 SkPMColor fDevice[100];
64 void onDraw(int loops, SkCanvas*) override { 48 void onDraw(int loops, SkCanvas*) override {
65 Sk4f c0(0,0,255,255), 49 Sk4f c0(0,0,255,255),
66 c1(255,0,0,255), 50 c1(255,0,0,255),
67 dc = c1 - c0, 51 dc = c1 - c0,
68 fx(0.1f), 52 fx(0.1f),
(...skipping 10 matching lines...) Expand all
79 Sk4f_ToBytes((uint8_t*)(fDevice+i), a, b, c, d); 63 Sk4f_ToBytes((uint8_t*)(fDevice+i), a, b, c, d);
80 a = a + dcdx4; 64 a = a + dcdx4;
81 b = b + dcdx4; 65 b = b + dcdx4;
82 c = c + dcdx4; 66 c = c + dcdx4;
83 d = d + dcdx4; 67 d = d + dcdx4;
84 } 68 }
85 } 69 }
86 } 70 }
87 }; 71 };
88 DEF_BENCH(return new Sk4fGradientBench;) 72 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