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 #include "SkCodec_libpng.h" | 8 #include "SkCodec_libpng.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // FIXME: Here is where we should likely insert some of the modifications | 413 // FIXME: Here is where we should likely insert some of the modifications |
414 // made in the factory. | 414 // made in the factory. |
415 png_read_update_info(fPng_ptr, fInfo_ptr); | 415 png_read_update_info(fPng_ptr, fInfo_ptr); |
416 | 416 |
417 return kSuccess; | 417 return kSuccess; |
418 } | 418 } |
419 | 419 |
420 SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
dst, | 420 SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
dst, |
421 size_t rowBytes, const Options& options, | 421 size_t rowBytes, const Options& options, |
422 SkPMColor ctable[], int* ctableCount) { | 422 SkPMColor ctable[], int* ctableCount) { |
423 if (!this->rewindIfNeeded()) { | 423 SkCodec::RewindState rewindState = this->rewindIfNeeded(); |
| 424 if (rewindState == kCouldNotRewind_RewindState) { |
| 425 return kCouldNotRewind; |
| 426 } else if (rewindState == kRewound_RewindState) { |
| 427 // TODO(scroggo): handle rewinds |
424 return kCouldNotRewind; | 428 return kCouldNotRewind; |
425 } | 429 } |
426 if (requestedInfo.dimensions() != this->getInfo().dimensions()) { | 430 if (requestedInfo.dimensions() != this->getInfo().dimensions()) { |
427 return kInvalidScale; | 431 return kInvalidScale; |
428 } | 432 } |
429 if (!conversion_possible(requestedInfo, this->getInfo())) { | 433 if (!conversion_possible(requestedInfo, this->getInfo())) { |
430 return kInvalidConversion; | 434 return kInvalidConversion; |
431 } | 435 } |
432 | 436 |
433 const Result result = this->initializeSwizzler(requestedInfo, dst, rowBytes, | 437 const Result result = this->initializeSwizzler(requestedInfo, dst, rowBytes, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 576 |
573 SkASSERT(fNumberPasses != INVALID_NUMBER_PASSES); | 577 SkASSERT(fNumberPasses != INVALID_NUMBER_PASSES); |
574 if (fNumberPasses > 1) { | 578 if (fNumberPasses > 1) { |
575 // We cannot efficiently do scanline decoding. | 579 // We cannot efficiently do scanline decoding. |
576 return NULL; | 580 return NULL; |
577 } | 581 } |
578 | 582 |
579 return SkNEW_ARGS(SkPngScanlineDecoder, (dstInfo, this)); | 583 return SkNEW_ARGS(SkPngScanlineDecoder, (dstInfo, this)); |
580 } | 584 } |
581 | 585 |
OLD | NEW |