Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: src/codec/SkPngCodec.cpp

Issue 2401133002: Fix an assert statement in SkPngCodec (Closed)
Patch Set: Set fFirstRow and fLastRow Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/CodecTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | tests/CodecTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698