| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "CodecBench.h" | 8 #include "CodecBench.h" |
| 9 #include "CodecBenchPriv.h" | 9 #include "CodecBenchPriv.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // invalid. | 41 // invalid. |
| 42 SkAssertResult(SkColorTypeValidateAlphaType(fColorType, fInfo.alphaType(), | 42 SkAssertResult(SkColorTypeValidateAlphaType(fColorType, fInfo.alphaType(), |
| 43 &alphaType)); | 43 &alphaType)); |
| 44 if (alphaType != fInfo.alphaType()) { | 44 if (alphaType != fInfo.alphaType()) { |
| 45 fInfo = fInfo.makeAlphaType(alphaType); | 45 fInfo = fInfo.makeAlphaType(alphaType); |
| 46 } | 46 } |
| 47 | 47 |
| 48 fPixelStorage.reset(fInfo.getSafeSize(fInfo.minRowBytes())); | 48 fPixelStorage.reset(fInfo.getSafeSize(fInfo.minRowBytes())); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void CodecBench::onDraw(const int n, SkCanvas* canvas) { | 51 void CodecBench::onDraw(int n, SkCanvas* canvas) { |
| 52 SkAutoTDelete<SkCodec> codec; | 52 SkAutoTDelete<SkCodec> codec; |
| 53 SkPMColor colorTable[256]; | 53 SkPMColor colorTable[256]; |
| 54 int colorCount; | 54 int colorCount; |
| 55 for (int i = 0; i < n; i++) { | 55 for (int i = 0; i < n; i++) { |
| 56 colorCount = 256; | 56 colorCount = 256; |
| 57 codec.reset(SkCodec::NewFromData(fData)); | 57 codec.reset(SkCodec::NewFromData(fData)); |
| 58 #ifdef SK_DEBUG | 58 #ifdef SK_DEBUG |
| 59 const SkCodec::Result result = | 59 const SkCodec::Result result = |
| 60 #endif | 60 #endif |
| 61 codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(), | 61 codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(), |
| 62 nullptr, colorTable, &colorCount); | 62 nullptr, colorTable, &colorCount); |
| 63 SkASSERT(result == SkCodec::kSuccess | 63 SkASSERT(result == SkCodec::kSuccess |
| 64 || result == SkCodec::kIncompleteInput); | 64 || result == SkCodec::kIncompleteInput); |
| 65 } | 65 } |
| 66 } | 66 } |
| OLD | NEW |