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

Side by Side Diff: bench/RectoriBench.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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 "SkRandom.h" 13 #include "SkRandom.h"
14 14
15 // This bench replicates a problematic use case of a draw looper used 15 // This bench replicates a problematic use case of a draw looper used
16 // to create an inner blurred rect 16 // to create an inner blurred rect
17 class RectoriBench : public Benchmark { 17 class RectoriBench : public Benchmark {
18 public: 18 public:
19 RectoriBench() {} 19 RectoriBench() {}
20 20
21 protected: 21 protected:
22 22
23 virtual const char* onGetName() SK_OVERRIDE { 23 const char* onGetName() SK_OVERRIDE {
24 return "rectori"; 24 return "rectori";
25 } 25 }
26 26
27 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 27 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
28 SkRandom Random; 28 SkRandom Random;
29 29
30 for (int i = 0; i < loops; i++) { 30 for (int i = 0; i < loops; i++) {
31 SkScalar blurSigma = Random.nextRangeScalar(1.5f, 25.0f); 31 SkScalar blurSigma = Random.nextRangeScalar(1.5f, 25.0f);
32 SkScalar size = Random.nextRangeScalar(20*blurSigma, 50*blurSigma); 32 SkScalar size = Random.nextRangeScalar(20*blurSigma, 50*blurSigma);
33 33
34 SkScalar x = Random.nextRangeScalar(0.0f, W - size); 34 SkScalar x = Random.nextRangeScalar(0.0f, W - size);
35 SkScalar y = Random.nextRangeScalar(0.0f, H - size); 35 SkScalar y = Random.nextRangeScalar(0.0f, H - size);
36 36
37 SkRect inner = { x, y, x + size, y + size }; 37 SkRect inner = { x, y, x + size, y + size };
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 info.fOffset.set(0, 0); 95 info.fOffset.set(0, 0);
96 96
97 paint = looperBuilder.addLayer(info); 97 paint = looperBuilder.addLayer(info);
98 return looperBuilder.detachLooper(); 98 return looperBuilder.detachLooper();
99 } 99 }
100 100
101 typedef Benchmark INHERITED; 101 typedef Benchmark INHERITED;
102 }; 102 };
103 103
104 DEF_BENCH( return SkNEW_ARGS(RectoriBench, ()); ) 104 DEF_BENCH( return SkNEW_ARGS(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