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