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

Unified Diff: include/codec/SkScanlineDecoder.h

Issue 1260673002: SkScaledCodec class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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..d1cba35cce8da94fa6c0559b9f58a0970284f12a 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,26 @@ public:
return this->onReallyHasAlpha();
}
+ bool setSampleX(int sampleX) {
scroggo 2015/07/27 15:09:19 Please add comments explaining what this does.
emmaleer 2015/07/27 18:31:38 Acknowledged.
+ return this->onSetSampleX(sampleX);
+ }
+
protected:
- SkScanlineDecoder(const SkImageInfo& requested)
+ SkScanlineDecoder(const SkImageInfo& requested, const SkImageInfo src)
scroggo 2015/07/27 15:09:19 This should be a const reference. That way we do n
emmaleer 2015/07/27 18:31:38 Acknowledged.
: 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