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

Unified Diff: include/codec/SkScanlineDecoder.h

Issue 1260673002: SkScaledCodec class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use SkWebpCodec native scaling, update comments and spacing Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: include/codec/SkScanlineDecoder.h
diff --git a/include/codec/SkScanlineDecoder.h b/include/codec/SkScanlineDecoder.h
index 8376e57c09d84bb48c1d7ae295ccd441a7feab48..9e4c8b51b9b63e23f8dbaf56c670b0cea10fdebb 100644
--- a/include/codec/SkScanlineDecoder.h
+++ b/include/codec/SkScanlineDecoder.h
@@ -35,7 +35,7 @@ public:
*/
SkCodec::Result getScanlines(void* dst, int countLines, size_t rowBytes) {
if ((rowBytes < fDstInfo.minRowBytes() && countLines > 1 ) || countLines <= 0
- || fCurrScanline + countLines > fDstInfo.height()) {
+ || fCurrScanline + countLines > fSrcInfo.height()) {
return SkCodec::kInvalidParameters;
}
const SkCodec::Result result = this->onGetScanlines(dst, countLines, rowBytes);
@@ -52,7 +52,7 @@ public:
* false.
*/
SkCodec::Result skipScanlines(int countLines) {
- if (fCurrScanline + countLines > fDstInfo.height()) {
+ if (fCurrScanline + countLines > fSrcInfo.height()) {
// Arguably, we could just skip the scanlines which are remaining,
// and return kSuccess. We choose to return invalid so the client
// can catch their bug.
@@ -75,18 +75,31 @@ public:
return this->onReallyHasAlpha();
}
+ /**
+ * set the sample size in the x direction
+ * returns true if successful
scroggo 2015/07/27 19:29:57 Returns whether sampleX is supported.
+ * returns false if failed
+ */
+ bool setSampleX(int sampleX) {
+ return this->onSetSampleX(sampleX);
+ }
+
protected:
- SkScanlineDecoder(const SkImageInfo& requested)
+ SkScanlineDecoder(const SkImageInfo& requested, const SkImageInfo& src)
: fDstInfo(requested)
- , fCurrScanline(0) {}
+ , fCurrScanline(0)
+ , fSrcInfo(src) {}
virtual bool onReallyHasAlpha() const { return false; }
+ virtual bool onSetSampleX(int SampleX){ return false; }
+
const SkImageInfo& dstInfo() const { return fDstInfo; }
private:
const SkImageInfo fDstInfo;
int fCurrScanline;
+ const SkImageInfo fSrcInfo;
// Naive default version just calls onGetScanlines on temp memory.
virtual SkCodec::Result onSkipScanlines(int countLines) {

Powered by Google App Engine
This is Rietveld 408576698