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

Side by Side Diff: bench/XfermodeBench.cpp

Issue 1379923005: Remove const from `const int loops`. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: n too Created 5 years, 2 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 | « bench/WriterBench.cpp ('k') | bench/nanobench.cpp » ('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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "Benchmark.h" 9 #include "Benchmark.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 15 matching lines...) Expand all
26 XfermodeBench(SkXfermode* xferMode, const char* name, bool aa) { 26 XfermodeBench(SkXfermode* xferMode, const char* name, bool aa) {
27 SkASSERT(xferMode); 27 SkASSERT(xferMode);
28 fXfermode.reset(xferMode); 28 fXfermode.reset(xferMode);
29 fAA = aa; 29 fAA = aa;
30 fName.printf("Xfermode_%s%s", name, aa ? "_aa" : ""); 30 fName.printf("Xfermode_%s%s", name, aa ? "_aa" : "");
31 } 31 }
32 32
33 protected: 33 protected:
34 const char* onGetName() override { return fName.c_str(); } 34 const char* onGetName() override { return fName.c_str(); }
35 35
36 void onDraw(const int loops, SkCanvas* canvas) override { 36 void onDraw(int loops, SkCanvas* canvas) override {
37 const char* text = "Hamburgefons"; 37 const char* text = "Hamburgefons";
38 size_t len = strlen(text); 38 size_t len = strlen(text);
39 SkISize size = canvas->getDeviceSize(); 39 SkISize size = canvas->getDeviceSize();
40 SkRandom random; 40 SkRandom random;
41 for (int i = 0; i < loops; ++i) { 41 for (int i = 0; i < loops; ++i) {
42 SkPaint paint; 42 SkPaint paint;
43 paint.setXfermode(fXfermode.get()); 43 paint.setXfermode(fXfermode.get());
44 paint.setColor(random.nextU()); 44 paint.setColor(random.nextU());
45 if (fAA) { 45 if (fAA) {
46 // Draw text to exercise AA code paths. 46 // Draw text to exercise AA code paths.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 class XferCreateBench : public Benchmark { 79 class XferCreateBench : public Benchmark {
80 public: 80 public:
81 bool isSuitableFor(Backend backend) override { 81 bool isSuitableFor(Backend backend) override {
82 return backend == kNonRendering_Backend; 82 return backend == kNonRendering_Backend;
83 } 83 }
84 84
85 protected: 85 protected:
86 const char* onGetName() override { return "xfermode_create"; } 86 const char* onGetName() override { return "xfermode_create"; }
87 87
88 void onDraw(const int loops, SkCanvas* canvas) override { 88 void onDraw(int loops, SkCanvas* canvas) override {
89 for (int outer = 0; outer < loops * 10; ++outer) { 89 for (int outer = 0; outer < loops * 10; ++outer) {
90 for (int i = 0; i <= SkXfermode::kLastMode; ++i) { 90 for (int i = 0; i <= SkXfermode::kLastMode; ++i) {
91 SkXfermode* xfer = SkXfermode::Create(SkXfermode::Mode(i)); 91 SkXfermode* xfer = SkXfermode::Create(SkXfermode::Mode(i));
92 SkSafeUnref(xfer); 92 SkSafeUnref(xfer);
93 } 93 }
94 } 94 }
95 } 95 }
96 96
97 private: 97 private:
98 typedef Benchmark INHERITED; 98 typedef Benchmark INHERITED;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 BENCH(SkXfermode::kDifference_Mode) 131 BENCH(SkXfermode::kDifference_Mode)
132 BENCH(SkXfermode::kExclusion_Mode) 132 BENCH(SkXfermode::kExclusion_Mode)
133 BENCH(SkXfermode::kMultiply_Mode) 133 BENCH(SkXfermode::kMultiply_Mode)
134 134
135 BENCH(SkXfermode::kHue_Mode) 135 BENCH(SkXfermode::kHue_Mode)
136 BENCH(SkXfermode::kSaturation_Mode) 136 BENCH(SkXfermode::kSaturation_Mode)
137 BENCH(SkXfermode::kColor_Mode) 137 BENCH(SkXfermode::kColor_Mode)
138 BENCH(SkXfermode::kLuminosity_Mode) 138 BENCH(SkXfermode::kLuminosity_Mode)
139 139
140 DEF_BENCH(return new XferCreateBench;) 140 DEF_BENCH(return new XferCreateBench;)
OLDNEW
« no previous file with comments | « bench/WriterBench.cpp ('k') | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698