| 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 const int height = this->getInfo().height(); | 554 const int height = this->getInfo().height(); |
| 555 png_progressive_info_ptr callback = nullptr; | 555 png_progressive_info_ptr callback = nullptr; |
| 556 #ifdef SK_GOOGLE3_PNG_HACK | 556 #ifdef SK_GOOGLE3_PNG_HACK |
| 557 callback = RereadInfoCallback; | 557 callback = RereadInfoCallback; |
| 558 #endif | 558 #endif |
| 559 png_set_progressive_read_fn(this->png_ptr(), this, callback, AllRowsCall
back, nullptr); | 559 png_set_progressive_read_fn(this->png_ptr(), this, callback, AllRowsCall
back, nullptr); |
| 560 fDst = dst; | 560 fDst = dst; |
| 561 fRowBytes = rowBytes; | 561 fRowBytes = rowBytes; |
| 562 | 562 |
| 563 fLinesDecoded = 0; | 563 fLinesDecoded = 0; |
| 564 fFirstRow = 0; |
| 565 fLastRow = height - 1; |
| 564 | 566 |
| 565 this->processData(); | 567 this->processData(); |
| 566 | 568 |
| 567 if (fLinesDecoded == height) { | 569 if (fLinesDecoded == height) { |
| 568 return SkCodec::kSuccess; | 570 return SkCodec::kSuccess; |
| 569 } | 571 } |
| 570 | 572 |
| 571 if (rowsDecoded) { | 573 if (rowsDecoded) { |
| 572 *rowsDecoded = fLinesDecoded; | 574 *rowsDecoded = fLinesDecoded; |
| 573 } | 575 } |
| 574 | 576 |
| 575 return SkCodec::kIncompleteInput; | 577 return SkCodec::kIncompleteInput; |
| 576 } | 578 } |
| 577 | 579 |
| 578 void allRowsCallback(png_bytep row, int rowNum) { | 580 void allRowsCallback(png_bytep row, int rowNum) { |
| 579 SkASSERT(rowNum - fFirstRow == fLinesDecoded); | 581 SkASSERT(rowNum == fLinesDecoded); |
| 580 fLinesDecoded++; | 582 fLinesDecoded++; |
| 581 this->applyXformRow(fDst, row); | 583 this->applyXformRow(fDst, row); |
| 582 fDst = SkTAddOffset<void>(fDst, fRowBytes); | 584 fDst = SkTAddOffset<void>(fDst, fRowBytes); |
| 583 } | 585 } |
| 584 | 586 |
| 585 void setRange(int firstRow, int lastRow, void* dst, size_t rowBytes) overrid
e { | 587 void setRange(int firstRow, int lastRow, void* dst, size_t rowBytes) overrid
e { |
| 586 png_progressive_info_ptr callback = nullptr; | 588 png_progressive_info_ptr callback = nullptr; |
| 587 #ifdef SK_GOOGLE3_PNG_HACK | 589 #ifdef SK_GOOGLE3_PNG_HACK |
| 588 callback = RereadInfoCallback; | 590 callback = RereadInfoCallback; |
| 589 #endif | 591 #endif |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 SkCodec* outCodec = nullptr; | 1301 SkCodec* outCodec = nullptr; |
| 1300 if (read_header(streamDeleter.get(), chunkReader, &outCodec, nullptr, nullpt
r)) { | 1302 if (read_header(streamDeleter.get(), chunkReader, &outCodec, nullptr, nullpt
r)) { |
| 1301 // Codec has taken ownership of the stream. | 1303 // Codec has taken ownership of the stream. |
| 1302 SkASSERT(outCodec); | 1304 SkASSERT(outCodec); |
| 1303 streamDeleter.release(); | 1305 streamDeleter.release(); |
| 1304 return outCodec; | 1306 return outCodec; |
| 1305 } | 1307 } |
| 1306 | 1308 |
| 1307 return nullptr; | 1309 return nullptr; |
| 1308 } | 1310 } |
| OLD | NEW |