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

Side by Side Diff: bench/DashBench.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/CoverageBench.cpp ('k') | bench/DecodingBench.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 /* 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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 virtual void makePath(SkPath* path) { 56 virtual void makePath(SkPath* path) {
57 path_hline(path); 57 path_hline(path);
58 } 58 }
59 59
60 protected: 60 protected:
61 const char* onGetName() override { 61 const char* onGetName() override {
62 return fName.c_str(); 62 return fName.c_str();
63 } 63 }
64 64
65 void onDraw(const int loops, SkCanvas* canvas) override { 65 void onDraw(int loops, SkCanvas* canvas) override {
66 SkPaint paint; 66 SkPaint paint;
67 this->setupPaint(&paint); 67 this->setupPaint(&paint);
68 paint.setStyle(SkPaint::kStroke_Style); 68 paint.setStyle(SkPaint::kStroke_Style);
69 paint.setStrokeWidth(SkIntToScalar(fWidth)); 69 paint.setStrokeWidth(SkIntToScalar(fWidth));
70 paint.setAntiAlias(false); 70 paint.setAntiAlias(false);
71 71
72 SkPath path; 72 SkPath path;
73 this->makePath(&path); 73 this->makePath(&path);
74 74
75 paint.setPathEffect(SkDashPathEffect::Create(fIntervals.begin(), 75 paint.setPathEffect(SkDashPathEffect::Create(fIntervals.begin(),
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 SkScalar vals[] = { SkIntToScalar(4), SkIntToScalar(4) }; 188 SkScalar vals[] = { SkIntToScalar(4), SkIntToScalar(4) };
189 fPE.reset(SkDashPathEffect::Create(vals, 2, 0)); 189 fPE.reset(SkDashPathEffect::Create(vals, 2, 0));
190 } 190 }
191 191
192 protected: 192 protected:
193 const char* onGetName() override { 193 const char* onGetName() override {
194 return fName.c_str(); 194 return fName.c_str();
195 } 195 }
196 196
197 void onDraw(const int loops, SkCanvas*) override { 197 void onDraw(int loops, SkCanvas*) override {
198 SkPath dst; 198 SkPath dst;
199 for (int i = 0; i < loops; ++i) { 199 for (int i = 0; i < loops; ++i) {
200 SkStrokeRec rec(SkStrokeRec::kHairline_InitStyle); 200 SkStrokeRec rec(SkStrokeRec::kHairline_InitStyle);
201 201
202 fPE->filterPath(&dst, fPath, &rec, nullptr); 202 fPE->filterPath(&dst, fPath, &rec, nullptr);
203 dst.rewind(); 203 dst.rewind();
204 } 204 }
205 } 205 }
206 206
207 private: 207 private:
(...skipping 17 matching lines...) Expand all
225 225
226 SkScalar vals[] = { SK_Scalar1, SK_Scalar1 }; 226 SkScalar vals[] = { SK_Scalar1, SK_Scalar1 };
227 fPE.reset(SkDashPathEffect::Create(vals, 2, 0)); 227 fPE.reset(SkDashPathEffect::Create(vals, 2, 0));
228 } 228 }
229 229
230 protected: 230 protected:
231 const char* onGetName() override { 231 const char* onGetName() override {
232 return fName.c_str(); 232 return fName.c_str();
233 } 233 }
234 234
235 void onDraw(const int loops, SkCanvas* canvas) override { 235 void onDraw(int loops, SkCanvas* canvas) override {
236 SkPaint paint; 236 SkPaint paint;
237 this->setupPaint(&paint); 237 this->setupPaint(&paint);
238 paint.setStrokeWidth(fStrokeWidth); 238 paint.setStrokeWidth(fStrokeWidth);
239 paint.setStrokeCap(fIsRound ? SkPaint::kRound_Cap : SkPaint::kSquare_Cap ); 239 paint.setStrokeCap(fIsRound ? SkPaint::kRound_Cap : SkPaint::kSquare_Cap );
240 paint.setPathEffect(fPE); 240 paint.setPathEffect(fPE);
241 for (int i = 0; i < loops; ++i) { 241 for (int i = 0; i < loops; ++i) {
242 canvas->drawLine(10 * SK_Scalar1, 10 * SK_Scalar1, 242 canvas->drawLine(10 * SK_Scalar1, 10 * SK_Scalar1,
243 640 * SK_Scalar1, 10 * SK_Scalar1, paint); 243 640 * SK_Scalar1, 10 * SK_Scalar1, paint);
244 } 244 }
245 } 245 }
(...skipping 18 matching lines...) Expand all
264 264
265 SkScalar vals[] = { SkIntToScalar(dashLength), SkIntToScalar(dashLength) }; 265 SkScalar vals[] = { SkIntToScalar(dashLength), SkIntToScalar(dashLength) };
266 fPathEffect.reset(SkDashPathEffect::Create(vals, 2, SK_Scalar1)); 266 fPathEffect.reset(SkDashPathEffect::Create(vals, 2, SK_Scalar1));
267 } 267 }
268 268
269 protected: 269 protected:
270 const char* onGetName() override { 270 const char* onGetName() override {
271 return fName.c_str(); 271 return fName.c_str();
272 } 272 }
273 273
274 void onDraw(const int loops, SkCanvas* canvas) override { 274 void onDraw(int loops, SkCanvas* canvas) override {
275 SkPaint p; 275 SkPaint p;
276 this->setupPaint(&p); 276 this->setupPaint(&p);
277 p.setColor(SK_ColorBLACK); 277 p.setColor(SK_ColorBLACK);
278 p.setStyle(SkPaint::kStroke_Style); 278 p.setStyle(SkPaint::kStroke_Style);
279 p.setStrokeWidth(SkIntToScalar(fStrokeWidth)); 279 p.setStrokeWidth(SkIntToScalar(fStrokeWidth));
280 p.setPathEffect(fPathEffect); 280 p.setPathEffect(fPathEffect);
281 p.setAntiAlias(fDoAA); 281 p.setAntiAlias(fDoAA);
282 282
283 SkPoint pts[2] = { 283 SkPoint pts[2] = {
284 { SkIntToScalar(10), 0 }, 284 { SkIntToScalar(10), 0 },
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 { -overshoot, cy }, { 640 + overshoot, cy } 350 { -overshoot, cy }, { 640 + overshoot, cy }
351 }; 351 };
352 matrix.mapPoints(fPts, pts, 2); 352 matrix.mapPoints(fPts, pts, 2);
353 } 353 }
354 354
355 protected: 355 protected:
356 const char* onGetName() override { 356 const char* onGetName() override {
357 return fName.c_str(); 357 return fName.c_str();
358 } 358 }
359 359
360 void onDraw(const int loops, SkCanvas* canvas) override { 360 void onDraw(int loops, SkCanvas* canvas) override {
361 SkPaint p; 361 SkPaint p;
362 this->setupPaint(&p); 362 this->setupPaint(&p);
363 p.setStyle(SkPaint::kStroke_Style); 363 p.setStyle(SkPaint::kStroke_Style);
364 p.setStrokeWidth(fStrokeWidth); 364 p.setStrokeWidth(fStrokeWidth);
365 p.setPathEffect(fPathEffect); 365 p.setPathEffect(fPathEffect);
366 366
367 for (int i = 0; i < loops; i++) { 367 for (int i = 0; i < loops; i++) {
368 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p); 368 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p);
369 } 369 }
370 } 370 }
(...skipping 19 matching lines...) Expand all
390 390
391 SkScalar vals[] = { SkIntToScalar(dashLength), SkIntToScalar(dashLength) }; 391 SkScalar vals[] = { SkIntToScalar(dashLength), SkIntToScalar(dashLength) };
392 fPathEffect.reset(SkDashPathEffect::Create(vals, 2, SK_Scalar1)); 392 fPathEffect.reset(SkDashPathEffect::Create(vals, 2, SK_Scalar1));
393 } 393 }
394 394
395 protected: 395 protected:
396 const char* onGetName() override { 396 const char* onGetName() override {
397 return fName.c_str(); 397 return fName.c_str();
398 } 398 }
399 399
400 void onDraw(const int loops, SkCanvas* canvas) override { 400 void onDraw(int loops, SkCanvas* canvas) override {
401 SkPaint p; 401 SkPaint p;
402 this->setupPaint(&p); 402 this->setupPaint(&p);
403 p.setColor(SK_ColorBLACK); 403 p.setColor(SK_ColorBLACK);
404 p.setStyle(SkPaint::kStroke_Style); 404 p.setStyle(SkPaint::kStroke_Style);
405 p.setStrokeWidth(SkIntToScalar(fStrokeWidth)); 405 p.setStrokeWidth(SkIntToScalar(fStrokeWidth));
406 p.setPathEffect(fPathEffect); 406 p.setPathEffect(fPathEffect);
407 p.setAntiAlias(fDoAA); 407 p.setAntiAlias(fDoAA);
408 408
409 SkPoint pts[4] = { 409 SkPoint pts[4] = {
410 { SkIntToScalar(0), 20.5f }, 410 { SkIntToScalar(0), 20.5f },
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // hori_2 is just too slow to enable at the moment 480 // hori_2 is just too slow to enable at the moment
481 DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 2); ) 481 DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 2); )
482 DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 2); ) 482 DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 2); )
483 DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 2); ) 483 DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 2); )
484 484
485 DEF_BENCH( return new DashGridBench(1, 1, true); ) 485 DEF_BENCH( return new DashGridBench(1, 1, true); )
486 DEF_BENCH( return new DashGridBench(1, 1, false); ) 486 DEF_BENCH( return new DashGridBench(1, 1, false); )
487 DEF_BENCH( return new DashGridBench(3, 1, true); ) 487 DEF_BENCH( return new DashGridBench(3, 1, true); )
488 DEF_BENCH( return new DashGridBench(3, 1, false); ) 488 DEF_BENCH( return new DashGridBench(3, 1, false); )
489 #endif 489 #endif
OLDNEW
« no previous file with comments | « bench/CoverageBench.cpp ('k') | bench/DecodingBench.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698