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

Side by Side Diff: bench/BicubicBench.cpp

Issue 99893003: Simplify benchmark internal API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years 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/AAClipBench.cpp ('k') | bench/BitmapBench.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 "SkShader.h" 10 #include "SkShader.h"
(...skipping 12 matching lines...) Expand all
23 : fScale(SkSize::Make(x, y)) { 23 : fScale(SkSize::Make(x, y)) {
24 fName.printf("bicubic_%gx%g", 24 fName.printf("bicubic_%gx%g",
25 SkScalarToFloat(fScale.fWidth), SkScalarToFloat(fScale.fHei ght)); 25 SkScalarToFloat(fScale.fWidth), SkScalarToFloat(fScale.fHei ght));
26 } 26 }
27 27
28 protected: 28 protected:
29 virtual const char* onGetName() { 29 virtual const char* onGetName() {
30 return fName.c_str(); 30 return fName.c_str();
31 } 31 }
32 32
33 virtual void onDraw(SkCanvas* canvas) { 33 virtual void onDraw(const int loops, SkCanvas* canvas) {
34 SkPaint paint; 34 SkPaint paint;
35 this->setupPaint(&paint); 35 this->setupPaint(&paint);
36 36
37 paint.setAntiAlias(true); 37 paint.setAntiAlias(true);
38 38
39 SkRect r = SkRect::MakeWH(40, 40); 39 SkRect r = SkRect::MakeWH(40, 40);
40 SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell (fScale)); 40 SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell (fScale));
41 paint.setImageFilter(bicubic); 41 paint.setImageFilter(bicubic);
42 42
43 for (int i = 0; i < this->getLoops(); i++) { 43 for (int i = 0; i < loops; i++) {
44 canvas->save(); 44 canvas->save();
45 canvas->clipRect(r); 45 canvas->clipRect(r);
46 canvas->drawOval(r, paint); 46 canvas->drawOval(r, paint);
47 canvas->restore(); 47 canvas->restore();
48 } 48 }
49 } 49 }
50 50
51 private: 51 private:
52 typedef SkBenchmark INHERITED; 52 typedef SkBenchmark INHERITED;
53 }; 53 };
54 54
55 DEF_BENCH( return new BicubicBench(10.0f, 10.0f); ) 55 DEF_BENCH( return new BicubicBench(10.0f, 10.0f); )
56 DEF_BENCH( return new BicubicBench(2.5f, 10.0f); ) 56 DEF_BENCH( return new BicubicBench(2.5f, 10.0f); )
57 DEF_BENCH( return new BicubicBench(10.0f, 2.5f); ) 57 DEF_BENCH( return new BicubicBench(10.0f, 2.5f); )
58 DEF_BENCH( return new BicubicBench(2.5f, 2.5f); ) 58 DEF_BENCH( return new BicubicBench(2.5f, 2.5f); )
OLDNEW
« no previous file with comments | « bench/AAClipBench.cpp ('k') | bench/BitmapBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698