| 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 #ifndef SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED |
| 9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED |
| 10 | 10 |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 bool dimensionsSupported(const SkISize& dim) { | 650 bool dimensionsSupported(const SkISize& dim) { |
| 651 return dim == fSrcInfo.dimensions() || this->onDimensionsSupported(dim); | 651 return dim == fSrcInfo.dimensions() || this->onDimensionsSupported(dim); |
| 652 } | 652 } |
| 653 | 653 |
| 654 // Methods for scanline decoding. | 654 // Methods for scanline decoding. |
| 655 virtual SkCodec::Result onStartScanlineDecode(const SkImageInfo& /*dstInfo*/
, | 655 virtual SkCodec::Result onStartScanlineDecode(const SkImageInfo& /*dstInfo*/
, |
| 656 const SkCodec::Options& /*options*/, SkPMColor* /*ctable*/, int* /*c
tableCount*/) { | 656 const SkCodec::Options& /*options*/, SkPMColor* /*ctable*/, int* /*c
tableCount*/) { |
| 657 return kUnimplemented; | 657 return kUnimplemented; |
| 658 } | 658 } |
| 659 | 659 |
| 660 // Naive default version just calls onGetScanlines on temp memory. | 660 virtual bool onSkipScanlines(int /*countLines*/) { return false; } |
| 661 virtual bool onSkipScanlines(int countLines) { | |
| 662 // FIXME (msarett): Make this a pure virtual and always override this. | |
| 663 SkAutoMalloc storage(fDstInfo.minRowBytes()); | |
| 664 | |
| 665 // Note that we pass 0 to rowBytes so we continue to use the same memory
. | |
| 666 // Also note that while getScanlines checks that rowBytes is big enough, | |
| 667 // onGetScanlines bypasses that check. | |
| 668 // Calling the virtual method also means we do not double count | |
| 669 // countLines. | |
| 670 return countLines == this->onGetScanlines(storage.get(), countLines, 0); | |
| 671 } | |
| 672 | 661 |
| 673 virtual int onGetScanlines(void* /*dst*/, int /*countLines*/, size_t /*rowBy
tes*/) { return 0; } | 662 virtual int onGetScanlines(void* /*dst*/, int /*countLines*/, size_t /*rowBy
tes*/) { return 0; } |
| 674 | 663 |
| 675 /** | 664 /** |
| 676 * On an incomplete decode, getPixels() and getScanlines() will call this fu
nction | 665 * On an incomplete decode, getPixels() and getScanlines() will call this fu
nction |
| 677 * to fill any uinitialized memory. | 666 * to fill any uinitialized memory. |
| 678 * | 667 * |
| 679 * @param dstInfo Contains the destination color type | 668 * @param dstInfo Contains the destination color type |
| 680 * Contains the destination alpha type | 669 * Contains the destination alpha type |
| 681 * Contains the destination width | 670 * Contains the destination width |
| (...skipping 14 matching lines...) Expand all Loading... |
| 696 * not affect ownership. | 685 * not affect ownership. |
| 697 * | 686 * |
| 698 * Only valid during scanline decoding. | 687 * Only valid during scanline decoding. |
| 699 */ | 688 */ |
| 700 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} | 689 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} |
| 701 | 690 |
| 702 friend class SkSampledCodec; | 691 friend class SkSampledCodec; |
| 703 friend class SkIcoCodec; | 692 friend class SkIcoCodec; |
| 704 }; | 693 }; |
| 705 #endif // SkCodec_DEFINED | 694 #endif // SkCodec_DEFINED |
| OLD | NEW |