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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // the decoder. For multi-frame images, if all frames in the image are | 287 // the decoder. For multi-frame images, if all frames in the image are |
288 // decoded, we remove the decoder. | 288 // decoded, we remove the decoder. |
289 bool removeDecoder; | 289 bool removeDecoder; |
290 | 290 |
291 if (m_isMultiFrame) { | 291 if (m_isMultiFrame) { |
292 size_t decodedFrameCount = 0; | 292 size_t decodedFrameCount = 0; |
293 for (Vector<bool>::iterator it = m_frameComplete.begin(); it != m_frameC
omplete.end(); ++it) { | 293 for (Vector<bool>::iterator it = m_frameComplete.begin(); it != m_frameC
omplete.end(); ++it) { |
294 if (*it) | 294 if (*it) |
295 decodedFrameCount++; | 295 decodedFrameCount++; |
296 } | 296 } |
297 removeDecoder = m_frameCount && (decodedFrameCount == m_frameCount); | 297 removeDecoder = m_frameCount && (decodedFrameCount == m_frameCount) && (
index == m_frameCount - 1); |
298 } else { | 298 } else { |
299 removeDecoder = complete; | 299 removeDecoder = complete; |
300 } | 300 } |
301 | 301 |
302 if (resumeDecoding) { | 302 if (resumeDecoding) { |
303 if (removeDecoder) { | 303 if (removeDecoder) { |
304 ImageDecodingStore::instance().removeDecoder(this, decoder); | 304 ImageDecodingStore::instance().removeDecoder(this, decoder); |
305 m_frameComplete.clear(); | 305 m_frameComplete.clear(); |
306 } else { | 306 } else { |
307 ImageDecodingStore::instance().unlockDecoder(this, decoder); | 307 ImageDecodingStore::instance().unlockDecoder(this, decoder); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. | 413 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. |
414 decoder->setData(data, allDataReceived); | 414 decoder->setData(data, allDataReceived); |
415 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); | 415 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); |
416 decoder->setImagePlanes(dummyImagePlanes.release()); | 416 decoder->setImagePlanes(dummyImagePlanes.release()); |
417 | 417 |
418 ASSERT(componentSizes); | 418 ASSERT(componentSizes); |
419 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); | 419 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); |
420 } | 420 } |
421 | 421 |
422 } // namespace blink | 422 } // namespace blink |
OLD | NEW |