blob: ade72fa9364417c3088c8be6502a1c1ec2e2b676 [file] [log] [blame]
msarett26ad17b2015-10-22 07:29:19 -07001/*
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 "SkBitmap.h"
9#include "SkBitmapRegionDecoderInterface.h"
10#include "SkAndroidCodec.h"
11
12/*
13 * This class implements SkBitmapRegionDecoder using an SkAndroidCodec.
14 */
15class SkBitmapRegionCodec : public SkBitmapRegionDecoderInterface {
16public:
17
18 /*
19 * Takes ownership of pointer to codec
20 */
21 SkBitmapRegionCodec(SkAndroidCodec* codec);
22
msarett35e5d1b2015-10-27 12:50:25 -070023 bool decodeRegion(SkBitmap* bitmap, SkBitmap::Allocator* allocator,
24 const SkIRect& desiredSubset, int sampleSize,
25 SkColorType colorType, bool requireUnpremul) override;
msarett26ad17b2015-10-22 07:29:19 -070026
27 bool conversionSupported(SkColorType colorType) override;
28
msarett3f65e932015-10-27 13:12:59 -070029 SkEncodedFormat getEncodedFormat() override { return fCodec->getEncodedFormat(); }
30
msarett26ad17b2015-10-22 07:29:19 -070031private:
32
33 SkAutoTDelete<SkAndroidCodec> fCodec;
34
35 typedef SkBitmapRegionDecoderInterface INHERITED;
36
37};