| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 ~PNGImageReader() | 105 ~PNGImageReader() |
| 106 { | 106 { |
| 107 png_destroy_read_struct(m_png ? &m_png : 0, m_info ? &m_info : 0, 0); | 107 png_destroy_read_struct(m_png ? &m_png : 0, m_info ? &m_info : 0, 0); |
| 108 ASSERT(!m_png && !m_info); | 108 ASSERT(!m_png && !m_info); |
| 109 | 109 |
| 110 m_readOffset = 0; | 110 m_readOffset = 0; |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool decode(const SharedBuffer& data, bool sizeOnly) | 113 bool decode(const SegmentReader& data, bool sizeOnly) |
| 114 { | 114 { |
| 115 m_decodingSizeOnly = sizeOnly; | 115 m_decodingSizeOnly = sizeOnly; |
| 116 | 116 |
| 117 // We need to do the setjmp here. Otherwise bad things will happen. | 117 // We need to do the setjmp here. Otherwise bad things will happen. |
| 118 if (setjmp(JMPBUF(m_png))) | 118 if (setjmp(JMPBUF(m_png))) |
| 119 return m_decoder->setFailed(); | 119 return m_decoder->setFailed(); |
| 120 | 120 |
| 121 const char* segment; | 121 const char* segment; |
| 122 while (size_t segmentLength = data.getSomeData(segment, m_readOffset)) { | 122 while (size_t segmentLength = data.getSomeData(segment, m_readOffset)) { |
| 123 m_readOffset += segmentLength; | 123 m_readOffset += segmentLength; |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 // has failed. | 432 // has failed. |
| 433 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 433 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
| 434 setFailed(); | 434 setFailed(); |
| 435 | 435 |
| 436 // If decoding is done or failed, we don't need the PNGImageReader anymore. | 436 // If decoding is done or failed, we don't need the PNGImageReader anymore. |
| 437 if (isComplete(this) || failed()) | 437 if (isComplete(this) || failed()) |
| 438 m_reader.clear(); | 438 m_reader.clear(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |