OLD | NEW |
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 } | 408 } |
409 | 409 |
410 void PNGImageDecoder::complete() | 410 void PNGImageDecoder::complete() |
411 { | 411 { |
412 if (m_frameBufferCache.isEmpty()) | 412 if (m_frameBufferCache.isEmpty()) |
413 return; | 413 return; |
414 | 414 |
415 m_frameBufferCache[0].setStatus(ImageFrame::FrameComplete); | 415 m_frameBufferCache[0].setStatus(ImageFrame::FrameComplete); |
416 } | 416 } |
417 | 417 |
418 inline bool isComplete(const PNGImageDecoder* decoder) | |
419 { | |
420 return decoder->frameIsCompleteAtIndex(0); | |
421 } | |
422 | |
423 void PNGImageDecoder::decode(bool onlySize) | 418 void PNGImageDecoder::decode(bool onlySize) |
424 { | 419 { |
425 if (failed()) | 420 if (failed()) |
426 return; | 421 return; |
427 | 422 |
428 if (!m_reader) | 423 if (!m_reader) |
429 m_reader = adoptPtr(new PNGImageReader(this, m_offset)); | 424 m_reader = adoptPtr(new PNGImageReader(this, m_offset)); |
430 | 425 |
431 // If we couldn't decode the image but have received all the data, decoding | 426 // If we couldn't decode the image but have received all the data, decoding |
432 // has failed. | 427 // has failed. |
433 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 428 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
434 setFailed(); | 429 setFailed(); |
435 | 430 |
436 // If decoding is done or failed, we don't need the PNGImageReader anymore. | 431 // If decoding is done or failed, we don't need the PNGImageReader anymore. |
437 if (isComplete(this) || failed()) | 432 if (frameIsCompleteAtIndex(0) || failed()) |
438 m_reader.clear(); | 433 m_reader.clear(); |
439 } | 434 } |
440 | 435 |
441 } // namespace blink | 436 } // namespace blink |
OLD | NEW |