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 "SkCodec.h" | 8 #include "SkCodec.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkCodec_libbmp.h" | 10 #include "SkCodec_libbmp.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 SkCodec* SkCodec::NewFromData(SkData* data) { | 65 SkCodec* SkCodec::NewFromData(SkData* data) { |
66 if (!data) { | 66 if (!data) { |
67 return NULL; | 67 return NULL; |
68 } | 68 } |
69 return NewFromStream(SkNEW_ARGS(SkMemoryStream, (data))); | 69 return NewFromStream(SkNEW_ARGS(SkMemoryStream, (data))); |
70 } | 70 } |
71 | 71 |
72 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream) | 72 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream) |
73 : INHERITED(info) | 73 : INHERITED(info) |
74 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO | |
75 , fInfo(info) | |
76 #endif | |
77 , fStream(stream) | 74 , fStream(stream) |
78 , fNeedsRewind(false) | 75 , fNeedsRewind(false) |
79 {} | 76 {} |
80 | 77 |
81 SkCodec::RewindState SkCodec::rewindIfNeeded() { | 78 SkCodec::RewindState SkCodec::rewindIfNeeded() { |
82 // Store the value of fNeedsRewind so we can update it. Next read will | 79 // Store the value of fNeedsRewind so we can update it. Next read will |
83 // require a rewind. | 80 // require a rewind. |
84 const bool needsRewind = fNeedsRewind; | 81 const bool needsRewind = fNeedsRewind; |
85 fNeedsRewind = true; | 82 fNeedsRewind = true; |
86 if (!needsRewind) { | 83 if (!needsRewind) { |
(...skipping 16 matching lines...) Expand all Loading... |
103 return fScanlineDecoder.get(); | 100 return fScanlineDecoder.get(); |
104 } | 101 } |
105 | 102 |
106 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { | 103 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { |
107 SkASSERT(kIndex_8_SkColorType != dstInfo.colorType()); | 104 SkASSERT(kIndex_8_SkColorType != dstInfo.colorType()); |
108 if (kIndex_8_SkColorType == dstInfo.colorType()) { | 105 if (kIndex_8_SkColorType == dstInfo.colorType()) { |
109 return NULL; | 106 return NULL; |
110 } | 107 } |
111 return this->getScanlineDecoder(dstInfo, NULL, NULL, NULL); | 108 return this->getScanlineDecoder(dstInfo, NULL, NULL, NULL); |
112 } | 109 } |
OLD | NEW |