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

Side by Side Diff: bench/RectBench.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/RecordingBench.cpp ('k') | bench/RectanizerBench.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 2011 Google Inc. 3 * Copyright 2011 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 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 h >>= fShift; 60 h >>= fShift;
61 x -= w/2; 61 x -= w/2;
62 y -= h/2; 62 y -= h/2;
63 fRects[i].set(SkIntToScalar(x), SkIntToScalar(y), 63 fRects[i].set(SkIntToScalar(x), SkIntToScalar(y),
64 SkIntToScalar(x+w), SkIntToScalar(y+h)); 64 SkIntToScalar(x+w), SkIntToScalar(y+h));
65 fRects[i].offset(offset, offset); 65 fRects[i].offset(offset, offset);
66 fColors[i] = rand.nextU() | 0xFF808080; 66 fColors[i] = rand.nextU() | 0xFF808080;
67 } 67 }
68 } 68 }
69 69
70 void onDraw(const int loops, SkCanvas* canvas) override { 70 void onDraw(int loops, SkCanvas* canvas) override {
71 SkPaint paint; 71 SkPaint paint;
72 if (fStroke > 0) { 72 if (fStroke > 0) {
73 paint.setStyle(SkPaint::kStroke_Style); 73 paint.setStyle(SkPaint::kStroke_Style);
74 paint.setStrokeWidth(SkIntToScalar(fStroke)); 74 paint.setStrokeWidth(SkIntToScalar(fStroke));
75 } 75 }
76 for (int i = 0; i < loops; i++) { 76 for (int i = 0; i < loops; i++) {
77 paint.setColor(fColors[i % N]); 77 paint.setColor(fColors[i % N]);
78 this->setupPaint(&paint); 78 this->setupPaint(&paint);
79 this->drawThisRect(canvas, fRects[i % N], paint); 79 this->drawThisRect(canvas, fRects[i % N], paint);
80 } 80 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 SkCanvas::PointMode fMode; 163 SkCanvas::PointMode fMode;
164 const char* fName; 164 const char* fName;
165 165
166 PointsBench(SkCanvas::PointMode mode, const char* name) 166 PointsBench(SkCanvas::PointMode mode, const char* name)
167 : RectBench(2) 167 : RectBench(2)
168 , fMode(mode) { 168 , fMode(mode) {
169 fName = name; 169 fName = name;
170 } 170 }
171 171
172 protected: 172 protected:
173 void onDraw(const int loops, SkCanvas* canvas) override { 173 void onDraw(int loops, SkCanvas* canvas) override {
174 SkScalar gSizes[] = { 174 SkScalar gSizes[] = {
175 SkIntToScalar(7), 0 175 SkIntToScalar(7), 0
176 }; 176 };
177 size_t sizes = SK_ARRAY_COUNT(gSizes); 177 size_t sizes = SK_ARRAY_COUNT(gSizes);
178 178
179 if (FLAGS_strokeWidth >= 0) { 179 if (FLAGS_strokeWidth >= 0) {
180 gSizes[0] = (SkScalar)FLAGS_strokeWidth; 180 gSizes[0] = (SkScalar)FLAGS_strokeWidth;
181 sizes = 1; 181 sizes = 1;
182 } 182 }
183 183
(...skipping 27 matching lines...) Expand all
211 SkCanvas::PointMode fMode; 211 SkCanvas::PointMode fMode;
212 const char* fName; 212 const char* fName;
213 213
214 BlitMaskBench(SkCanvas::PointMode mode, 214 BlitMaskBench(SkCanvas::PointMode mode,
215 BlitMaskBench::kMaskType type, const char* name) : 215 BlitMaskBench::kMaskType type, const char* name) :
216 RectBench(2), fMode(mode), _type(type) { 216 RectBench(2), fMode(mode), _type(type) {
217 fName = name; 217 fName = name;
218 } 218 }
219 219
220 protected: 220 protected:
221 void onDraw(const int loops, SkCanvas* canvas) override { 221 void onDraw(int loops, SkCanvas* canvas) override {
222 SkScalar gSizes[] = { 222 SkScalar gSizes[] = {
223 SkIntToScalar(13), SkIntToScalar(24) 223 SkIntToScalar(13), SkIntToScalar(24)
224 }; 224 };
225 size_t sizes = SK_ARRAY_COUNT(gSizes); 225 size_t sizes = SK_ARRAY_COUNT(gSizes);
226 226
227 if (FLAGS_strokeWidth >= 0) { 227 if (FLAGS_strokeWidth >= 0) {
228 gSizes[0] = (SkScalar)FLAGS_strokeWidth; 228 gSizes[0] = (SkScalar)FLAGS_strokeWidth;
229 sizes = 1; 229 sizes = 1;
230 } 230 }
231 SkRandom rand; 231 SkRandom rand;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 "maskopaque");) 302 "maskopaque");)
303 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 303 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
304 BlitMaskBench::kMaskBlack, 304 BlitMaskBench::kMaskBlack,
305 "maskblack");) 305 "maskblack");)
306 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 306 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
307 BlitMaskBench::kMaskColor, 307 BlitMaskBench::kMaskColor,
308 "maskcolor");) 308 "maskcolor");)
309 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, 309 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode,
310 BlitMaskBench::KMaskShader, 310 BlitMaskBench::KMaskShader,
311 "maskshader");) 311 "maskshader");)
OLDNEW
« no previous file with comments | « bench/RecordingBench.cpp ('k') | bench/RectanizerBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698