| 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" |
| 11 #include "SkData.h" | 11 #include "SkData.h" |
| 12 #include "SkDecodingImageGenerator.h" | 12 #include "SkImageGenerator.h" |
| 13 #include "SkImageDecoder.h" | 13 #include "SkImageDecoder.h" |
| 14 #include "SkOSFile.h" | 14 #include "SkOSFile.h" |
| 15 #include "SkPixelRef.h" | 15 #include "SkPixelRef.h" |
| 16 | 16 |
| 17 #ifndef SK_IGNORE_ETC1_SUPPORT | 17 #ifndef SK_IGNORE_ETC1_SUPPORT |
| 18 | 18 |
| 19 #include "etc1.h" | 19 #include "etc1.h" |
| 20 | 20 |
| 21 // This takes the etc1 data pointed to by orig, and copies it `factor` times in
each | 21 // This takes the etc1 data pointed to by orig, and copies it `factor` times in
each |
| 22 // dimension. The return value is the new data or NULL on error. | 22 // dimension. The return value is the new data or NULL on error. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 virtual void onPreDraw() SK_OVERRIDE { | 147 virtual void onPreDraw() SK_OVERRIDE { |
| 148 if (NULL == fPKMData) { | 148 if (NULL == fPKMData) { |
| 149 SkDebugf("Failed to load PKM data!\n"); | 149 SkDebugf("Failed to load PKM data!\n"); |
| 150 return; | 150 return; |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Install pixel ref | 153 // Install pixel ref |
| 154 if (!SkInstallDiscardablePixelRef( | 154 if (!SkInstallDiscardablePixelRef(fPKMData, &(this->fBitmap))) { |
| 155 SkDecodingImageGenerator::Create( | |
| 156 fPKMData, SkDecodingImageGenerator::Options()), &(this->fBit
map))) { | |
| 157 SkDebugf("Could not install discardable pixel ref.\n"); | 155 SkDebugf("Could not install discardable pixel ref.\n"); |
| 158 return; | 156 return; |
| 159 } | 157 } |
| 160 | 158 |
| 161 // Decompress it if necessary | 159 // Decompress it if necessary |
| 162 if (this->fDecompress) { | 160 if (this->fDecompress) { |
| 163 this->fBitmap.lockPixels(); | 161 this->fBitmap.lockPixels(); |
| 164 } | 162 } |
| 165 } | 163 } |
| 166 | 164 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 DEF_BENCH(return new ETCBitmapBench(false, Benchmark::kGPU_Backend);) | 224 DEF_BENCH(return new ETCBitmapBench(false, Benchmark::kGPU_Backend);) |
| 227 DEF_BENCH(return new ETCBitmapBench(true, Benchmark::kGPU_Backend);) | 225 DEF_BENCH(return new ETCBitmapBench(true, Benchmark::kGPU_Backend);) |
| 228 | 226 |
| 229 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kRaster_Backend);) | 227 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kRaster_Backend);) |
| 230 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kRaster_Backend);) | 228 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kRaster_Backend);) |
| 231 | 229 |
| 232 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kGPU_Backend);) | 230 DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kGPU_Backend);) |
| 233 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kGPU_Backend);) | 231 DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kGPU_Backend);) |
| 234 | 232 |
| 235 #endif // SK_IGNORE_ETC1_SUPPORT | 233 #endif // SK_IGNORE_ETC1_SUPPORT |
| OLD | NEW |