| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 blink::GIFImageDecoder* client, | 335 blink::GIFImageDecoder* client, |
| 336 bool* frameDecoded) { | 336 bool* frameDecoded) { |
| 337 m_localColorMap.buildTable(reader); | 337 m_localColorMap.buildTable(reader); |
| 338 | 338 |
| 339 *frameDecoded = false; | 339 *frameDecoded = false; |
| 340 if (!m_lzwContext) { | 340 if (!m_lzwContext) { |
| 341 // Wait for more data to properly initialize GIFLZWContext. | 341 // Wait for more data to properly initialize GIFLZWContext. |
| 342 if (!isDataSizeDefined() || !isHeaderDefined()) | 342 if (!isDataSizeDefined() || !isHeaderDefined()) |
| 343 return true; | 343 return true; |
| 344 | 344 |
| 345 m_lzwContext = wrapUnique(new GIFLZWContext(client, this)); | 345 m_lzwContext = makeUnique<GIFLZWContext>(client, this); |
| 346 if (!m_lzwContext->prepareToDecode()) { | 346 if (!m_lzwContext->prepareToDecode()) { |
| 347 m_lzwContext.reset(); | 347 m_lzwContext.reset(); |
| 348 return false; | 348 return false; |
| 349 } | 349 } |
| 350 | 350 |
| 351 m_currentLzwBlock = 0; | 351 m_currentLzwBlock = 0; |
| 352 } | 352 } |
| 353 | 353 |
| 354 // Some bad GIFs have extra blocks beyond the last row, which we don't want to | 354 // Some bad GIFs have extra blocks beyond the last row, which we don't want to |
| 355 // decode. | 355 // decode. |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 rowIter = rowBuffer.begin(); | 916 rowIter = rowBuffer.begin(); |
| 917 rowsRemaining = m_frameContext->height(); | 917 rowsRemaining = m_frameContext->height(); |
| 918 | 918 |
| 919 // Clearing the whole suffix table lets us be more tolerant of bad data. | 919 // Clearing the whole suffix table lets us be more tolerant of bad data. |
| 920 for (int i = 0; i < clearCode; ++i) { | 920 for (int i = 0; i < clearCode; ++i) { |
| 921 suffix[i] = i; | 921 suffix[i] = i; |
| 922 suffixLength[i] = 1; | 922 suffixLength[i] = 1; |
| 923 } | 923 } |
| 924 return true; | 924 return true; |
| 925 } | 925 } |
| OLD | NEW |