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 #ifndef SkScaledCodec_DEFINED | 7 #ifndef SkScaledCodec_DEFINED |
8 #define SkScaledCodec_DEFINED | 8 #define SkScaledCodec_DEFINED |
9 | 9 |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 int* sampleSizeX, int* sampleSizeY); | 26 int* sampleSizeX, int* sampleSizeY); |
27 | 27 |
28 protected: | 28 protected: |
29 bool onRewind() override; | 29 bool onRewind() override; |
30 | 30 |
31 /** | 31 /** |
32 * Recommend a set of destination dimensions given a requested scale | 32 * Recommend a set of destination dimensions given a requested scale |
33 */ | 33 */ |
34 SkISize onGetScaledDimensions(float desiredScale) const override; | 34 SkISize onGetScaledDimensions(float desiredScale) const override; |
35 bool onDimensionsSupported(const SkISize&) override; | 35 bool onDimensionsSupported(const SkISize&) override; |
| 36 bool onSubsetSupported(const SkIRect&, bool) override { return true; } |
| 37 bool onScaledSubsetSupported(const Options&, bool) override; |
| 38 bool onGetScaledSubsetDimensions(float desiredScale, const Options& options)
const override; |
36 | 39 |
37 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*, int*) | 40 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*, int*) |
38 override; | 41 override; |
39 SkEncodedFormat onGetEncodedFormat() const override { | 42 SkEncodedFormat onGetEncodedFormat() const override { |
40 return fCodec->getEncodedFormat(); | 43 return fCodec->getEncodedFormat(); |
41 } | 44 } |
42 | 45 |
43 bool onReallyHasAlpha() const override { | 46 bool onReallyHasAlpha() const override { |
44 return fCodec->reallyHasAlpha(); | 47 return fCodec->reallyHasAlpha(); |
45 } | 48 } |
46 | 49 |
47 uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType) const
override; | 50 uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType) const
override; |
48 | 51 |
49 SkScanlineOrder onGetScanlineOrder() const override; | 52 SkScanlineOrder onGetScanlineOrder() const override; |
50 | 53 |
51 private: | 54 private: |
52 | 55 |
| 56 /** |
| 57 * Perform the decode with scaling handled by the native codec. |
| 58 * Assumes startScanlineDecoder() has already been called. |
| 59 * |
| 60 * @param scaledInfo Destination image info, containing dimensions tha
t |
| 61 * represent the full size image, scaled to the desi
red |
| 62 * scale, before any subset has been applied. |
| 63 * @param dst Pointer to destination pixel memory. |
| 64 * @param rowBytes Stride length in destination memory. |
| 65 * @param scaledSubsetRect Desired subset in terms of the scaled dimensions. |
| 66 * @param zeroInit Indicates if destination memory is zero initializ
ed. |
| 67 * @param rowsDecoded Out parameter to specify how many rows were |
| 68 * successfully decoded on an incomplete decode. |
| 69 */ |
| 70 Result nativeDecode(const SkImageInfo& scaledInfo, void* dst, size_t rowByte
s, |
| 71 const SkIRect& scaledSubsetRect, ZeroInitialized zeroInit, int* rows
Decoded); |
| 72 |
| 73 /** |
| 74 * Perform the decode with sampling as the scaling method. |
| 75 * Assumes startScanlineDecoder() has already been called. |
| 76 * |
| 77 * @param scaledSubsetInfo Destination image info, containing dimensions tha
t |
| 78 * represent the scaled and subsetted result. |
| 79 * @param dst Pointer to destination pixel memory. |
| 80 * @param rowBytes Stride length in destination memory. |
| 81 * @param subsetRect Desired subset in terms of the original dimension
s. |
| 82 * @param sampleX Sample factor in the x-dimension. |
| 83 * @param sampleY Sample factor in the y-dimension. |
| 84 * @param zeroInit Indicates if destination memory is zero initializ
ed. |
| 85 * @param rowsDecoded Out parameter to specify how many rows were |
| 86 * successfully decoded on an incomplete decode. |
| 87 */ |
| 88 Result sampledDecode(const SkImageInfo& scaledSubsetInfo, void* dst, size_t
rowBytes, |
| 89 const SkIRect& subsetRect, int sampleX, int sampleY, ZeroInitialized
zeroInit, |
| 90 int* rowsDecoded); |
| 91 |
53 SkAutoTDelete<SkCodec> fCodec; | 92 SkAutoTDelete<SkCodec> fCodec; |
54 | 93 |
55 explicit SkScaledCodec(SkCodec*); | 94 explicit SkScaledCodec(SkCodec*); |
56 | 95 |
57 typedef SkCodec INHERITED; | 96 typedef SkCodec INHERITED; |
58 }; | 97 }; |
59 #endif // SkScaledCodec_DEFINED | 98 #endif // SkScaledCodec_DEFINED |
OLD | NEW |