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 "SkBmpCodec.h" | 8 #include "SkBmpCodec.h" |
9 #include "SkBmpMaskCodec.h" | 9 #include "SkBmpMaskCodec.h" |
10 #include "SkBmpRLECodec.h" | 10 #include "SkBmpRLECodec.h" |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 int32_t SkBmpCodec::getDstRow(int32_t y, int32_t height) const { | 596 int32_t SkBmpCodec::getDstRow(int32_t y, int32_t height) const { |
597 if (SkCodec::kTopDown_SkScanlineOrder == fRowOrder) { | 597 if (SkCodec::kTopDown_SkScanlineOrder == fRowOrder) { |
598 return y; | 598 return y; |
599 } | 599 } |
600 SkASSERT(SkCodec::kBottomUp_SkScanlineOrder == fRowOrder); | 600 SkASSERT(SkCodec::kBottomUp_SkScanlineOrder == fRowOrder); |
601 return height - y - 1; | 601 return height - y - 1; |
602 } | 602 } |
603 | 603 |
604 SkCodec::Result SkBmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, | 604 SkCodec::Result SkBmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, |
605 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo
lorCount) { | 605 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo
lorCount) { |
606 if (!conversion_possible(dstInfo, this->getInfo())) { | 606 if (!conversion_possible_ignore_color_space(dstInfo, this->getInfo())) { |
607 SkCodecPrintf("Error: cannot convert input type to output type.\n"); | 607 SkCodecPrintf("Error: cannot convert input type to output type.\n"); |
608 return kInvalidConversion; | 608 return kInvalidConversion; |
609 } | 609 } |
610 | 610 |
611 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); | 611 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); |
612 } | 612 } |
613 | 613 |
614 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { | 614 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { |
615 // Create a new image info representing the portion of the image to decode | 615 // Create a new image info representing the portion of the image to decode |
616 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count)
; | 616 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count)
; |
617 | 617 |
618 // Decode the requested rows | 618 // Decode the requested rows |
619 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); | 619 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); |
620 } | 620 } |
621 | 621 |
622 bool SkBmpCodec::skipRows(int count) { | 622 bool SkBmpCodec::skipRows(int count) { |
623 const size_t bytesToSkip = count * fSrcRowBytes; | 623 const size_t bytesToSkip = count * fSrcRowBytes; |
624 return this->stream()->skip(bytesToSkip) == bytesToSkip; | 624 return this->stream()->skip(bytesToSkip) == bytesToSkip; |
625 } | 625 } |
626 | 626 |
627 bool SkBmpCodec::onSkipScanlines(int count) { | 627 bool SkBmpCodec::onSkipScanlines(int count) { |
628 return this->skipRows(count); | 628 return this->skipRows(count); |
629 } | 629 } |
OLD | NEW |