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

Side by Side Diff: bench/ImageCacheBench.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/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
11 class ImageCacheBench : public SkBenchmark { 11 class ImageCacheBench : public SkBenchmark {
12 SkScaledImageCache fCache; 12 SkScaledImageCache fCache;
13 SkBitmap fBM; 13 SkBitmap fBM;
14 14
15 enum { 15 enum {
16 DIM = 1, 16 DIM = 1,
17 CACHE_COUNT = 500 17 CACHE_COUNT = 500
18 }; 18 };
19 public: 19 public:
20 ImageCacheBench(void* param) : INHERITED(param) , fCache(CACHE_COUNT * 100) { 20 ImageCacheBench() : fCache(CACHE_COUNT * 100) {
21 fBM.setConfig(SkBitmap::kARGB_8888_Config, DIM, DIM); 21 fBM.setConfig(SkBitmap::kARGB_8888_Config, DIM, DIM);
22 fBM.allocPixels(); 22 fBM.allocPixels();
23 } 23 }
24 24
25 void populateCache() { 25 void populateCache() {
26 SkScalar scale = 1; 26 SkScalar scale = 1;
27 for (int i = 0; i < CACHE_COUNT; ++i) { 27 for (int i = 0; i < CACHE_COUNT; ++i) {
28 SkBitmap tmp; 28 SkBitmap tmp;
29 tmp.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); 29 tmp.setConfig(SkBitmap::kARGB_8888_Config, 1, 1);
30 tmp.allocPixels(); 30 tmp.allocPixels();
(...skipping 18 matching lines...) Expand all
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(p); ) 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