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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ETCBitmapBenchBase() : fPKMData(loadPKM()) { | 82 ETCBitmapBenchBase() : fPKMData(loadPKM()) { |
83 if (NULL == fPKMData) { | 83 if (NULL == fPKMData) { |
84 SkDebugf("Could not load PKM data!"); | 84 SkDebugf("Could not load PKM data!"); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 protected: | 88 protected: |
89 SkAutoDataUnref fPKMData; | 89 SkAutoDataUnref fPKMData; |
90 | 90 |
91 private: | 91 private: |
92 SkData *loadPKM() { | 92 SkData* loadPKM() { |
93 SkString resourcePath = GetResourcePath(); | 93 SkString pkmFilename = GetResourcePath("mandrill_128.pkm"); |
94 SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), | |
95 "mandrill_128.pkm"); | |
96 | |
97 // Expand the data | 94 // Expand the data |
98 SkAutoDataUnref fileData(SkData::NewFromFileName(filename.c_str())); | 95 SkAutoDataUnref fileData(SkData::NewFromFileName(pkmFilename.c_str())); |
99 if (NULL == fileData) { | 96 if (NULL == fileData) { |
100 SkDebugf("Could not open the file. Did you forget to set the resourc
ePath?\n"); | 97 SkDebugf("Could not open the file. Did you forget to set the resourc
ePath?\n"); |
101 return NULL; | 98 return NULL; |
102 } | 99 } |
103 | 100 |
104 const etc1_uint32 kExpansionFactor = 8; | 101 const etc1_uint32 kExpansionFactor = 8; |
105 etc1_byte* expandedETC1 = | 102 etc1_byte* expandedETC1 = |
106 create_expanded_etc1_bitmap(fileData->bytes(), kExpansionFactor); | 103 create_expanded_etc1_bitmap(fileData->bytes(), kExpansionFactor); |
107 if (NULL == expandedETC1) { | 104 if (NULL == expandedETC1) { |
108 SkDebugf("Error expanding ETC1 data by factor of %d\n", kExpansionFa
ctor); | 105 SkDebugf("Error expanding ETC1 data by factor of %d\n", kExpansionFa
ctor); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 DEF_BENCH(return new ETCBitmapBench(false, Benchmark::kGPU_Backend);) | 226 DEF_BENCH(return new ETCBitmapBench(false, Benchmark::kGPU_Backend);) |
230 DEF_BENCH(return new ETCBitmapBench(true, Benchmark::kGPU_Backend);) | 227 DEF_BENCH(return new ETCBitmapBench(true, Benchmark::kGPU_Backend);) |
231 | 228 |
232 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kRaster_Backend);) | 229 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kRaster_Backend);) |
233 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kRaster_Backend);) | 230 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kRaster_Backend);) |
234 | 231 |
235 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kGPU_Backend);) | 232 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kGPU_Backend);) |
236 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kGPU_Backend);) | 233 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kGPU_Backend);) |
237 | 234 |
238 #endif // SK_IGNORE_ETC1_SUPPORT | 235 #endif // SK_IGNORE_ETC1_SUPPORT |
OLD | NEW |