| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkImageGenerator_DEFINED | 8 #ifndef SkImageGenerator_DEFINED |
| 9 #define SkImageGenerator_DEFINED | 9 #define SkImageGenerator_DEFINED |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 * of this data. | 60 * of this data. |
| 61 * | 61 * |
| 62 * If non-NULL is returned, the caller is responsible for calling | 62 * If non-NULL is returned, the caller is responsible for calling |
| 63 * unref() on the data when it is finished. | 63 * unref() on the data when it is finished. |
| 64 */ | 64 */ |
| 65 SkData* refEncodedData() { return this->onRefEncodedData(); } | 65 SkData* refEncodedData() { return this->onRefEncodedData(); } |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * Return the ImageInfo associated with this generator. | 68 * Return the ImageInfo associated with this generator. |
| 69 */ | 69 */ |
| 70 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO | |
| 71 SkImageInfo getInfo(); | |
| 72 bool getInfo(SkImageInfo* info) { | |
| 73 if (info) { | |
| 74 *info = this->getInfo(); | |
| 75 } | |
| 76 return true; | |
| 77 } | |
| 78 #else | |
| 79 const SkImageInfo& getInfo() const { return fInfo; } | 70 const SkImageInfo& getInfo() const { return fInfo; } |
| 80 #endif | |
| 81 | 71 |
| 82 /** | 72 /** |
| 83 * Used to describe the result of a call to getPixels(). | 73 * Used to describe the result of a call to getPixels(). |
| 84 * | 74 * |
| 85 * Result is the union of possible results from subclasses. | 75 * Result is the union of possible results from subclasses. |
| 86 */ | 76 */ |
| 87 enum Result { | 77 enum Result { |
| 88 /** | 78 /** |
| 89 * General return value for success. | 79 * General return value for success. |
| 90 */ | 80 */ |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 SkYUVColorSpace* colorSpace); | 193 SkYUVColorSpace* colorSpace); |
| 204 | 194 |
| 205 /** | 195 /** |
| 206 * If the default image decoder system can interpret the specified (encoded
) data, then | 196 * If the default image decoder system can interpret the specified (encoded
) data, then |
| 207 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way | 197 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way |
| 208 * the caller is still responsible for managing their ownership of the data
. | 198 * the caller is still responsible for managing their ownership of the data
. |
| 209 */ | 199 */ |
| 210 static SkImageGenerator* NewFromData(SkData*); | 200 static SkImageGenerator* NewFromData(SkData*); |
| 211 | 201 |
| 212 protected: | 202 protected: |
| 213 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO | |
| 214 SkImageGenerator() : fInfo(SkImageInfo::MakeUnknown(0, 0) ) {} | |
| 215 virtual bool onGetInfo(SkImageInfo* info); | |
| 216 #endif | |
| 217 SkImageGenerator(const SkImageInfo& info) : fInfo(info) {} | 203 SkImageGenerator(const SkImageInfo& info) : fInfo(info) {} |
| 218 | 204 |
| 219 virtual SkData* onRefEncodedData(); | 205 virtual SkData* onRefEncodedData(); |
| 220 | 206 |
| 221 #ifdef SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS | 207 #ifdef SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS |
| 222 virtual Result onGetPixels(const SkImageInfo& info, | 208 virtual Result onGetPixels(const SkImageInfo& info, |
| 223 void* pixels, size_t rowBytes, | 209 void* pixels, size_t rowBytes, |
| 224 SkPMColor ctable[], int* ctableCount); | 210 SkPMColor ctable[], int* ctableCount); |
| 225 #endif | 211 #endif |
| 226 virtual Result onGetPixels(const SkImageInfo& info, | 212 virtual Result onGetPixels(const SkImageInfo& info, |
| 227 void* pixels, size_t rowBytes, const Options&, | 213 void* pixels, size_t rowBytes, const Options&, |
| 228 SkPMColor ctable[], int* ctableCount); | 214 SkPMColor ctable[], int* ctableCount); |
| 229 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); | 215 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); |
| 230 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], | 216 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], |
| 231 SkYUVColorSpace* colorSpace); | 217 SkYUVColorSpace* colorSpace); |
| 232 | 218 |
| 233 private: | 219 private: |
| 234 const SkImageInfo fInfo; | 220 const SkImageInfo fInfo; |
| 235 }; | 221 }; |
| 236 | 222 |
| 237 #endif // SkImageGenerator_DEFINED | 223 #endif // SkImageGenerator_DEFINED |
| OLD | NEW |