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 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 const char* CodecBench::onGetName() { | 27 const char* CodecBench::onGetName() { |
28 return fName.c_str(); | 28 return fName.c_str(); |
29 } | 29 } |
30 | 30 |
31 bool CodecBench::isSuitableFor(Backend backend) { | 31 bool CodecBench::isSuitableFor(Backend backend) { |
32 return kNonRendering_Backend == backend; | 32 return kNonRendering_Backend == backend; |
33 } | 33 } |
34 | 34 |
35 void CodecBench::onPreDraw() { | 35 void CodecBench::onDelayedSetup() { |
36 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData)); | 36 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData)); |
37 | 37 |
38 fInfo = codec->getInfo().makeColorType(fColorType); | 38 fInfo = codec->getInfo().makeColorType(fColorType); |
39 SkAlphaType alphaType; | 39 SkAlphaType alphaType; |
40 // Caller should not have created this CodecBench if the alpha type was | 40 // Caller should not have created this CodecBench if the alpha type was |
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); |
(...skipping 11 matching lines...) Expand all Loading... |
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 |