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 "src/codec/SkAndroidCodecAdapter.h"
9#include "src/codec/SkCodecPriv.h"
10
11SkAndroidCodecAdapter::SkAndroidCodecAdapter(SkCodec* codec, ExifOrientationBehavior behavior)
12 : INHERITED(codec, behavior)
13{}
14
15SkISize SkAndroidCodecAdapter::onGetSampledDimensions(int sampleSize) const {
16 float scale = get_scale_from_sample_size(sampleSize);
17 return this->codec()->getScaledDimensions(scale);
18}
19
20bool SkAndroidCodecAdapter::onGetSupportedSubset(SkIRect* desiredSubset) const {
21 return this->codec()->getValidSubset(desiredSubset);
22}
23
24SkCodec::Result SkAndroidCodecAdapter::onGetAndroidPixels(const SkImageInfo& info, void* pixels,
25 size_t rowBytes, const AndroidOptions& options) {
26 SkCodec::Options codecOptions;
27 codecOptions.fZeroInitialized = options.fZeroInitialized;
28 codecOptions.fSubset = options.fSubset;
29 return this->codec()->getPixels(info, pixels, rowBytes, &codecOptions);
30}
31