| 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // Also set numColors to maxColors when it is too large | 557 // Also set numColors to maxColors when it is too large |
| 558 uint32_t maxColors = 1 << fBitsPerPixel; | 558 uint32_t maxColors = 1 << fBitsPerPixel; |
| 559 if (numColors == 0 || numColors >= maxColors) { | 559 if (numColors == 0 || numColors >= maxColors) { |
| 560 return maxColors; | 560 return maxColors; |
| 561 } | 561 } |
| 562 return numColors; | 562 return numColors; |
| 563 } | 563 } |
| 564 | 564 |
| 565 SkCodec::Result SkBmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, | 565 SkCodec::Result SkBmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, |
| 566 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo
lorCount) { | 566 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo
lorCount) { |
| 567 if (options.fSubset) { | |
| 568 // Subsets are not supported. | |
| 569 return kUnimplemented; | |
| 570 } | |
| 571 if (!conversion_possible(dstInfo, this->getInfo())) { | 567 if (!conversion_possible(dstInfo, this->getInfo())) { |
| 572 SkCodecPrintf("Error: cannot convert input type to output type.\n"); | 568 SkCodecPrintf("Error: cannot convert input type to output type.\n"); |
| 573 return kInvalidConversion; | 569 return kInvalidConversion; |
| 574 } | 570 } |
| 575 | 571 |
| 576 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); | 572 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); |
| 577 } | 573 } |
| 578 | 574 |
| 579 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { | 575 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { |
| 580 // Create a new image info representing the portion of the image to decode | 576 // Create a new image info representing the portion of the image to decode |
| 581 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count)
; | 577 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count)
; |
| 582 | 578 |
| 583 // Decode the requested rows | 579 // Decode the requested rows |
| 584 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); | 580 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); |
| 585 } | 581 } |
| OLD | NEW |