| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // require a rewind. | 83 // require a rewind. |
| 84 const bool needsRewind = fNeedsRewind; | 84 const bool needsRewind = fNeedsRewind; |
| 85 fNeedsRewind = true; | 85 fNeedsRewind = true; |
| 86 if (!needsRewind) { | 86 if (!needsRewind) { |
| 87 return kNoRewindNecessary_RewindState; | 87 return kNoRewindNecessary_RewindState; |
| 88 } | 88 } |
| 89 return fStream->rewind() ? kRewound_RewindState | 89 return fStream->rewind() ? kRewound_RewindState |
| 90 : kCouldNotRewind_RewindState; | 90 : kCouldNotRewind_RewindState; |
| 91 } | 91 } |
| 92 | 92 |
| 93 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { | 93 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo, const
Options* options, |
| 94 fScanlineDecoder.reset(this->onGetScanlineDecoder(dstInfo)); | 94 SkPMColor ctable[], int* ctableCount) { |
| 95 |
| 96 // Set options. |
| 97 Options optsStorage; |
| 98 if (NULL == options) { |
| 99 options = &optsStorage; |
| 100 } |
| 101 |
| 102 fScanlineDecoder.reset(this->onGetScanlineDecoder(dstInfo, *options, ctable,
ctableCount)); |
| 95 return fScanlineDecoder.get(); | 103 return fScanlineDecoder.get(); |
| 96 } | 104 } |
| 105 |
| 106 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { |
| 107 SkASSERT(kIndex_8_SkColorType != dstInfo.colorType()); |
| 108 if (kIndex_8_SkColorType == dstInfo.colorType()) { |
| 109 return NULL; |
| 110 } |
| 111 return this->getScanlineDecoder(dstInfo, NULL, NULL, NULL); |
| 112 } |
| OLD | NEW |