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

Unified Diff: src/codec/SkCodec.cpp

Issue 1372973002: Move all knowledge of X sampling into SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@codecSDmerge
Patch Set: Attempt to fix RLE overflow Created 5 years, 2 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
« no previous file with comments | « src/codec/SkBmpStandardCodec.cpp ('k') | src/codec/SkCodec_libgif.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodec.cpp
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index cabcadcccda5c872b69834daa18bbe1701be82fd..1a901a97ac4314b210dd6deeeebf14d4957760e9 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -152,7 +152,21 @@ SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
Options optsStorage;
if (nullptr == options) {
options = &optsStorage;
+ } else if (options->fSubset) {
+ SkIRect subset(*options->fSubset);
+ if (!this->onGetValidSubset(&subset) || subset != *options->fSubset) {
+ // FIXME: How to differentiate between not supporting subset at all
+ // and not supporting this particular subset?
+ return kUnimplemented;
+ }
+ }
+
+ // FIXME: Support subsets somehow? Note that this works for SkWebpCodec
+ // because it supports arbitrary scaling/subset combinations.
+ if (!this->dimensionsSupported(info.dimensions())) {
+ return kInvalidScale;
}
+
const Result result = this->onGetPixels(info, pixels, rowBytes, *options, ctable, ctableCount);
if ((kIncompleteInput == result || kSuccess == result) && ctableCount) {
@@ -190,6 +204,18 @@ SkCodec::Result SkCodec::startScanlineDecode(const SkImageInfo& dstInfo,
Options optsStorage;
if (nullptr == options) {
options = &optsStorage;
+ } else if (options->fSubset) {
+ SkIRect subset(*options->fSubset);
+ if (!this->onGetValidSubset(&subset) || subset != *options->fSubset) {
+ // FIXME: How to differentiate between not supporting subset at all
+ // and not supporting this particular subset?
+ return kUnimplemented;
+ }
+ }
+
+ // FIXME: Support subsets somehow?
+ if (!this->dimensionsSupported(dstInfo.dimensions())) {
+ return kInvalidScale;
}
const Result result = this->onStartScanlineDecode(dstInfo, *options, ctable, ctableCount);
@@ -213,8 +239,8 @@ SkCodec::Result SkCodec::getScanlines(void* dst, int countLines, size_t rowBytes
}
SkASSERT(!fDstInfo.isEmpty());
- if ((rowBytes < fDstInfo.minRowBytes() && countLines > 1 ) || countLines <= 0
- || fCurrScanline + countLines > fDstInfo.height()) {
+
+ if (countLines <= 0 || fCurrScanline + countLines > fDstInfo.height()) {
return kInvalidParameters;
}
« no previous file with comments | « src/codec/SkBmpStandardCodec.cpp ('k') | src/codec/SkCodec_libgif.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698