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

Side by Side Diff: bench/MergeBench.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/MemsetBench.cpp ('k') | bench/MutexBench.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 "SkBitmapSource.h" 9 #include "SkBitmapSource.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkMergeImageFilter.h" 11 #include "SkMergeImageFilter.h"
12 12
13 #define FILTER_WIDTH_SMALL SkIntToScalar(32) 13 #define FILTER_WIDTH_SMALL SkIntToScalar(32)
14 #define FILTER_HEIGHT_SMALL SkIntToScalar(32) 14 #define FILTER_HEIGHT_SMALL SkIntToScalar(32)
15 #define FILTER_WIDTH_LARGE SkIntToScalar(256) 15 #define FILTER_WIDTH_LARGE SkIntToScalar(256)
16 #define FILTER_HEIGHT_LARGE SkIntToScalar(256) 16 #define FILTER_HEIGHT_LARGE SkIntToScalar(256)
17 17
18 class MergeBench : public Benchmark { 18 class MergeBench : public Benchmark {
19 public: 19 public:
20 MergeBench(bool small) : fIsSmall(small), fInitialized(false) { } 20 MergeBench(bool small) : fIsSmall(small), fInitialized(false) { }
21 21
22 protected: 22 protected:
23 virtual const char* onGetName() SK_OVERRIDE { 23 const char* onGetName() SK_OVERRIDE {
24 return fIsSmall ? "merge_small" : "merge_large"; 24 return fIsSmall ? "merge_small" : "merge_large";
25 } 25 }
26 26
27 virtual void onPreDraw() SK_OVERRIDE { 27 void onPreDraw() SK_OVERRIDE {
28 if (!fInitialized) { 28 if (!fInitialized) {
29 make_bitmap(); 29 make_bitmap();
30 make_checkerboard(); 30 make_checkerboard();
31 fInitialized = true; 31 fInitialized = true;
32 } 32 }
33 } 33 }
34 34
35 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 35 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
36 SkRect r = fIsSmall ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_S MALL) : 36 SkRect r = fIsSmall ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_S MALL) :
37 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L ARGE); 37 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L ARGE);
38 SkPaint paint; 38 SkPaint paint;
39 paint.setImageFilter(mergeBitmaps())->unref(); 39 paint.setImageFilter(mergeBitmaps())->unref();
40 for (int i = 0; i < loops; i++) { 40 for (int i = 0; i < loops; i++) {
41 canvas->drawRect(r, paint); 41 canvas->drawRect(r, paint);
42 } 42 }
43 } 43 }
44 44
45 private: 45 private:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 bool fInitialized; 88 bool fInitialized;
89 SkBitmap fBitmap, fCheckerboard; 89 SkBitmap fBitmap, fCheckerboard;
90 90
91 typedef Benchmark INHERITED; 91 typedef Benchmark INHERITED;
92 }; 92 };
93 93
94 /////////////////////////////////////////////////////////////////////////////// 94 ///////////////////////////////////////////////////////////////////////////////
95 95
96 DEF_BENCH( return new MergeBench(true); ) 96 DEF_BENCH( return new MergeBench(true); )
97 DEF_BENCH( return new MergeBench(false); ) 97 DEF_BENCH( return new MergeBench(false); )
OLDNEW
« no previous file with comments | « bench/MemsetBench.cpp ('k') | bench/MutexBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698