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 "Benchmark.h" | 8 #include "Benchmark.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 Benchmark { | 21 class ImageDecodeBench : public Benchmark { |
22 public: | 22 public: |
23 ImageDecodeBench(void* p, const char* filename) | 23 ImageDecodeBench(void* p, const char* filename) |
24 : fName("image_decode_") | 24 : fName("image_decode_") |
25 , fFilename(filename) | 25 , fFilename(filename) |
26 , fStream() | 26 , fStream() |
27 , fValid(false) { | 27 , fValid(false) { |
28 fName.append(SkOSPath::SkBasename(filename)); | 28 fName.append(SkOSPath::Basename(filename)); |
29 } | 29 } |
30 | 30 |
31 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 31 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { |
32 return backend == kNonRendering_Backend; | 32 return backend == kNonRendering_Backend; |
33 } | 33 } |
34 | 34 |
35 protected: | 35 protected: |
36 virtual const char* onGetName() SK_OVERRIDE { | 36 virtual const char* onGetName() SK_OVERRIDE { |
37 return fName.c_str(); | 37 return fName.c_str(); |
38 } | 38 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 const SkString fFilename; | 84 const SkString fFilename; |
85 SkMemoryStream fStream; | 85 SkMemoryStream fStream; |
86 bool fValid; | 86 bool fValid; |
87 | 87 |
88 typedef Benchmark INHERITED; | 88 typedef Benchmark INHERITED; |
89 }; | 89 }; |
90 | 90 |
91 // These are files which call decodePalette | 91 // These are files which call decodePalette |
92 //DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, ("/usr/local/google/home/scrogg
o/Downloads/images/hal_163x90.png")); ) | 92 //DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, ("/usr/local/google/home/scrogg
o/Downloads/images/hal_163x90.png")); ) |
93 //DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, ("/usr/local/google/home/scrogg
o/Downloads/images/box_19_top-left.png")); ) | 93 //DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, ("/usr/local/google/home/scrogg
o/Downloads/images/box_19_top-left.png")); ) |
OLD | NEW |