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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
4 * 4 *
5 * Portions are Copyright (C) 2001 mozilla.org 5 * Portions are Copyright (C) 2001 mozilla.org
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Stuart Parmenter <stuart@mozilla.com> 8 * Stuart Parmenter <stuart@mozilla.com>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 417 }
418 418
419 void PNGImageDecoder::complete() 419 void PNGImageDecoder::complete()
420 { 420 {
421 if (m_frameBufferCache.isEmpty()) 421 if (m_frameBufferCache.isEmpty())
422 return; 422 return;
423 423
424 m_frameBufferCache[0].setStatus(ImageFrame::FrameComplete); 424 m_frameBufferCache[0].setStatus(ImageFrame::FrameComplete);
425 } 425 }
426 426
427 inline bool isComplete(const PNGImageDecoder* decoder)
428 {
429 return decoder->frameIsCompleteAtIndex(0);
430 }
431
432 void PNGImageDecoder::decode(bool onlySize) 427 void PNGImageDecoder::decode(bool onlySize)
433 { 428 {
434 if (failed()) 429 if (failed())
435 return; 430 return;
436 431
437 if (!m_reader) 432 if (!m_reader)
438 m_reader = adoptPtr(new PNGImageReader(this, m_offset)); 433 m_reader = adoptPtr(new PNGImageReader(this, m_offset));
439 434
440 // If we couldn't decode the image but have received all the data, decoding 435 // If we couldn't decode the image but have received all the data, decoding
441 // has failed. 436 // has failed.
442 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) 437 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived())
443 setFailed(); 438 setFailed();
444 439
445 // If decoding is done or failed, we don't need the PNGImageReader anymore. 440 // If decoding is done or failed, we don't need the PNGImageReader anymore.
446 if (isComplete(this) || failed()) 441 if (frameIsCompleteAtIndex(0) || failed())
447 m_reader.reset(); 442 m_reader.reset();
448 } 443 }
449 444
450 } // namespace blink 445 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698