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 208 matching lines...) Loading... |
219 const AndroidOptions* options); | 219 const AndroidOptions* options); |
220 | 220 |
221 /** | 221 /** |
222 * Simplified version of getAndroidPixels() where we supply the default And
roidOptions. | 222 * Simplified version of getAndroidPixels() where we supply the default And
roidOptions. |
223 * | 223 * |
224 * This will return an error if the info is kIndex_8_SkColorType and also w
ill not perform | 224 * This will return an error if the info is kIndex_8_SkColorType and also w
ill not perform |
225 * any scaling or subsetting. | 225 * any scaling or subsetting. |
226 */ | 226 */ |
227 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size
_t rowBytes); | 227 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size
_t rowBytes); |
228 | 228 |
229 /** | |
230 * Some images may initially report that they have alpha due to the format | |
231 * of the encoded data, but then never use any colors which have alpha | |
232 * less than 100%. This function can be called *after* decoding to | |
233 * determine if such an image truly had alpha. Calling it before decoding | |
234 * is undefined. | |
235 * FIXME: see skbug.com/3582. | |
236 */ | |
237 bool reallyHasAlpha() const { | |
238 return fCodec->reallyHasAlpha(); | |
239 } | |
240 | |
241 protected: | 229 protected: |
242 | 230 |
243 SkAndroidCodec(SkCodec*); | 231 SkAndroidCodec(SkCodec*); |
244 | 232 |
245 SkCodec* codec() const { return fCodec.get(); } | 233 SkCodec* codec() const { return fCodec.get(); } |
246 | 234 |
247 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; | 235 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; |
248 | 236 |
249 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; | 237 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; |
250 | 238 |
251 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi
xels, | 239 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi
xels, |
252 size_t rowBytes, const AndroidOptions& options) = 0; | 240 size_t rowBytes, const AndroidOptions& options) = 0; |
253 | 241 |
254 private: | 242 private: |
255 | 243 |
256 // This will always be a reference to the info that is contained by the | 244 // This will always be a reference to the info that is contained by the |
257 // embedded SkCodec. | 245 // embedded SkCodec. |
258 const SkImageInfo& fInfo; | 246 const SkImageInfo& fInfo; |
259 | 247 |
260 SkAutoTDelete<SkCodec> fCodec; | 248 SkAutoTDelete<SkCodec> fCodec; |
261 }; | 249 }; |
262 #endif // SkAndroidCodec_DEFINED | 250 #endif // SkAndroidCodec_DEFINED |
OLD | NEW |