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 "DecodingBench.h" | 8 #include "DecodingBench.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 break; | 38 break; |
39 default: | 39 default: |
40 colorName = "Unknown"; | 40 colorName = "Unknown"; |
41 } | 41 } |
42 fName.printf("Decode_%s_%s", baseName.c_str(), colorName); | 42 fName.printf("Decode_%s_%s", baseName.c_str(), colorName); |
43 | 43 |
44 #ifdef SK_DEBUG | 44 #ifdef SK_DEBUG |
45 // Ensure that we can create a decoder. | 45 // Ensure that we can create a decoder. |
46 SkAutoTDelete<SkStreamRewindable> stream(new SkMemoryStream(fData)); | 46 SkAutoTDelete<SkStreamRewindable> stream(new SkMemoryStream(fData)); |
47 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); | 47 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); |
48 SkASSERT(decoder != NULL); | 48 SkASSERT(decoder != nullptr); |
49 #endif | 49 #endif |
50 } | 50 } |
51 | 51 |
52 const char* DecodingBench::onGetName() { | 52 const char* DecodingBench::onGetName() { |
53 return fName.c_str(); | 53 return fName.c_str(); |
54 } | 54 } |
55 | 55 |
56 bool DecodingBench::isSuitableFor(Backend backend) { | 56 bool DecodingBench::isSuitableFor(Backend backend) { |
57 return kNonRendering_Backend == backend; | 57 return kNonRendering_Backend == backend; |
58 } | 58 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 for (int i = 0; i < n; i++) { | 101 for (int i = 0; i < n; i++) { |
102 // create a new stream and a new decoder to mimic the behavior of | 102 // create a new stream and a new decoder to mimic the behavior of |
103 // CodecBench. | 103 // CodecBench. |
104 stream.reset(new SkMemoryStream(fData)); | 104 stream.reset(new SkMemoryStream(fData)); |
105 decoder.reset(SkImageDecoder::Factory(stream)); | 105 decoder.reset(SkImageDecoder::Factory(stream)); |
106 decoder->setAllocator(&allocator); | 106 decoder->setAllocator(&allocator); |
107 decoder->decode(stream, &bitmap, fColorType, | 107 decoder->decode(stream, &bitmap, fColorType, |
108 SkImageDecoder::kDecodePixels_Mode); | 108 SkImageDecoder::kDecodePixels_Mode); |
109 } | 109 } |
110 } | 110 } |
OLD | NEW |