| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 return codec; | 539 return codec; |
| 540 } | 540 } |
| 541 return nullptr; | 541 return nullptr; |
| 542 } | 542 } |
| 543 | 543 |
| 544 SkBmpCodec::SkBmpCodec(const SkImageInfo& info, SkStream* stream, | 544 SkBmpCodec::SkBmpCodec(const SkImageInfo& info, SkStream* stream, |
| 545 uint16_t bitsPerPixel, SkCodec::SkScanlineOrder rowOrder) | 545 uint16_t bitsPerPixel, SkCodec::SkScanlineOrder rowOrder) |
| 546 : INHERITED(info, stream) | 546 : INHERITED(info, stream) |
| 547 , fBitsPerPixel(bitsPerPixel) | 547 , fBitsPerPixel(bitsPerPixel) |
| 548 , fRowOrder(rowOrder) | 548 , fRowOrder(rowOrder) |
| 549 , fSrcRowBytes(SkAlign4(compute_row_bytes(info.width(), fBitsPerPixel))) |
| 549 {} | 550 {} |
| 550 | 551 |
| 551 bool SkBmpCodec::onRewind() { | 552 bool SkBmpCodec::onRewind() { |
| 552 return SkBmpCodec::ReadHeader(this->stream(), this->inIco(), nullptr); | 553 return SkBmpCodec::ReadHeader(this->stream(), this->inIco(), nullptr); |
| 553 } | 554 } |
| 554 | 555 |
| 555 int32_t SkBmpCodec::getDstRow(int32_t y, int32_t height) const { | 556 int32_t SkBmpCodec::getDstRow(int32_t y, int32_t height) const { |
| 556 if (SkCodec::kTopDown_SkScanlineOrder == fRowOrder) { | 557 if (SkCodec::kTopDown_SkScanlineOrder == fRowOrder) { |
| 557 return y; | 558 return y; |
| 558 } | 559 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 570 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); | 571 return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount); |
| 571 } | 572 } |
| 572 | 573 |
| 573 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { | 574 int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { |
| 574 // 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 |
| 575 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count)
; | 576 SkImageInfo rowInfo = this->dstInfo().makeWH(this->dstInfo().width(), count)
; |
| 576 | 577 |
| 577 // Decode the requested rows | 578 // Decode the requested rows |
| 578 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); | 579 return this->decodeRows(rowInfo, dst, rowBytes, this->options()); |
| 579 } | 580 } |
| 581 |
| 582 bool SkBmpCodec::skipRows(int count) { |
| 583 const size_t bytesToSkip = count * fSrcRowBytes; |
| 584 return this->stream()->skip(bytesToSkip) == bytesToSkip; |
| 585 } |
| 586 |
| 587 bool SkBmpCodec::onSkipScanlines(int count) { |
| 588 return this->skipRows(count); |
| 589 } |
| OLD | NEW |