WebP - allow more scales

We previously artificially restricted to using sample sizes. But there
is no reason to do so. Android's new API allows arbitrary scaling, so
support it.

Change-Id: I15f48f9b27b11f8cabb55e3f79ae6ee5ffd39069
Reviewed-on: https://skia-review.googlesource.com/69600
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This commit is contained in:
Leon Scroggins III 2017-11-09 14:43:43 -05:00 committed by Skia Commit-Bot
parent eafd48af63
commit 5f1c8ff524

View File

@ -24,19 +24,6 @@ bool SkWebpAdapterCodec::onGetSupportedSubset(SkIRect* desiredSubset) const {
SkCodec::Result SkWebpAdapterCodec::onGetAndroidPixels(const SkImageInfo& info, void* pixels, SkCodec::Result SkWebpAdapterCodec::onGetAndroidPixels(const SkImageInfo& info, void* pixels,
size_t rowBytes, const AndroidOptions& options) { size_t rowBytes, const AndroidOptions& options) {
// SkWebpCodec will support pretty much any dimensions that we provide, but we want
// to be stricter about the type of scaling that we allow, so we will add an extra
// check here.
SkISize supportedSize;
if (!options.fSubset) {
supportedSize = this->onGetSampledDimensions(options.fSampleSize);
} else {
supportedSize = this->getSampledSubsetDimensions(options.fSampleSize, *options.fSubset);
}
if (supportedSize != info.dimensions()) {
return SkCodec::kInvalidParameters;
}
SkCodec::Options codecOptions; SkCodec::Options codecOptions;
codecOptions.fZeroInitialized = options.fZeroInitialized; codecOptions.fZeroInitialized = options.fZeroInitialized;
codecOptions.fSubset = options.fSubset; codecOptions.fSubset = options.fSubset;