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

Side by Side Diff: bench/ImageCacheBench.cpp

Issue 462993003: Set maximum output size for scaled-image-cache images (Closed) Base URL: https://skia.googlesource.com/skia.git@m37_2062
Patch Set: Created 6 years, 4 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 | « no previous file | gyp/tests.gypi » ('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 "SkScaledImageCache.h" 9 #include "SkScaledImageCache.h"
10 10
(...skipping 19 matching lines...) Expand all
30 scale += 1; 30 scale += 1;
31 } 31 }
32 } 32 }
33 33
34 protected: 34 protected:
35 virtual const char* onGetName() SK_OVERRIDE { 35 virtual const char* onGetName() SK_OVERRIDE {
36 return "imagecache"; 36 return "imagecache";
37 } 37 }
38 38
39 virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE { 39 virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
40 if (fCache.getBytesUsed() == 0) { 40 if (fCache.getTotalBytesUsed() == 0) {
41 this->populateCache(); 41 this->populateCache();
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 Benchmark 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(); )
OLDNEW
« no previous file with comments | « no previous file | gyp/tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698