OLD | NEW |
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 "Benchmark.h" |
9 #include "SkScaledImageCache.h" | 9 #include "SkScaledImageCache.h" |
10 | 10 |
11 class ImageCacheBench : public SkBenchmark { | 11 class ImageCacheBench : public Benchmark { |
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() : fCache(CACHE_COUNT * 100) { | 20 ImageCacheBench() : fCache(CACHE_COUNT * 100) { |
21 fBM.allocN32Pixels(DIM, DIM); | 21 fBM.allocN32Pixels(DIM, DIM); |
(...skipping 20 matching lines...) Expand all Loading... |
42 } | 42 } |
43 | 43 |
44 SkBitmap tmp; | 44 SkBitmap tmp; |
45 // search for a miss (-1 scale) | 45 // search for a miss (-1 scale) |
46 for (int i = 0; i < loops; ++i) { | 46 for (int i = 0; i < loops; ++i) { |
47 (void)fCache.findAndLock(fBM, -1, -1, &tmp); | 47 (void)fCache.findAndLock(fBM, -1, -1, &tmp); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 private: | 51 private: |
52 typedef SkBenchmark INHERITED; | 52 typedef Benchmark INHERITED; |
53 }; | 53 }; |
54 | 54 |
55 /////////////////////////////////////////////////////////////////////////////// | 55 /////////////////////////////////////////////////////////////////////////////// |
56 | 56 |
57 DEF_BENCH( return new ImageCacheBench(); ) | 57 DEF_BENCH( return new ImageCacheBench(); ) |
OLD | NEW |