OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkBitmapRegionDecoderInterface.h" | 9 #include "SkBitmapRegionDecoderInterface.h" |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
11 | 11 |
12 /* | 12 /* |
13 * This class implements SkBitmapRegionDecoder using an SkCodec and | 13 * This class implements SkBitmapRegionDecoder using an SkCodec and |
14 * an SkCanvas. It uses the scanline decoder to subset the height. It then | 14 * an SkCanvas. It uses the scanline decoder to subset the height. It then |
15 * will subset the width and scale by drawing to an SkCanvas. | 15 * will subset the width and scale by drawing to an SkCanvas. |
16 */ | 16 */ |
17 // FIXME (msarett): This implementation does not support WEBP, because WEBP | 17 // FIXME (msarett): This implementation does not support WEBP, because WEBP |
18 // does not have a scanline decoder. | 18 // does not have a scanline decoder. |
19 class SkBitmapRegionCanvas : public SkBitmapRegionDecoderInterface { | 19 class SkBitmapRegionCanvas : public SkBitmapRegionDecoderInterface { |
20 public: | 20 public: |
21 | 21 |
22 /* | 22 /* |
23 * Takes ownership of pointer to decoder | 23 * Takes ownership of pointer to decoder |
24 */ | 24 */ |
25 SkBitmapRegionCanvas(SkCodec* decoder); | 25 SkBitmapRegionCanvas(SkCodec* decoder); |
26 | 26 |
27 /* | 27 bool decodeRegion(SkBitmap* bitmap, SkBitmap::Allocator* allocator, |
28 * Three differences from the Android version: | 28 const SkIRect& desiredSubset, int sampleSize, |
29 * Returns a Skia bitmap instead of an Android bitmap. | 29 SkColorType colorType, bool requireUnpremul) override; |
30 * Android version attempts to reuse a recycled bitmap. | |
31 * Removed the options object and used parameters for color type and | |
32 * sample size. | |
33 */ | |
34 SkBitmap* decodeRegion(int start_x, int start_y, int width, int height, | |
35 int sampleSize, SkColorType prefColorType) override; | |
36 | 30 |
37 bool conversionSupported(SkColorType colorType) override; | 31 bool conversionSupported(SkColorType colorType) override; |
38 | 32 |
39 private: | 33 private: |
40 | 34 |
41 SkAutoTDelete<SkCodec> fDecoder; | 35 SkAutoTDelete<SkCodec> fDecoder; |
42 | 36 |
43 typedef SkBitmapRegionDecoderInterface INHERITED; | 37 typedef SkBitmapRegionDecoderInterface INHERITED; |
44 | 38 |
45 }; | 39 }; |
OLD | NEW |