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

Side by Side Diff: bench/DecodeBench.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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 | « bench/DashBench.cpp ('k') | bench/DeferredSurfaceCopyBench.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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
11 #include "SkImageDecoder.h" 11 #include "SkImageDecoder.h"
12 #include "SkOSFile.h" 12 #include "SkOSFile.h"
13 #include "SkString.h" 13 #include "SkString.h"
14 #include "sk_tool_utils.h" 14 #include "sk_tool_utils.h"
15 15
16 DEFINE_string(decodeBenchFilename, "resources/CMYK.jpeg", "Path to image for Dec odeBench."); 16 DEFINE_string(decodeBenchFilename, "resources/CMYK.jpeg", "Path to image for Dec odeBench.");
17 17
18 class DecodeBench : public Benchmark { 18 class DecodeBench : public Benchmark {
19 const SkColorType fPrefColorType; 19 const SkColorType fPrefColorType;
20 SkString fName; 20 SkString fName;
21 public: 21 public:
22 DecodeBench(SkColorType ct) : fPrefColorType(ct) { 22 DecodeBench(SkColorType ct) : fPrefColorType(ct) {
23 SkString fname = SkOSPath::Basename(FLAGS_decodeBenchFilename[0]); 23 SkString fname = SkOSPath::Basename(FLAGS_decodeBenchFilename[0]);
24 fName.printf("decode_%s_%s", sk_tool_utils::colortype_name(ct), fname.c_ str()); 24 fName.printf("decode_%s_%s", sk_tool_utils::colortype_name(ct), fname.c_ str());
25 } 25 }
26 26
27 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { 27 bool isSuitableFor(Backend backend) SK_OVERRIDE {
28 return backend == kNonRendering_Backend; 28 return backend == kNonRendering_Backend;
29 } 29 }
30 30
31 protected: 31 protected:
32 virtual const char* onGetName() { 32 virtual const char* onGetName() {
33 return fName.c_str(); 33 return fName.c_str();
34 } 34 }
35 35
36 virtual void onDraw(const int loops, SkCanvas*) { 36 virtual void onDraw(const int loops, SkCanvas*) {
37 for (int i = 0; i < loops; i++) { 37 for (int i = 0; i < loops; i++) {
38 SkBitmap bm; 38 SkBitmap bm;
39 SkImageDecoder::DecodeFile(FLAGS_decodeBenchFilename[0], &bm, fPrefC olorType, 39 SkImageDecoder::DecodeFile(FLAGS_decodeBenchFilename[0], &bm, fPrefC olorType,
40 SkImageDecoder::kDecodePixels_Mode); 40 SkImageDecoder::kDecodePixels_Mode);
41 } 41 }
42 } 42 }
43 43
44 private: 44 private:
45 typedef Benchmark INHERITED; 45 typedef Benchmark INHERITED;
46 }; 46 };
47 47
48 DEF_BENCH( return new DecodeBench(kN32_SkColorType); ) 48 DEF_BENCH( return new DecodeBench(kN32_SkColorType); )
49 DEF_BENCH( return new DecodeBench(kRGB_565_SkColorType); ) 49 DEF_BENCH( return new DecodeBench(kRGB_565_SkColorType); )
50 DEF_BENCH( return new DecodeBench(kARGB_4444_SkColorType); ) 50 DEF_BENCH( return new DecodeBench(kARGB_4444_SkColorType); )
OLDNEW
« no previous file with comments | « bench/DashBench.cpp ('k') | bench/DeferredSurfaceCopyBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698