| 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 "Resources.h" | 9 #include "Resources.h" | 
| 9 #include "SkBenchmark.h" |  | 
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" | 
| 11 #include "SkData.h" | 11 #include "SkData.h" | 
| 12 #include "SkForceLinking.h" | 12 #include "SkForceLinking.h" | 
| 13 #include "SkImageDecoder.h" | 13 #include "SkImageDecoder.h" | 
| 14 #include "SkOSFile.h" | 14 #include "SkOSFile.h" | 
| 15 #include "SkStream.h" | 15 #include "SkStream.h" | 
| 16 #include "SkString.h" | 16 #include "SkString.h" | 
| 17 | 17 | 
| 18 __SK_FORCE_IMAGE_DECODER_LINKING; | 18 __SK_FORCE_IMAGE_DECODER_LINKING; | 
| 19 | 19 | 
| 20 class SkCanvas; | 20 class SkCanvas; | 
| 21 | 21 | 
| 22 class SkipZeroesBench : public SkBenchmark { | 22 class SkipZeroesBench : public Benchmark { | 
| 23 public: | 23 public: | 
| 24     SkipZeroesBench(const char* filename, bool skipZeroes) | 24     SkipZeroesBench(const char* filename, bool skipZeroes) | 
| 25     : fName("SkipZeroes_") | 25     : fName("SkipZeroes_") | 
| 26     , fDecoder(NULL) | 26     , fDecoder(NULL) | 
| 27     , fFilename(filename) | 27     , fFilename(filename) | 
| 28     , fStream() | 28     , fStream() | 
| 29     , fSkipZeroes(skipZeroes) | 29     , fSkipZeroes(skipZeroes) | 
| 30     , fValid(false) { | 30     , fValid(false) { | 
| 31         fName.append(filename); | 31         fName.append(filename); | 
| 32         if (skipZeroes) { | 32         if (skipZeroes) { | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 103     } | 103     } | 
| 104 | 104 | 
| 105 private: | 105 private: | 
| 106     SkString                        fName; | 106     SkString                        fName; | 
| 107     SkAutoTDelete<SkImageDecoder>   fDecoder; | 107     SkAutoTDelete<SkImageDecoder>   fDecoder; | 
| 108     const SkString                  fFilename; | 108     const SkString                  fFilename; | 
| 109     SkMemoryStream                  fStream; | 109     SkMemoryStream                  fStream; | 
| 110     bool                            fSkipZeroes; | 110     bool                            fSkipZeroes; | 
| 111     bool                            fValid; | 111     bool                            fValid; | 
| 112 | 112 | 
| 113     typedef SkBenchmark INHERITED; | 113     typedef Benchmark INHERITED; | 
| 114 }; | 114 }; | 
| 115 | 115 | 
| 116 // Enable the true version once the feature is checked in. | 116 // Enable the true version once the feature is checked in. | 
| 117 DEF_BENCH( return SkNEW_ARGS(SkipZeroesBench, ("arrow.png", true))); | 117 DEF_BENCH( return SkNEW_ARGS(SkipZeroesBench, ("arrow.png", true))); | 
| 118 DEF_BENCH( return SkNEW_ARGS(SkipZeroesBench, ("arrow.png", false))); | 118 DEF_BENCH( return SkNEW_ARGS(SkipZeroesBench, ("arrow.png", false))); | 
| OLD | NEW | 
|---|