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 SkAndroidCodec_DEFINED | 8 #ifndef SkAndroidCodec_DEFINED |
9 #define SkAndroidCodec_DEFINED | 9 #define SkAndroidCodec_DEFINED |
10 | 10 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 * The AndroidOptions object is also used to specify any requested scaling
or subsetting | 185 * The AndroidOptions object is also used to specify any requested scaling
or subsetting |
186 * using options->fSampleSize and options->fSubset. | 186 * using options->fSampleSize and options->fSubset. |
187 * | 187 * |
188 * @return Result kSuccess, or another value explaining the type of failure
. | 188 * @return Result kSuccess, or another value explaining the type of failure
. |
189 */ | 189 */ |
190 // FIXME: It's a bit redundant to name this getAndroidPixels() when this cla
ss is already | 190 // FIXME: It's a bit redundant to name this getAndroidPixels() when this cla
ss is already |
191 // called SkAndroidCodec. On the other hand, it's may be a bit confu
sing to call | 191 // called SkAndroidCodec. On the other hand, it's may be a bit confu
sing to call |
192 // this getPixels() when it is a slightly different API than SkCodec'
s getPixels(). | 192 // this getPixels() when it is a slightly different API than SkCodec'
s getPixels(). |
193 // Maybe this should be decode() or decodeSubset()? | 193 // Maybe this should be decode() or decodeSubset()? |
194 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size
_t rowBytes, | 194 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size
_t rowBytes, |
195 AndroidOptions* options); | 195 const AndroidOptions* options); |
196 | 196 |
197 /** | 197 /** |
198 * Simplified version of getAndroidPixels() where we supply the default And
roidOptions. | 198 * Simplified version of getAndroidPixels() where we supply the default And
roidOptions. |
199 * | 199 * |
200 * This will return an error if the info is kIndex_8_SkColorType and also w
ill not perform | 200 * This will return an error if the info is kIndex_8_SkColorType and also w
ill not perform |
201 * any scaling or subsetting. | 201 * any scaling or subsetting. |
202 */ | 202 */ |
203 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size
_t rowBytes); | 203 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size
_t rowBytes); |
204 | 204 |
205 protected: | 205 protected: |
206 | 206 |
207 SkAndroidCodec(const SkImageInfo&); | 207 SkAndroidCodec(const SkImageInfo&); |
208 | 208 |
209 virtual SkEncodedFormat onGetEncodedFormat() const = 0; | 209 virtual SkEncodedFormat onGetEncodedFormat() const = 0; |
210 | 210 |
211 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; | 211 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; |
212 | 212 |
213 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; | 213 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; |
214 | 214 |
215 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi
xels, | 215 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi
xels, |
216 size_t rowBytes, AndroidOptions& options) = 0; | 216 size_t rowBytes, const AndroidOptions& options) = 0; |
217 | 217 |
218 private: | 218 private: |
219 | 219 |
220 // This will always be a reference to the info that is contained by the | 220 // This will always be a reference to the info that is contained by the |
221 // embedded SkCodec. | 221 // embedded SkCodec. |
222 const SkImageInfo& fInfo; | 222 const SkImageInfo& fInfo; |
223 }; | 223 }; |
224 #endif // SkAndroidCodec_DEFINED | 224 #endif // SkAndroidCodec_DEFINED |
OLD | NEW |