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 SkJpegCodec_DEFINED | 8 #ifndef SkJpegCodec_DEFINED |
9 #define SkJpegCodec_DEFINED | 9 #define SkJpegCodec_DEFINED |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 */ | 51 */ |
52 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes
, const Options&, | 52 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes
, const Options&, |
53 SkPMColor*, int*) override; | 53 SkPMColor*, int*) override; |
54 | 54 |
55 SkEncodedFormat onGetEncodedFormat() const override { | 55 SkEncodedFormat onGetEncodedFormat() const override { |
56 return kJPEG_SkEncodedFormat; | 56 return kJPEG_SkEncodedFormat; |
57 } | 57 } |
58 | 58 |
59 bool onRewind() override; | 59 bool onRewind() override; |
60 | 60 |
| 61 bool onDimensionsSupported(const SkISize&) override; |
| 62 |
61 private: | 63 private: |
62 | 64 |
63 /* | 65 /* |
64 * Read enough of the stream to initialize the SkJpegCodec. | 66 * Read enough of the stream to initialize the SkJpegCodec. |
65 * Returns a bool representing success or failure. | 67 * Returns a bool representing success or failure. |
66 * | 68 * |
67 * @param codecOut | 69 * @param codecOut |
68 * If this returns true, and codecOut was not nullptr, | 70 * If this returns true, and codecOut was not nullptr, |
69 * codecOut will be set to a new SkJpegCodec. | 71 * codecOut will be set to a new SkJpegCodec. |
70 * | 72 * |
(...skipping 24 matching lines...) Expand all Loading... |
95 | 97 |
96 ~SkJpegCodec() override; | 98 ~SkJpegCodec() override; |
97 | 99 |
98 /* | 100 /* |
99 * Checks if the conversion between the input image and the requested output | 101 * Checks if the conversion between the input image and the requested output |
100 * image has been implemented | 102 * image has been implemented |
101 * Sets the output color space | 103 * Sets the output color space |
102 */ | 104 */ |
103 bool setOutputColorSpace(const SkImageInfo& dst); | 105 bool setOutputColorSpace(const SkImageInfo& dst); |
104 | 106 |
105 /* | |
106 * Checks if we can natively scale to the requested dimensions and natively
scales the | |
107 * dimensions if possible | |
108 */ | |
109 bool nativelyScaleToDimensions(uint32_t width, uint32_t height); | |
110 | |
111 // scanline decoding | 107 // scanline decoding |
112 Result initializeSwizzler(const SkImageInfo&, const SkCodec::Options&); | 108 SkSampler* getSampler() override; |
113 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opti
ons, | 109 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opti
ons, |
114 SkPMColor ctable[], int* ctableCount) override; | 110 SkPMColor ctable[], int* ctableCount) override; |
115 Result onGetScanlines(void* dst, int count, size_t rowBytes) override; | 111 Result onGetScanlines(void* dst, int count, size_t rowBytes) override; |
116 Result onSkipScanlines(int count) override; | 112 Result onSkipScanlines(int count) override; |
117 | 113 |
118 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; | 114 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; |
119 // We will save the state of the decompress struct after reading the header. | 115 // We will save the state of the decompress struct after reading the header. |
120 // This allows us to safely call onGetScaledDimensions() at any time. | 116 // This allows us to safely call onGetScaledDimensions() at any time. |
121 const int fReadyState; | 117 const int fReadyState; |
122 | 118 |
123 // scanline decoding | 119 // scanline decoding |
124 SkAutoMalloc fStorage; // Only used if sampling is needed | 120 SkAutoMalloc fStorage; // Only used if sampling is needed |
125 uint8_t* fSrcRow; // Only used if sampling is needed | 121 uint8_t* fSrcRow; // Only used if sampling is needed |
126 SkAutoTDelete<SkSwizzler> fSwizzler; | 122 SkAutoTDelete<SkSwizzler> fSwizzler; |
127 | 123 |
128 typedef SkCodec INHERITED; | 124 typedef SkCodec INHERITED; |
129 }; | 125 }; |
130 | 126 |
131 #endif | 127 #endif |
OLD | NEW |