msarett | 26ad17b | 2015-10-22 07:29:19 -0700 | [diff] [blame] | 1 | /* |
| 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" |
msarett | 5cb4885 | 2015-11-06 08:56:32 -0800 | [diff] [blame] | 9 | #include "SkBitmapRegionDecoder.h" |
msarett | 26ad17b | 2015-10-22 07:29:19 -0700 | [diff] [blame] | 10 | #include "SkAndroidCodec.h" |
| 11 | |
| 12 | /* |
| 13 | * This class implements SkBitmapRegionDecoder using an SkAndroidCodec. |
| 14 | */ |
msarett | 5cb4885 | 2015-11-06 08:56:32 -0800 | [diff] [blame] | 15 | class SkBitmapRegionCodec : public SkBitmapRegionDecoder { |
msarett | 26ad17b | 2015-10-22 07:29:19 -0700 | [diff] [blame] | 16 | public: |
| 17 | |
| 18 | /* |
| 19 | * Takes ownership of pointer to codec |
| 20 | */ |
| 21 | SkBitmapRegionCodec(SkAndroidCodec* codec); |
| 22 | |
msarett | cb8d719 | 2015-11-11 13:30:43 -0800 | [diff] [blame] | 23 | bool decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator, |
msarett | 35e5d1b | 2015-10-27 12:50:25 -0700 | [diff] [blame] | 24 | const SkIRect& desiredSubset, int sampleSize, |
| 25 | SkColorType colorType, bool requireUnpremul) override; |
msarett | 26ad17b | 2015-10-22 07:29:19 -0700 | [diff] [blame] | 26 | |
| 27 | bool conversionSupported(SkColorType colorType) override; |
| 28 | |
msarett | 3f65e93 | 2015-10-27 13:12:59 -0700 | [diff] [blame] | 29 | SkEncodedFormat getEncodedFormat() override { return fCodec->getEncodedFormat(); } |
| 30 | |
msarett | 26ad17b | 2015-10-22 07:29:19 -0700 | [diff] [blame] | 31 | private: |
| 32 | |
| 33 | SkAutoTDelete<SkAndroidCodec> fCodec; |
| 34 | |
msarett | 5cb4885 | 2015-11-06 08:56:32 -0800 | [diff] [blame] | 35 | typedef SkBitmapRegionDecoder INHERITED; |
msarett | 26ad17b | 2015-10-22 07:29:19 -0700 | [diff] [blame] | 36 | |
| 37 | }; |