blob: 14d024ea4542ed8d5c49ff237644109858c05410 [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
23 /*
24 * Three differences from the Android version:
25 * Returns a Skia bitmap instead of an Android bitmap.
26 * Android version attempts to reuse a recycled bitmap.
27 * Removed the options object and used parameters for color type and
28 * sample size.
29 */
30 SkBitmap* decodeRegion(int start_x, int start_y, int width, int height,
31 int sampleSize, SkColorType prefColorType) override;
32
33 bool conversionSupported(SkColorType colorType) override;
34
35private:
36
37 SkAutoTDelete<SkAndroidCodec> fCodec;
38
39 typedef SkBitmapRegionDecoderInterface INHERITED;
40
41};