summaryrefslogtreecommitdiff
path: root/chromium/third_party/skia/src/codec/SkAndroidCodecAdapter.h
blob: 2d453e39f0b5368ee25b5725fc1991a9dd1fd4bf (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SkAndroidCodecAdapter_DEFINED
#define SkAndroidCodecAdapter_DEFINED

#include "include/codec/SkAndroidCodec.h"
#include "include/codec/SkCodec.h"
#include "include/core/SkSize.h"

#include <cstddef>

struct SkIRect;
struct SkImageInfo;

/**
 *  This class wraps SkCodec to implement the functionality of SkAndroidCodec.
 *  The underlying SkCodec implements sampled decodes.  SkCodec's that do not
 *  implement that are wrapped with SkSampledCodec instead.
 */
class SkAndroidCodecAdapter : public SkAndroidCodec {
public:

    explicit SkAndroidCodecAdapter(SkCodec*);

    ~SkAndroidCodecAdapter() override {}

protected:

    SkISize onGetSampledDimensions(int sampleSize) const override;

    bool onGetSupportedSubset(SkIRect* desiredSubset) const override;

    SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
            const AndroidOptions& options) override;

private:

    using INHERITED = SkAndroidCodec;
};
#endif // SkAndroidCodecAdapter_DEFINED