| 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 #ifndef SkBitmapRegionDecoder_DEFINED | 8 #ifndef SkBitmapRegionDecoder_DEFINED |
| 9 #define SkBitmapRegionDecoder_DEFINED | 9 #define SkBitmapRegionDecoder_DEFINED |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * @param data Refs the data while this object exists, unrefs on destruc
tion | 28 * @param data Refs the data while this object exists, unrefs on destruc
tion |
| 29 * @param strategy Strategy used for scaling and subsetting | 29 * @param strategy Strategy used for scaling and subsetting |
| 30 * @return Tries to create an SkBitmapRegionDecoder, returns NULL on
failure | 30 * @return Tries to create an SkBitmapRegionDecoder, returns NULL on
failure |
| 31 */ | 31 */ |
| 32 static SkBitmapRegionDecoderInterface* CreateBitmapRegionDecoder( | 32 static SkBitmapRegionDecoderInterface* CreateBitmapRegionDecoder( |
| 33 SkData* data, Strategy strategy); | 33 SkData* data, Strategy strategy); |
| 34 | 34 |
| 35 /* | 35 /* |
| 36 * Decode a scaled region of the encoded image stream | 36 * Decode a scaled region of the encoded image stream |
| 37 * | 37 * |
| 38 * @param start_x X-coordinate of upper-left corner of region. | 38 * @param bitmap Container for decoded pixels. It is assumed that
the pixels |
| 39 * This coordinate is unscaled, relative to the original d
imensions. | 39 * are initially unallocated and will be allocated by
this function. |
| 40 * @param start_y Y-coordinate of upper-left corner of region. | 40 * @param allocator Allocator for the pixels. If this is NULL, the de
fault |
| 41 * This coordinate is unscaled, relative to the original d
imensions. | 41 * allocator (HeapAllocator) will be used. |
| 42 * @param width Width of the region to decode. | 42 * @param desiredSubset Subset of the original image to decode. |
| 43 * This distance is unscaled, relative to the original dim
ensions. | 43 * @param sampleSize An integer downscaling factor for the decode. |
| 44 * @param height Height of the region to decode. | 44 * @param colorType Preferred output colorType. |
| 45 * This distance is unscaled, relative to the original dim
ensions. | 45 * New implementations should return NULL if they do
not support |
| 46 * @param sampleSize An integer downscaling factor for the decode. | 46 * decoding to this color type. |
| 47 * @param colorType Preferred output colorType. | 47 * The old kOriginal_Strategy will decode to a defaul
t color type |
| 48 * New implementations should return NULL if they do not s
upport | 48 * if this color type is unsupported. |
| 49 * decoding to this color type. | 49 * @param requireUnpremul If the image is not opaque, we will use this to de
termine the |
| 50 * The old kOriginal_Strategy will decode to a default col
or type | 50 * alpha type to use. |
| 51 * if this color type is unsupported. | 51 * |
| 52 * @return Pointer to a bitmap of the decoded region on success, N
ULL on | |
| 53 * failure. | |
| 54 */ | 52 */ |
| 55 virtual SkBitmap* decodeRegion(int start_x, int start_y, int width, | 53 virtual bool decodeRegion(SkBitmap* bitmap, SkBitmap::Allocator* allocator, |
| 56 int height, int sampleSize, | 54 const SkIRect& desiredSubset, int sampleSize, |
| 57 SkColorType colorType) = 0; | 55 SkColorType colorType, bool requireUnpremul) = 0; |
| 58 /* | 56 /* |
| 59 * @param Requested destination color type | 57 * @param Requested destination color type |
| 60 * @return true if we support the requested color type and false otherwise | 58 * @return true if we support the requested color type and false otherwise |
| 61 */ | 59 */ |
| 62 virtual bool conversionSupported(SkColorType colorType) = 0; | 60 virtual bool conversionSupported(SkColorType colorType) = 0; |
| 63 | 61 |
| 64 int width() const { return fWidth; } | 62 int width() const { return fWidth; } |
| 65 int height() const { return fHeight; } | 63 int height() const { return fHeight; } |
| 66 | 64 |
| 67 virtual ~SkBitmapRegionDecoderInterface() {} | 65 virtual ~SkBitmapRegionDecoderInterface() {} |
| 68 | 66 |
| 69 protected: | 67 protected: |
| 70 | 68 |
| 71 SkBitmapRegionDecoderInterface(int width, int height) | 69 SkBitmapRegionDecoderInterface(int width, int height) |
| 72 : fWidth(width) | 70 : fWidth(width) |
| 73 , fHeight(height) | 71 , fHeight(height) |
| 74 {} | 72 {} |
| 75 | 73 |
| 76 private: | 74 private: |
| 77 const int fWidth; | 75 const int fWidth; |
| 78 const int fHeight; | 76 const int fHeight; |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 #endif | 79 #endif |
| OLD | NEW |