1 /* 2 * Copyright 2015 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "SkCodec.h" 9 #include "SkCodecPriv.h" 10 #include "SkWebpAdapterCodec.h" 11 12 SkWebpAdapterCodec::SkWebpAdapterCodec(SkWebpCodec* codec, ExifOrientationBehavior behavior) 13 : INHERITED(codec, behavior) 14 {} 15 16 SkISize SkWebpAdapterCodec::onGetSampledDimensions(int sampleSize) const { 17 float scale = get_scale_from_sample_size(sampleSize); 18 return this->codec()->getScaledDimensions(scale); 19 } 20 21 bool SkWebpAdapterCodec::onGetSupportedSubset(SkIRect* desiredSubset) const { 22 return this->codec()->getValidSubset(desiredSubset); 23 } 24 25 SkCodec::Result SkWebpAdapterCodec::onGetAndroidPixels(const SkImageInfo& info, void* pixels, 26 size_t rowBytes, const AndroidOptions& options) { 27 SkCodec::Options codecOptions; 28 codecOptions.fZeroInitialized = options.fZeroInitialized; 29 codecOptions.fSubset = options.fSubset; 30 codecOptions.fPremulBehavior = SkTransferFunctionBehavior::kIgnore; 31 return this->codec()->getPixels(info, pixels, rowBytes, &codecOptions); 32 } 33