| 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 int* inputColorCount) { | 578 int* inputColorCount) { |
| 579 // Check for proper input and output formats | 579 // Check for proper input and output formats |
| 580 SkCodec::RewindState rewindState = this->rewindIfNeeded(); | 580 SkCodec::RewindState rewindState = this->rewindIfNeeded(); |
| 581 if (rewindState == kCouldNotRewind_RewindState) { | 581 if (rewindState == kCouldNotRewind_RewindState) { |
| 582 return kCouldNotRewind; | 582 return kCouldNotRewind; |
| 583 } else if (rewindState == kRewound_RewindState) { | 583 } else if (rewindState == kRewound_RewindState) { |
| 584 if (!ReadHeader(this->stream(), fIsIco, NULL)) { | 584 if (!ReadHeader(this->stream(), fIsIco, NULL)) { |
| 585 return kCouldNotRewind; | 585 return kCouldNotRewind; |
| 586 } | 586 } |
| 587 } | 587 } |
| 588 if (opts.fSubset) { |
| 589 // Subsets are not supported. |
| 590 return kUnimplemented; |
| 591 } |
| 588 if (dstInfo.dimensions() != this->getInfo().dimensions()) { | 592 if (dstInfo.dimensions() != this->getInfo().dimensions()) { |
| 589 SkCodecPrintf("Error: scaling not supported.\n"); | 593 SkCodecPrintf("Error: scaling not supported.\n"); |
| 590 return kInvalidScale; | 594 return kInvalidScale; |
| 591 } | 595 } |
| 592 if (!conversion_possible(dstInfo, this->getInfo())) { | 596 if (!conversion_possible(dstInfo, this->getInfo())) { |
| 593 SkCodecPrintf("Error: cannot convert input type to output type.\n"); | 597 SkCodecPrintf("Error: cannot convert input type to output type.\n"); |
| 594 return kInvalidConversion; | 598 return kInvalidConversion; |
| 595 } | 599 } |
| 596 | 600 |
| 597 // Create the color table if necessary and prepare the stream for decode | 601 // Create the color table if necessary and prepare the stream for decode |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 uint32_t alphaBit = | 1225 uint32_t alphaBit = |
| 1222 (srcBuffer.get()[quotient] >> shift) & 0x1; | 1226 (srcBuffer.get()[quotient] >> shift) & 0x1; |
| 1223 dstRow[x] &= alphaBit - 1; | 1227 dstRow[x] &= alphaBit - 1; |
| 1224 } | 1228 } |
| 1225 } | 1229 } |
| 1226 } | 1230 } |
| 1227 | 1231 |
| 1228 // Finished decoding the entire image | 1232 // Finished decoding the entire image |
| 1229 return kSuccess; | 1233 return kSuccess; |
| 1230 } | 1234 } |
| OLD | NEW |