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 24 matching lines...) Expand all Loading... |
35 return fName.c_str(); | 35 return fName.c_str(); |
36 } | 36 } |
37 | 37 |
38 bool CodecBench::isSuitableFor(Backend backend) { | 38 bool CodecBench::isSuitableFor(Backend backend) { |
39 return kNonRendering_Backend == backend; | 39 return kNonRendering_Backend == backend; |
40 } | 40 } |
41 | 41 |
42 void CodecBench::onDelayedSetup() { | 42 void CodecBench::onDelayedSetup() { |
43 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData)); | 43 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData)); |
44 | 44 |
45 fInfo = codec->getInfo().makeColorType(fColorType).makeAlphaType(fAlphaType)
; | 45 fInfo = codec->getInfo().makeColorType(fColorType) |
| 46 .makeAlphaType(fAlphaType) |
| 47 .makeColorSpace(nullptr); |
46 | 48 |
47 fPixelStorage.reset(fInfo.getSafeSize(fInfo.minRowBytes())); | 49 fPixelStorage.reset(fInfo.getSafeSize(fInfo.minRowBytes())); |
48 } | 50 } |
49 | 51 |
50 void CodecBench::onDraw(int n, SkCanvas* canvas) { | 52 void CodecBench::onDraw(int n, SkCanvas* canvas) { |
51 SkAutoTDelete<SkCodec> codec; | 53 SkAutoTDelete<SkCodec> codec; |
52 SkPMColor colorTable[256]; | 54 SkPMColor colorTable[256]; |
53 int colorCount; | 55 int colorCount; |
54 SkCodec::Options options; | 56 SkCodec::Options options; |
55 if (FLAGS_zero_init) { | 57 if (FLAGS_zero_init) { |
56 options.fZeroInitialized = SkCodec::kYes_ZeroInitialized; | 58 options.fZeroInitialized = SkCodec::kYes_ZeroInitialized; |
57 } | 59 } |
58 for (int i = 0; i < n; i++) { | 60 for (int i = 0; i < n; i++) { |
59 colorCount = 256; | 61 colorCount = 256; |
60 codec.reset(SkCodec::NewFromData(fData)); | 62 codec.reset(SkCodec::NewFromData(fData)); |
61 #ifdef SK_DEBUG | 63 #ifdef SK_DEBUG |
62 const SkCodec::Result result = | 64 const SkCodec::Result result = |
63 #endif | 65 #endif |
64 codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(), | 66 codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(), |
65 &options, colorTable, &colorCount); | 67 &options, colorTable, &colorCount); |
66 SkASSERT(result == SkCodec::kSuccess | 68 SkASSERT(result == SkCodec::kSuccess |
67 || result == SkCodec::kIncompleteInput); | 69 || result == SkCodec::kIncompleteInput); |
68 } | 70 } |
69 } | 71 } |
OLD | NEW |