OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "Resources.h" | 9 #include "Resources.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 }; | 116 }; |
117 | 117 |
118 // This is the rendering benchmark. Prior to rendering the data, create a | 118 // This is the rendering benchmark. Prior to rendering the data, create a |
119 // bitmap using the etc1 data. | 119 // bitmap using the etc1 data. |
120 class ETCBitmapBench : public ETCBitmapBenchBase { | 120 class ETCBitmapBench : public ETCBitmapBenchBase { |
121 public: | 121 public: |
122 ETCBitmapBench(bool decompress, Backend backend) | 122 ETCBitmapBench(bool decompress, Backend backend) |
123 : fDecompress(decompress), fBackend(backend) { } | 123 : fDecompress(decompress), fBackend(backend) { } |
124 | 124 |
125 bool isSuitableFor(Backend backend) override { | 125 bool isSuitableFor(Backend backend) override { |
126 return backend == this->fBackend; | 126 return SkToBool(fImage) && backend == this->fBackend; |
127 } | 127 } |
128 | 128 |
129 protected: | 129 protected: |
130 const char* onGetName() override { | 130 const char* onGetName() override { |
131 if (kGPU_Backend == this->fBackend) { | 131 if (kGPU_Backend == this->fBackend) { |
132 if (this->fDecompress) { | 132 if (this->fDecompress) { |
133 return "etc1bitmap_render_gpu_decompressed"; | 133 return "etc1bitmap_render_gpu_decompressed"; |
134 } else { | 134 } else { |
135 return "etc1bitmap_render_gpu_compressed"; | 135 return "etc1bitmap_render_gpu_compressed"; |
136 } | 136 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 DEF_BENCH(return new ETCBitmapBench(false, Benchmark::kGPU_Backend);) | 226 DEF_BENCH(return new ETCBitmapBench(false, Benchmark::kGPU_Backend);) |
227 DEF_BENCH(return new ETCBitmapBench(true, Benchmark::kGPU_Backend);) | 227 DEF_BENCH(return new ETCBitmapBench(true, Benchmark::kGPU_Backend);) |
228 | 228 |
229 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kRaster_Backend);) | 229 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kRaster_Backend);) |
230 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kRaster_Backend);) | 230 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kRaster_Backend);) |
231 | 231 |
232 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kGPU_Backend);) | 232 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kGPU_Backend);) |
233 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kGPU_Backend);) | 233 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kGPU_Backend);) |
234 | 234 |
235 #endif // SK_IGNORE_ETC1_SUPPORT | 235 #endif // SK_IGNORE_ETC1_SUPPORT |
OLD | NEW |