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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 , fNeedsRewind(false) | 54 , fNeedsRewind(false) |
55 {} | 55 {} |
56 | 56 |
57 bool SkCodec::rewindIfNeeded() { | 57 bool SkCodec::rewindIfNeeded() { |
58 // Store the value of fNeedsRewind so we can update it. Next read will | 58 // Store the value of fNeedsRewind so we can update it. Next read will |
59 // require a rewind. | 59 // require a rewind. |
60 const bool neededRewind = fNeedsRewind; | 60 const bool neededRewind = fNeedsRewind; |
61 fNeedsRewind = true; | 61 fNeedsRewind = true; |
62 return !neededRewind || fStream->rewind(); | 62 return !neededRewind || fStream->rewind(); |
63 } | 63 } |
| 64 |
| 65 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { |
| 66 fScanlineDecoder.reset(NULL); |
| 67 if (!rewindIfNeeded()) { |
| 68 return NULL; |
| 69 } |
| 70 fScanlineDecoder.reset(this->onGetScanlineDecoder(dstInfo)); |
| 71 return fScanlineDecoder.get(); |
| 72 } |
OLD | NEW |