| 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 474 } |
| 475 | 475 |
| 476 if (codecOut) { | 476 if (codecOut) { |
| 477 // Set the image info | 477 // Set the image info |
| 478 const SkImageInfo& imageInfo = SkImageInfo::Make(width, height, | 478 const SkImageInfo& imageInfo = SkImageInfo::Make(width, height, |
| 479 colorType, alphaType); | 479 colorType, alphaType); |
| 480 | 480 |
| 481 // Return the codec | 481 // Return the codec |
| 482 switch (inputFormat) { | 482 switch (inputFormat) { |
| 483 case kStandard_BmpInputFormat: | 483 case kStandard_BmpInputFormat: |
| 484 // We require streams to have a memory base for Bmp-in-Ico decod
es. | |
| 485 SkASSERT(!inIco || nullptr != stream->getMemoryBase()); | |
| 486 *codecOut = new SkBmpStandardCodec(imageInfo, stream, bitsPerPix
el, numColors, | 484 *codecOut = new SkBmpStandardCodec(imageInfo, stream, bitsPerPix
el, numColors, |
| 487 bytesPerColor, offset - bytesRead, rowOrder, inIco); | 485 bytesPerColor, offset - bytesRead, rowOrder, inIco); |
| 488 return true; | 486 return true; |
| 489 case kBitMask_BmpInputFormat: | 487 case kBitMask_BmpInputFormat: |
| 490 // Bmp-in-Ico must be standard mode | 488 // Bmp-in-Ico must be standard mode |
| 491 if (inIco) { | 489 if (inIco) { |
| 492 SkCodecPrintf("Error: Icos may not use bit mask format.\n"); | 490 SkCodecPrintf("Error: Icos may not use bit mask format.\n"); |
| 493 return false; | 491 return false; |
| 494 } | 492 } |
| 495 | 493 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); | 571 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); |
| 574 } | 572 } |
| 575 | 573 |
| 576 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { | 574 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { |
| 577 // Create a new image info representing the portion of the image to decode | 575 // Create a new image info representing the portion of the image to decode |
| 578 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count)
; | 576 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count)
; |
| 579 | 577 |
| 580 // Decode the requested rows | 578 // Decode the requested rows |
| 581 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); | 579 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); |
| 582 } | 580 } |
| OLD | NEW |