| OLD | NEW |
| 1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
| 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 4 * | 4 * |
| 5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
| 6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
| 7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
| 8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
| 9 * | 9 * |
| 10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 return true; | 827 return true; |
| 828 } | 828 } |
| 829 | 829 |
| 830 void GIFImageReader::setRemainingBytes(size_t remainingBytes) { | 830 void GIFImageReader::setRemainingBytes(size_t remainingBytes) { |
| 831 ASSERT(remainingBytes <= m_data->size()); | 831 ASSERT(remainingBytes <= m_data->size()); |
| 832 m_bytesRead = m_data->size() - remainingBytes; | 832 m_bytesRead = m_data->size() - remainingBytes; |
| 833 } | 833 } |
| 834 | 834 |
| 835 void GIFImageReader::addFrameIfNecessary() { | 835 void GIFImageReader::addFrameIfNecessary() { |
| 836 if (m_frames.isEmpty() || m_frames.back()->isComplete()) | 836 if (m_frames.isEmpty() || m_frames.back()->isComplete()) |
| 837 m_frames.append(WTF::wrapUnique(new GIFFrameContext(m_frames.size()))); | 837 m_frames.push_back(WTF::wrapUnique(new GIFFrameContext(m_frames.size()))); |
| 838 } | 838 } |
| 839 | 839 |
| 840 // FIXME: Move this method to close to doLZW(). | 840 // FIXME: Move this method to close to doLZW(). |
| 841 bool GIFLZWContext::prepareToDecode() { | 841 bool GIFLZWContext::prepareToDecode() { |
| 842 ASSERT(m_frameContext->isDataSizeDefined() && | 842 ASSERT(m_frameContext->isDataSizeDefined() && |
| 843 m_frameContext->isHeaderDefined()); | 843 m_frameContext->isHeaderDefined()); |
| 844 | 844 |
| 845 // Since we use a codesize of 1 more than the datasize, we need to ensure | 845 // Since we use a codesize of 1 more than the datasize, we need to ensure |
| 846 // that our datasize is strictly less than the MAX_DICTIONARY_ENTRY_BITS. | 846 // that our datasize is strictly less than the MAX_DICTIONARY_ENTRY_BITS. |
| 847 if (m_frameContext->dataSize() >= MAX_DICTIONARY_ENTRY_BITS) | 847 if (m_frameContext->dataSize() >= MAX_DICTIONARY_ENTRY_BITS) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 rowIter = rowBuffer.begin(); | 881 rowIter = rowBuffer.begin(); |
| 882 rowsRemaining = m_frameContext->height(); | 882 rowsRemaining = m_frameContext->height(); |
| 883 | 883 |
| 884 // Clearing the whole suffix table lets us be more tolerant of bad data. | 884 // Clearing the whole suffix table lets us be more tolerant of bad data. |
| 885 for (int i = 0; i < clearCode; ++i) { | 885 for (int i = 0; i < clearCode; ++i) { |
| 886 suffix[i] = i; | 886 suffix[i] = i; |
| 887 suffixLength[i] = 1; | 887 suffixLength[i] = 1; |
| 888 } | 888 } |
| 889 return true; | 889 return true; |
| 890 } | 890 } |
| OLD | NEW |