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 "SkBenchmark.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
11 #include "SkForceLinking.h" | 11 #include "SkForceLinking.h" |
12 #include "SkImageDecoder.h" | 12 #include "SkImageDecoder.h" |
13 #include "SkOSFile.h" | 13 #include "SkOSFile.h" |
14 #include "SkStream.h" | 14 #include "SkStream.h" |
15 #include "SkString.h" | 15 #include "SkString.h" |
16 | 16 |
17 __SK_FORCE_IMAGE_DECODER_LINKING; | 17 __SK_FORCE_IMAGE_DECODER_LINKING; |
18 | 18 |
19 class SkCanvas; | 19 class SkCanvas; |
20 | 20 |
21 class ImageDecodeBench : public SkBenchmark { | 21 class ImageDecodeBench : public SkBenchmark { |
22 public: | 22 public: |
23 ImageDecodeBench(void* p, const char* filename) | 23 ImageDecodeBench(void* p, const char* filename) |
24 : INHERITED(p) | 24 : fName("image_decode_") |
25 , fName("image_decode_") | |
26 , fFilename(filename) | 25 , fFilename(filename) |
27 , fStream() | 26 , fStream() |
28 , fValid(false) { | 27 , fValid(false) { |
29 fName.append(SkOSPath::SkBasename(filename)); | 28 fName.append(SkOSPath::SkBasename(filename)); |
30 fIsRendering = false; | 29 fIsRendering = false; |
31 } | 30 } |
32 | 31 |
33 protected: | 32 protected: |
34 virtual const char* onGetName() SK_OVERRIDE { | 33 virtual const char* onGetName() SK_OVERRIDE { |
35 return fName.c_str(); | 34 return fName.c_str(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 private: | 79 private: |
81 SkString fName; | 80 SkString fName; |
82 const SkString fFilename; | 81 const SkString fFilename; |
83 SkMemoryStream fStream; | 82 SkMemoryStream fStream; |
84 bool fValid; | 83 bool fValid; |
85 | 84 |
86 typedef SkBenchmark INHERITED; | 85 typedef SkBenchmark INHERITED; |
87 }; | 86 }; |
88 | 87 |
89 // These are files which call decodePalette | 88 // These are files which call decodePalette |
90 //DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, (p, "/usr/local/google/home/scr
oggo/Downloads/images/hal_163x90.png")); ) | 89 //DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, ("/usr/local/google/home/scrogg
o/Downloads/images/hal_163x90.png")); ) |
91 //DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, (p, "/usr/local/google/home/scr
oggo/Downloads/images/box_19_top-left.png")); ) | 90 //DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, ("/usr/local/google/home/scrogg
o/Downloads/images/box_19_top-left.png")); ) |
OLD | NEW |