Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: include/codec/SkCodec.h

Issue 1691083002: Implement onSkipScanlines() for bmp and wbmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/codec/SkBmpCodec.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/codec/SkBmpCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698