blob: 79774173b0e31af097f6d82e3bb4096078a4e01b [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"
msarett5cb48852015-11-06 08:56:32 -08009#include "SkBitmapRegionDecoder.h"
msarett26ad17b2015-10-22 07:29:19 -070010#include "SkAndroidCodec.h"
11
12/*
13 * This class implements SkBitmapRegionDecoder using an SkAndroidCodec.
14 */
msarett5cb48852015-11-06 08:56:32 -080015class SkBitmapRegionCodec : public SkBitmapRegionDecoder {
msarett26ad17b2015-10-22 07:29:19 -070016public:
17
18 /*
19 * Takes ownership of pointer to codec
20 */
21 SkBitmapRegionCodec(SkAndroidCodec* codec);
22
msarettcb8d7192015-11-11 13:30:43 -080023 bool decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator,
msarett35e5d1b2015-10-27 12:50:25 -070024 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
msarett5cb48852015-11-06 08:56:32 -080035 typedef SkBitmapRegionDecoder INHERITED;
msarett26ad17b2015-10-22 07:29:19 -070036
37};