| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 if (!s_enabled | 220 if (!s_enabled |
| 221 || !m_actualDecoder | 221 || !m_actualDecoder |
| 222 || !m_actualDecoder->isSizeAvailable() | 222 || !m_actualDecoder->isSizeAvailable() |
| 223 || m_actualDecoder->filenameExtension() == "ico") | 223 || m_actualDecoder->filenameExtension() == "ico") |
| 224 return; | 224 return; |
| 225 | 225 |
| 226 activateLazyDecoding(); | 226 activateLazyDecoding(); |
| 227 | 227 |
| 228 const size_t previousSize = m_lazyDecodedFrames.size(); | 228 const size_t previousSize = m_lazyDecodedFrames.size(); |
| 229 m_lazyDecodedFrames.resize(m_actualDecoder->frameCount()); | 229 m_lazyDecodedFrames.resize(m_actualDecoder->frameCount()); |
| 230 |
| 231 // We have encountered a broken image file. Simply bail. |
| 232 if (m_lazyDecodedFrames.size() < previousSize) |
| 233 return; |
| 234 |
| 230 for (size_t i = previousSize; i < m_lazyDecodedFrames.size(); ++i) { | 235 for (size_t i = previousSize; i < m_lazyDecodedFrames.size(); ++i) { |
| 231 OwnPtr<ImageFrame> frame(adoptPtr(new ImageFrame())); | 236 OwnPtr<ImageFrame> frame(adoptPtr(new ImageFrame())); |
| 232 frame->setSkBitmap(createBitmap(i)); | 237 frame->setSkBitmap(createBitmap(i)); |
| 233 frame->setDuration(m_actualDecoder->frameDurationAtIndex(i)); | 238 frame->setDuration(m_actualDecoder->frameDurationAtIndex(i)); |
| 234 frame->setStatus(m_actualDecoder->frameIsCompleteAtIndex(i) ? ImageFrame
::FrameComplete : ImageFrame::FramePartial); | 239 frame->setStatus(m_actualDecoder->frameIsCompleteAtIndex(i) ? ImageFrame
::FrameComplete : ImageFrame::FramePartial); |
| 235 m_lazyDecodedFrames[i] = frame.release(); | 240 m_lazyDecodedFrames[i] = frame.release(); |
| 236 } | 241 } |
| 237 | 242 |
| 238 // The last lazy decoded frame created from previous call might be | 243 // The last lazy decoded frame created from previous call might be |
| 239 // incomplete so update its state. | 244 // incomplete so update its state. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 return bitmap; | 321 return bitmap; |
| 317 } | 322 } |
| 318 | 323 |
| 319 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const | 324 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const |
| 320 { | 325 { |
| 321 // TODO: Implement. | 326 // TODO: Implement. |
| 322 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; | 327 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; |
| 323 } | 328 } |
| 324 | 329 |
| 325 } // namespace WebCore | 330 } // namespace WebCore |
| OLD | NEW |