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

Side by Side Diff: bench/ImageCacheBench.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/HairlinePathBench.cpp ('k') | bench/ImageDecodeBench.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 "SkScaledImageCache.h" 9 #include "SkScaledImageCache.h"
10 10
(...skipping 20 matching lines...) Expand all
31 fCache.unlock(fCache.addAndLock(fBM, scale, scale, tmp)); 31 fCache.unlock(fCache.addAndLock(fBM, scale, scale, tmp));
32 scale += 1; 32 scale += 1;
33 } 33 }
34 } 34 }
35 35
36 protected: 36 protected:
37 virtual const char* onGetName() SK_OVERRIDE { 37 virtual const char* onGetName() SK_OVERRIDE {
38 return "imagecache"; 38 return "imagecache";
39 } 39 }
40 40
41 virtual void onDraw(SkCanvas*) SK_OVERRIDE { 41 virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
42 if (fCache.getBytesUsed() == 0) { 42 if (fCache.getBytesUsed() == 0) {
43 this->populateCache(); 43 this->populateCache();
44 } 44 }
45 45
46 SkBitmap tmp; 46 SkBitmap tmp;
47 // search for a miss (-1 scale) 47 // search for a miss (-1 scale)
48 for (int i = 0; i < this->getLoops(); ++i) { 48 for (int i = 0; i < loops; ++i) {
49 (void)fCache.findAndLock(fBM, -1, -1, &tmp); 49 (void)fCache.findAndLock(fBM, -1, -1, &tmp);
50 } 50 }
51 } 51 }
52 52
53 private: 53 private:
54 typedef SkBenchmark INHERITED; 54 typedef SkBenchmark INHERITED;
55 }; 55 };
56 56
57 /////////////////////////////////////////////////////////////////////////////// 57 ///////////////////////////////////////////////////////////////////////////////
58 58
59 DEF_BENCH( return new ImageCacheBench(); ) 59 DEF_BENCH( return new ImageCacheBench(); )
OLDNEW
« no previous file with comments | « bench/HairlinePathBench.cpp ('k') | bench/ImageDecodeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698