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

Side by Side Diff: bench/RectoriBench.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/RectanizerBench.cpp ('k') | bench/RefCntBench.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkLayerDrawLooper.h" 11 #include "SkLayerDrawLooper.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkPath.h" 13 #include "SkPath.h"
14 #include "SkRandom.h" 14 #include "SkRandom.h"
15 15
16 // This bench replicates a problematic use case of a draw looper used 16 // This bench replicates a problematic use case of a draw looper used
17 // to create an inner blurred rect 17 // to create an inner blurred rect
18 class RectoriBench : public Benchmark { 18 class RectoriBench : public Benchmark {
19 public: 19 public:
20 RectoriBench() {} 20 RectoriBench() {}
21 21
22 protected: 22 protected:
23 23
24 const char* onGetName() override { 24 const char* onGetName() override {
25 return "rectori"; 25 return "rectori";
26 } 26 }
27 27
28 void onDraw(const int loops, SkCanvas* canvas) override { 28 void onDraw(int loops, SkCanvas* canvas) override {
29 SkRandom Random; 29 SkRandom Random;
30 30
31 for (int i = 0; i < loops; i++) { 31 for (int i = 0; i < loops; i++) {
32 SkScalar blurSigma = Random.nextRangeScalar(1.5f, 25.0f); 32 SkScalar blurSigma = Random.nextRangeScalar(1.5f, 25.0f);
33 SkScalar size = Random.nextRangeScalar(20*blurSigma, 50*blurSigma); 33 SkScalar size = Random.nextRangeScalar(20*blurSigma, 50*blurSigma);
34 34
35 SkScalar x = Random.nextRangeScalar(0.0f, W - size); 35 SkScalar x = Random.nextRangeScalar(0.0f, W - size);
36 SkScalar y = Random.nextRangeScalar(0.0f, H - size); 36 SkScalar y = Random.nextRangeScalar(0.0f, H - size);
37 37
38 SkRect inner = { x, y, x + size, y + size }; 38 SkRect inner = { x, y, x + size, y + size };
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 info.fOffset.set(0, 0); 96 info.fOffset.set(0, 0);
97 97
98 paint = looperBuilder.addLayer(info); 98 paint = looperBuilder.addLayer(info);
99 return looperBuilder.detachLooper(); 99 return looperBuilder.detachLooper();
100 } 100 }
101 101
102 typedef Benchmark INHERITED; 102 typedef Benchmark INHERITED;
103 }; 103 };
104 104
105 DEF_BENCH(return new RectoriBench();) 105 DEF_BENCH(return new RectoriBench();)
OLDNEW
« no previous file with comments | « bench/RectanizerBench.cpp ('k') | bench/RefCntBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698