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

Side by Side Diff: bench/MatrixConvolutionBench.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/MatrixBench.cpp ('k') | bench/MemoryBench.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 2012 Google Inc. 2 * Copyright 2012 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 #include "SkBenchmark.h" 7 #include "SkBenchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
11 #include "SkString.h" 11 #include "SkString.h"
12 #include "SkMatrixConvolutionImageFilter.h" 12 #include "SkMatrixConvolutionImageFilter.h"
13 13
14 class MatrixConvolutionBench : public SkBenchmark { 14 class MatrixConvolutionBench : public SkBenchmark {
15 public: 15 public:
16 MatrixConvolutionBench(void* param, SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAlpha) 16 MatrixConvolutionBench(SkMatrixConvolutionImageFilter::TileMode tileMode, bo ol convolveAlpha)
17 : INHERITED(param), fName("matrixconvolution") { 17 : fName("matrixconvolution") {
18 SkISize kernelSize = SkISize::Make(3, 3); 18 SkISize kernelSize = SkISize::Make(3, 3);
19 SkScalar kernel[9] = { 19 SkScalar kernel[9] = {
20 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 20 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
21 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1), 21 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1),
22 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 22 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
23 }; 23 };
24 SkScalar gain = SkFloatToScalar(0.3f), bias = SkIntToScalar(100); 24 SkScalar gain = SkFloatToScalar(0.3f), bias = SkIntToScalar(100);
25 SkIPoint target = SkIPoint::Make(1, 1); 25 SkIPoint target = SkIPoint::Make(1, 1);
26 fFilter = new SkMatrixConvolutionImageFilter(kernelSize, kernel, gain, b ias, target, tileMode, convolveAlpha); 26 fFilter = new SkMatrixConvolutionImageFilter(kernelSize, kernel, gain, b ias, target, tileMode, convolveAlpha);
27 } 27 }
(...skipping 19 matching lines...) Expand all
47 canvas->drawOval(r, paint); 47 canvas->drawOval(r, paint);
48 } 48 }
49 } 49 }
50 50
51 private: 51 private:
52 typedef SkBenchmark INHERITED; 52 typedef SkBenchmark INHERITED;
53 SkMatrixConvolutionImageFilter* fFilter; 53 SkMatrixConvolutionImageFilter* fFilter;
54 SkString fName; 54 SkString fName;
55 }; 55 };
56 56
57 static SkBenchmark* Fact00(void* p) { return new MatrixConvolutionBench(p, SkMat rixConvolutionImageFilter::kClamp_TileMode, true); } 57 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kCl amp_TileMode, true); )
58 static SkBenchmark* Fact01(void* p) { return new MatrixConvolutionBench(p, SkMat rixConvolutionImageFilter::kRepeat_TileMode, true); } 58 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kRe peat_TileMode, true); )
59 static SkBenchmark* Fact02(void* p) { return new MatrixConvolutionBench(p, SkMat rixConvolutionImageFilter::kClampToBlack_TileMode, true); } 59 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kCl ampToBlack_TileMode, true); )
60 static SkBenchmark* Fact03(void* p) { return new MatrixConvolutionBench(p, SkMat rixConvolutionImageFilter::kClampToBlack_TileMode, false); } 60 DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kCl ampToBlack_TileMode, false); )
61
62 static BenchRegistry gReg00(Fact00);
63 static BenchRegistry gReg01(Fact01);
64 static BenchRegistry gReg02(Fact02);
65 static BenchRegistry gReg03(Fact03);
OLDNEW
« no previous file with comments | « bench/MatrixBench.cpp ('k') | bench/MemoryBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698