| 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 "SkAndroidCodec.h" |
| 11 | 11 |
| 12 /* | 12 /* |
| 13 * This class implements SkBitmapRegionDecoder using an SkCodec and | 13 * This class implements SkBitmapRegionDecoder using an SkAndroidCodec. |
| 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. | |
| 16 */ | 14 */ |
| 17 // FIXME (msarett): This implementation does not support WEBP, because WEBP | 15 class SkBitmapRegionCodec : public SkBitmapRegionDecoderInterface { |
| 18 // does not have a scanline decoder. | |
| 19 class SkBitmapRegionCanvas : public SkBitmapRegionDecoderInterface { | |
| 20 public: | 16 public: |
| 21 | 17 |
| 22 /* | 18 /* |
| 23 * Takes ownership of pointer to decoder | 19 * Takes ownership of pointer to codec |
| 24 */ | 20 */ |
| 25 SkBitmapRegionCanvas(SkCodec* decoder); | 21 SkBitmapRegionCodec(SkAndroidCodec* codec); |
| 26 | 22 |
| 27 /* | 23 /* |
| 28 * Three differences from the Android version: | 24 * Three differences from the Android version: |
| 29 * Returns a Skia bitmap instead of an Android bitmap. | 25 * Returns a Skia bitmap instead of an Android bitmap. |
| 30 * Android version attempts to reuse a recycled bitmap. | 26 * Android version attempts to reuse a recycled bitmap. |
| 31 * Removed the options object and used parameters for color type and | 27 * Removed the options object and used parameters for color type and |
| 32 * sample size. | 28 * sample size. |
| 33 */ | 29 */ |
| 34 SkBitmap* decodeRegion(int start_x, int start_y, int width, int height, | 30 SkBitmap* decodeRegion(int start_x, int start_y, int width, int height, |
| 35 int sampleSize, SkColorType prefColorType) override; | 31 int sampleSize, SkColorType prefColorType) override; |
| 36 | 32 |
| 37 bool conversionSupported(SkColorType colorType) override; | 33 bool conversionSupported(SkColorType colorType) override; |
| 38 | 34 |
| 39 private: | 35 private: |
| 40 | 36 |
| 41 SkAutoTDelete<SkCodec> fDecoder; | 37 SkAutoTDelete<SkAndroidCodec> fCodec; |
| 42 | 38 |
| 43 typedef SkBitmapRegionDecoderInterface INHERITED; | 39 typedef SkBitmapRegionDecoderInterface INHERITED; |
| 44 | 40 |
| 45 }; | 41 }; |
| OLD | NEW |