OLD | NEW |
(Empty) | |
| 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" |
| 9 #include "SkBitmapRegionDecoder.h" |
| 10 #include "SkImageDecoder.h" |
| 11 #include "SkTemplates.h" |
| 12 |
| 13 /* |
| 14 * This class aims to duplicate the current implementation of |
| 15 * SkBitmapRegionDecoder in Android. |
| 16 */ |
| 17 class SkBitmapRegionSampler : public SkBitmapRegionDecoder { |
| 18 public: |
| 19 |
| 20 /* |
| 21 * This has several key differences from the Android version: |
| 22 * Returns a Skia bitmap instead of an Android bitmap. |
| 23 * Android version attempts to reuse a recycled bitmap. |
| 24 * Removed the options object and used parameters for color type and |
| 25 * sample size. |
| 26 */ |
| 27 SkBitmap* decodeRegion(int start_x, int start_y, int width, int height, |
| 28 int sampleSize, SkColorType prefColorType) override; |
| 29 |
| 30 SkBitmapRegionSampler(SkImageDecoder* decoder, int width, int height); |
| 31 |
| 32 ~SkBitmapRegionSampler() {} |
| 33 |
| 34 private: |
| 35 |
| 36 SkAutoTDelete<SkImageDecoder> fDecoder; |
| 37 |
| 38 typedef SkBitmapRegionDecoder INHERITED; |
| 39 |
| 40 }; |
OLD | NEW |