| 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 SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED |
| 9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED |
| 10 | 10 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, con
st Options*, | 271 Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, con
st Options*, |
| 272 SkPMColor ctable[], int* ctableCount); | 272 SkPMColor ctable[], int* ctableCount); |
| 273 | 273 |
| 274 /** | 274 /** |
| 275 * Simplified version of getPixels() that asserts that info is NOT kIndex8_
SkColorType and | 275 * Simplified version of getPixels() that asserts that info is NOT kIndex8_
SkColorType and |
| 276 * uses the default Options. | 276 * uses the default Options. |
| 277 */ | 277 */ |
| 278 Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes); | 278 Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes); |
| 279 | 279 |
| 280 /** | 280 /** |
| 281 * Some images may initially report that they have alpha due to the format | |
| 282 * of the encoded data, but then never use any colors which have alpha | |
| 283 * less than 100%. This function can be called *after* decoding to | |
| 284 * determine if such an image truly had alpha. Calling it before decoding | |
| 285 * is undefined. | |
| 286 * FIXME: see skbug.com/3582. | |
| 287 */ | |
| 288 bool reallyHasAlpha() const { | |
| 289 return kOpaque_SkAlphaType != this->getInfo().alphaType() && this->onRea
llyHasAlpha(); | |
| 290 } | |
| 291 | |
| 292 /** | |
| 293 * The remaining functions revolve around decoding scanlines. | 281 * The remaining functions revolve around decoding scanlines. |
| 294 */ | 282 */ |
| 295 | 283 |
| 296 /** | 284 /** |
| 297 * Prepare for a scanline decode with the specified options. | 285 * Prepare for a scanline decode with the specified options. |
| 298 * | 286 * |
| 299 * After this call, this class will be ready to decode the first scanline. | 287 * After this call, this class will be ready to decode the first scanline. |
| 300 * | 288 * |
| 301 * This must be called in order to call getScanlines or skipScanlines. | 289 * This must be called in order to call getScanlines or skipScanlines. |
| 302 * | 290 * |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 void* pixels, size_t rowBytes, const Options&, | 468 void* pixels, size_t rowBytes, const Options&, |
| 481 SkPMColor ctable[], int* ctableCount, | 469 SkPMColor ctable[], int* ctableCount, |
| 482 int* rowsDecoded) = 0; | 470 int* rowsDecoded) = 0; |
| 483 | 471 |
| 484 virtual bool onGetValidSubset(SkIRect* /* desiredSubset */) const { | 472 virtual bool onGetValidSubset(SkIRect* /* desiredSubset */) const { |
| 485 // By default, subsets are not supported. | 473 // By default, subsets are not supported. |
| 486 return false; | 474 return false; |
| 487 } | 475 } |
| 488 | 476 |
| 489 /** | 477 /** |
| 490 * This is only called if the image indicates that it is not opaque. | |
| 491 * By default we will assume that the image is in fact non-opaque. | |
| 492 * Subclasses may override this function if they intend to verify | |
| 493 * that the image actually has alpha. | |
| 494 */ | |
| 495 virtual bool onReallyHasAlpha() const { | |
| 496 return true; | |
| 497 } | |
| 498 | |
| 499 /** | |
| 500 * If the stream was previously read, attempt to rewind. | 478 * If the stream was previously read, attempt to rewind. |
| 501 * | 479 * |
| 502 * If the stream needed to be rewound, call onRewind. | 480 * If the stream needed to be rewound, call onRewind. |
| 503 * @returns true if the codec is at the right position and can be used. | 481 * @returns true if the codec is at the right position and can be used. |
| 504 * false if there was a failure to rewind. | 482 * false if there was a failure to rewind. |
| 505 * | 483 * |
| 506 * This is called by getPixels() and start(). Subclasses may call if they | 484 * This is called by getPixels() and start(). Subclasses may call if they |
| 507 * need to rewind at another time. | 485 * need to rewind at another time. |
| 508 */ | 486 */ |
| 509 bool SK_WARN_UNUSED_RESULT rewindIfNeeded(); | 487 bool SK_WARN_UNUSED_RESULT rewindIfNeeded(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 * not affect ownership. | 627 * not affect ownership. |
| 650 * | 628 * |
| 651 * Only valid during scanline decoding. | 629 * Only valid during scanline decoding. |
| 652 */ | 630 */ |
| 653 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} | 631 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} |
| 654 | 632 |
| 655 friend class SkSampledCodec; | 633 friend class SkSampledCodec; |
| 656 friend class SkIcoCodec; | 634 friend class SkIcoCodec; |
| 657 }; | 635 }; |
| 658 #endif // SkCodec_DEFINED | 636 #endif // SkCodec_DEFINED |
| OLD | NEW |