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

Side by Side Diff: bench/DecodeBench.cpp

Issue 73643005: Implement a benchmark for GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 1 month 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/ChecksumBench.cpp ('k') | bench/GrMemoryPoolBench.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
(...skipping 11 matching lines...) Expand all
22 SkString fName; 22 SkString fName;
23 public: 23 public:
24 DecodeBench(SkBitmap::Config c) { 24 DecodeBench(SkBitmap::Config c) {
25 fPrefConfig = c; 25 fPrefConfig = c;
26 26
27 const char* fname = strrchr(FLAGS_decodeBenchFilename[0], '/'); 27 const char* fname = strrchr(FLAGS_decodeBenchFilename[0], '/');
28 if (fname) { 28 if (fname) {
29 fname++; // skip the slash 29 fname++; // skip the slash
30 } 30 }
31 fName.printf("decode_%s_%s", gConfigName[c], fname); 31 fName.printf("decode_%s_%s", gConfigName[c], fname);
32 fIsRendering = false; 32 }
33
34 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
35 return backend == kNonRendering_Backend;
33 } 36 }
34 37
35 protected: 38 protected:
36 virtual const char* onGetName() { 39 virtual const char* onGetName() {
37 return fName.c_str(); 40 return fName.c_str();
38 } 41 }
39 42
40 virtual void onDraw(SkCanvas*) { 43 virtual void onDraw(SkCanvas*) {
41 for (int i = 0; i < this->getLoops(); i++) { 44 for (int i = 0; i < this->getLoops(); i++) {
42 SkBitmap bm; 45 SkBitmap bm;
43 SkImageDecoder::DecodeFile(FLAGS_decodeBenchFilename[0], 46 SkImageDecoder::DecodeFile(FLAGS_decodeBenchFilename[0],
44 &bm, 47 &bm,
45 fPrefConfig, 48 fPrefConfig,
46 SkImageDecoder::kDecodePixels_Mode); 49 SkImageDecoder::kDecodePixels_Mode);
47 } 50 }
48 } 51 }
49 52
50 private: 53 private:
51 typedef SkBenchmark INHERITED; 54 typedef SkBenchmark INHERITED;
52 }; 55 };
53 56
54 DEF_BENCH( return new DecodeBench(SkBitmap::kARGB_8888_Config); ) 57 DEF_BENCH( return new DecodeBench(SkBitmap::kARGB_8888_Config); )
55 DEF_BENCH( return new DecodeBench(SkBitmap::kRGB_565_Config); ) 58 DEF_BENCH( return new DecodeBench(SkBitmap::kRGB_565_Config); )
56 DEF_BENCH( return new DecodeBench(SkBitmap::kARGB_4444_Config); ) 59 DEF_BENCH( return new DecodeBench(SkBitmap::kARGB_4444_Config); )
OLDNEW
« no previous file with comments | « bench/ChecksumBench.cpp ('k') | bench/GrMemoryPoolBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698