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

Side by Side Diff: bench/BitmapScaleBench.cpp

Issue 23876006: Refactoring: get rid of the SkBenchmark void* parameter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync to head Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « bench/BitmapRectBench.cpp ('k') | bench/BlurBench.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 "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
11 #include "SkRandom.h" 11 #include "SkRandom.h"
12 #include "SkShader.h" 12 #include "SkShader.h"
13 #include "SkString.h" 13 #include "SkString.h"
14 #include "SkBlurMask.h" 14 #include "SkBlurMask.h"
15 15
16 class BitmapScaleBench: public SkBenchmark { 16 class BitmapScaleBench: public SkBenchmark {
17 int fLoopCount; 17 int fLoopCount;
18 int fInputSize; 18 int fInputSize;
19 int fOutputSize; 19 int fOutputSize;
20 SkString fName; 20 SkString fName;
21 21
22 public: 22 public:
23 BitmapScaleBench(void *param, int is, int os) : INHERITED(param) { 23 BitmapScaleBench( int is, int os) {
24 fInputSize = is; 24 fInputSize = is;
25 fOutputSize = os; 25 fOutputSize = os;
26 26
27 fLoopCount = 20; 27 fLoopCount = 20;
28 } 28 }
29 29
30 protected: 30 protected:
31 31
32 SkBitmap fInputBitmap, fOutputBitmap; 32 SkBitmap fInputBitmap, fOutputBitmap;
33 SkMatrix fMatrix; 33 SkMatrix fMatrix;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 virtual void doScaleImage() = 0; 83 virtual void doScaleImage() = 0;
84 virtual void preBenchSetup() {} 84 virtual void preBenchSetup() {}
85 private: 85 private:
86 typedef SkBenchmark INHERITED; 86 typedef SkBenchmark INHERITED;
87 }; 87 };
88 88
89 class BitmapFilterScaleBench: public BitmapScaleBench { 89 class BitmapFilterScaleBench: public BitmapScaleBench {
90 public: 90 public:
91 BitmapFilterScaleBench(void *param, int is, int os) : INHERITED(param, is, o s) { 91 BitmapFilterScaleBench( int is, int os) : INHERITED(is, os) {
92 setName( "filter" ); 92 setName( "filter" );
93 } 93 }
94 protected: 94 protected:
95 virtual void doScaleImage() SK_OVERRIDE { 95 virtual void doScaleImage() SK_OVERRIDE {
96 SkCanvas canvas( fOutputBitmap ); 96 SkCanvas canvas( fOutputBitmap );
97 SkPaint paint; 97 SkPaint paint;
98 98
99 paint.setFilterLevel(SkPaint::kHigh_FilterLevel); 99 paint.setFilterLevel(SkPaint::kHigh_FilterLevel);
100 canvas.drawBitmapMatrix( fInputBitmap, fMatrix, &paint ); 100 canvas.drawBitmapMatrix( fInputBitmap, fMatrix, &paint );
101 } 101 }
102 private: 102 private:
103 typedef BitmapScaleBench INHERITED; 103 typedef BitmapScaleBench INHERITED;
104 }; 104 };
105 105
106 DEF_BENCH(return new BitmapFilterScaleBench(p, 10, 90);) 106 DEF_BENCH(return new BitmapFilterScaleBench(10, 90);)
107 DEF_BENCH(return new BitmapFilterScaleBench(p, 30, 90);) 107 DEF_BENCH(return new BitmapFilterScaleBench(30, 90);)
108 DEF_BENCH(return new BitmapFilterScaleBench(p, 80, 90);) 108 DEF_BENCH(return new BitmapFilterScaleBench(80, 90);)
109 DEF_BENCH(return new BitmapFilterScaleBench(p, 90, 90);) 109 DEF_BENCH(return new BitmapFilterScaleBench(90, 90);)
110 DEF_BENCH(return new BitmapFilterScaleBench(p, 90, 80);) 110 DEF_BENCH(return new BitmapFilterScaleBench(90, 80);)
111 DEF_BENCH(return new BitmapFilterScaleBench(p, 90, 30);) 111 DEF_BENCH(return new BitmapFilterScaleBench(90, 30);)
112 DEF_BENCH(return new BitmapFilterScaleBench(p, 90, 10);) 112 DEF_BENCH(return new BitmapFilterScaleBench(90, 10);)
113 DEF_BENCH(return new BitmapFilterScaleBench(p, 256, 64);) 113 DEF_BENCH(return new BitmapFilterScaleBench(256, 64);)
114 DEF_BENCH(return new BitmapFilterScaleBench(p, 64, 256);) 114 DEF_BENCH(return new BitmapFilterScaleBench(64, 256);)
OLDNEW
« no previous file with comments | « bench/BitmapRectBench.cpp ('k') | bench/BlurBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698