aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkRawAdapterCodec.cpp
blob: d4b31499875b7f6e7aef163e3d6a9a5c9d9e98de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkCodec.h"
#include "SkCodecPriv.h"
#include "SkRawAdapterCodec.h"

SkRawAdapterCodec::SkRawAdapterCodec(SkRawCodec* codec, ExifOrientationBehavior behavior)
    : INHERITED(codec, behavior)
{}

SkISize SkRawAdapterCodec::onGetSampledDimensions(int sampleSize) const {
    float scale = 1.f / static_cast<float>(sampleSize);
    return this->codec()->getScaledDimensions(scale);
}

SkCodec::Result SkRawAdapterCodec::onGetAndroidPixels(
        const SkImageInfo& info, void* pixels, size_t rowBytes,
        const AndroidOptions& options) {
    SkCodec::Options codecOptions;
    codecOptions.fZeroInitialized = options.fZeroInitialized;
    codecOptions.fSubset = options.fSubset;
    return this->codec()->getPixels(info, pixels, rowBytes, &codecOptions);
}