Chromium Code Reviews| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 * @return Result kSuccess, or another value explaining the type of failure . | 212 * @return Result kSuccess, or another value explaining the type of failure . |
| 213 */ | 213 */ |
| 214 // FIXME: It's a bit redundant to name this getAndroidPixels() when this cla ss is already | 214 // FIXME: It's a bit redundant to name this getAndroidPixels() when this cla ss is already |
| 215 // called SkAndroidCodec. On the other hand, it's may be a bit confu sing to call | 215 // called SkAndroidCodec. On the other hand, it's may be a bit confu sing to call |
| 216 // this getPixels() when it is a slightly different API than SkCodec' s getPixels(). | 216 // this getPixels() when it is a slightly different API than SkCodec' s getPixels(). |
| 217 // Maybe this should be decode() or decodeSubset()? | 217 // Maybe this should be decode() or decodeSubset()? |
| 218 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size _t rowBytes, | 218 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size _t rowBytes, |
| 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. |
|
reed1
2016/01/29 17:05:33
What are the "default" options?
What if I pass nul
scroggo
2016/01/29 19:50:33
Updated comments.
| |
| 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); |
|
msarett
2016/01/29 15:16:39
Thoughts on also naming this getPixels() (not in t
scroggo
2016/01/29 19:50:33
I'm in favor. As I understood it, you were concern
| |
| 228 | 228 |
| 229 SkCodec::Result getPixels(const SkImageInfo& info, void* pixels, size_t rowB ytes) { | |
| 230 return this->getAndroidPixels(info, pixels, rowBytes); | |
| 231 } | |
| 232 | |
| 229 protected: | 233 protected: |
| 230 | 234 |
| 231 SkAndroidCodec(SkCodec*); | 235 SkAndroidCodec(SkCodec*); |
| 232 | 236 |
| 233 SkCodec* codec() const { return fCodec.get(); } | 237 SkCodec* codec() const { return fCodec.get(); } |
| 234 | 238 |
| 235 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; | 239 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; |
| 236 | 240 |
| 237 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; | 241 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; |
| 238 | 242 |
| 239 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi xels, | 243 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi xels, |
| 240 size_t rowBytes, const AndroidOptions& options) = 0; | 244 size_t rowBytes, const AndroidOptions& options) = 0; |
| 241 | 245 |
| 242 private: | 246 private: |
| 243 | 247 |
| 244 // This will always be a reference to the info that is contained by the | 248 // This will always be a reference to the info that is contained by the |
| 245 // embedded SkCodec. | 249 // embedded SkCodec. |
| 246 const SkImageInfo& fInfo; | 250 const SkImageInfo& fInfo; |
| 247 | 251 |
| 248 SkAutoTDelete<SkCodec> fCodec; | 252 SkAutoTDelete<SkCodec> fCodec; |
| 249 }; | 253 }; |
| 250 #endif // SkAndroidCodec_DEFINED | 254 #endif // SkAndroidCodec_DEFINED |
| OLD | NEW |