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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 const AndroidOptions* options); | 201 const AndroidOptions* options); |
202 | 202 |
203 /** | 203 /** |
204 * Simplified version of getAndroidPixels() where we supply the default And roidOptions. | 204 * Simplified version of getAndroidPixels() where we supply the default And roidOptions. |
205 * | 205 * |
206 * This will return an error if the info is kIndex_8_SkColorType and also w ill not perform | 206 * This will return an error if the info is kIndex_8_SkColorType and also w ill not perform |
207 * any scaling or subsetting. | 207 * any scaling or subsetting. |
208 */ | 208 */ |
209 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size _t rowBytes); | 209 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size _t rowBytes); |
210 | 210 |
211 /** | |
212 * Some images may initially report that they have alpha due to the format | |
213 * of the encoded data, but then never use any colors which have alpha | |
214 * less than 100%. This function can be called *after* decoding to | |
215 * determine if such an image truly had alpha. Calling it before decoding | |
216 * is undefined. | |
217 * FIXME: see skbug.com/3582. | |
218 */ | |
219 bool reallyHasAlpha() const { | |
scroggo
2015/12/10 17:02:32
With some changes, this doesn't even need to be vi
msarett
2015/12/10 17:41:18
I went halfway there. Can we save the actualCodec
scroggo
2015/12/10 18:29:42
fine with me
| |
220 return this->onReallyHasAlpha(); | |
221 } | |
222 | |
211 protected: | 223 protected: |
212 | 224 |
213 SkAndroidCodec(const SkImageInfo&); | 225 SkAndroidCodec(const SkImageInfo&); |
214 | 226 |
215 virtual SkEncodedFormat onGetEncodedFormat() const = 0; | 227 virtual SkEncodedFormat onGetEncodedFormat() const = 0; |
216 | 228 |
217 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; | 229 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; |
218 | 230 |
219 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; | 231 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; |
220 | 232 |
221 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi xels, | 233 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi xels, |
222 size_t rowBytes, const AndroidOptions& options) = 0; | 234 size_t rowBytes, const AndroidOptions& options) = 0; |
223 | 235 |
236 virtual bool onReallyHasAlpha() const = 0; | |
237 | |
224 private: | 238 private: |
225 | 239 |
226 // This will always be a reference to the info that is contained by the | 240 // This will always be a reference to the info that is contained by the |
227 // embedded SkCodec. | 241 // embedded SkCodec. |
228 const SkImageInfo& fInfo; | 242 const SkImageInfo& fInfo; |
229 }; | 243 }; |
230 #endif // SkAndroidCodec_DEFINED | 244 #endif // SkAndroidCodec_DEFINED |
OLD | NEW |