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_libbmp.h" | 8 #include "SkCodec_libbmp.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 /* | 512 /* |
513 * | 513 * |
514 * Initiates the bitmap decode | 514 * Initiates the bitmap decode |
515 * | 515 * |
516 */ | 516 */ |
517 SkCodec::Result SkBmpCodec::onGetPixels(const SkImageInfo& dstInfo, | 517 SkCodec::Result SkBmpCodec::onGetPixels(const SkImageInfo& dstInfo, |
518 void* dst, size_t dstRowBytes, | 518 void* dst, size_t dstRowBytes, |
519 const Options&, | 519 const Options&, |
520 SkPMColor*, int*) { | 520 SkPMColor*, int*) { |
521 // Check for proper input and output formats | 521 // Check for proper input and output formats |
522 if (!this->rewindIfNeeded()) { | 522 SkCodec::RewindState rewindState = this->rewindIfNeeded(); |
| 523 if (rewindState == kCouldNotRewind_RewindState) { |
523 return kCouldNotRewind; | 524 return kCouldNotRewind; |
| 525 } else if (rewindState == kRewound_RewindState) { |
| 526 return kCouldNotRewind; // TODO(msarett): handle rewinds |
524 } | 527 } |
525 if (dstInfo.dimensions() != this->getInfo().dimensions()) { | 528 if (dstInfo.dimensions() != this->getInfo().dimensions()) { |
526 SkCodecPrintf("Error: scaling not supported.\n"); | 529 SkCodecPrintf("Error: scaling not supported.\n"); |
527 return kInvalidScale; | 530 return kInvalidScale; |
528 } | 531 } |
529 if (!conversion_possible(dstInfo, this->getInfo())) { | 532 if (!conversion_possible(dstInfo, this->getInfo())) { |
530 SkCodecPrintf("Error: cannot convert input type to output type.\n"); | 533 SkCodecPrintf("Error: cannot convert input type to output type.\n"); |
531 return kInvalidConversion; | 534 return kInvalidConversion; |
532 } | 535 } |
533 | 536 |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 uint32_t alphaBit = | 1105 uint32_t alphaBit = |
1103 (srcBuffer.get()[quotient] >> shift) & 0x1; | 1106 (srcBuffer.get()[quotient] >> shift) & 0x1; |
1104 dstRow[x] &= alphaBit - 1; | 1107 dstRow[x] &= alphaBit - 1; |
1105 } | 1108 } |
1106 } | 1109 } |
1107 } | 1110 } |
1108 | 1111 |
1109 // Finished decoding the entire image | 1112 // Finished decoding the entire image |
1110 return kSuccess; | 1113 return kSuccess; |
1111 } | 1114 } |
OLD | NEW |