OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void WEBPImageDecoder::onSetData(SegmentReader*) | 159 void WEBPImageDecoder::onSetData(SegmentReader*) |
160 { | 160 { |
161 m_haveAlreadyParsedThisData = false; | 161 m_haveAlreadyParsedThisData = false; |
162 } | 162 } |
163 | 163 |
164 int WEBPImageDecoder::repetitionCount() const | 164 int WEBPImageDecoder::repetitionCount() const |
165 { | 165 { |
166 return failed() ? cAnimationLoopOnce : m_repetitionCount; | 166 return failed() ? cAnimationLoopOnce : m_repetitionCount; |
167 } | 167 } |
168 | 168 |
169 bool WEBPImageDecoder::frameIsCompleteAtIndex(size_t index) const | 169 bool WEBPImageDecoder::frameIsFullyReceivedAtIndex(size_t index) const |
170 { | 170 { |
171 if (!m_demux || m_demuxState <= WEBP_DEMUX_PARSING_HEADER) | 171 ASSERT(haveUpdatedFrameCount()); |
172 return false; | |
173 if (!(m_formatFlags & ANIMATION_FLAG)) | 172 if (!(m_formatFlags & ANIMATION_FLAG)) |
174 return ImageDecoder::frameIsCompleteAtIndex(index); | 173 return ImageDecoder::frameIsFullyReceivedAtIndex(index); |
175 bool frameIsLoadedAtIndex = index < m_frameBufferCache.size(); | 174 |
176 return frameIsLoadedAtIndex; | 175 // Multi-frame WebP frame gets added to m_frameBufferCache through |
| 176 // initializeNewFrame() only when the frame data is fully received. |
| 177 return index < m_frameBufferCache.size(); |
177 } | 178 } |
178 | 179 |
179 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const | 180 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const |
180 { | 181 { |
181 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio
n() : 0; | 182 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio
n() : 0; |
182 } | 183 } |
183 | 184 |
184 bool WEBPImageDecoder::updateDemuxer() | 185 bool WEBPImageDecoder::updateDemuxer() |
185 { | 186 { |
186 if (failed()) | 187 if (failed()) |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 return false; | 506 return false; |
506 } | 507 } |
507 // FALLTHROUGH | 508 // FALLTHROUGH |
508 default: | 509 default: |
509 clear(); | 510 clear(); |
510 return setFailed(); | 511 return setFailed(); |
511 } | 512 } |
512 } | 513 } |
513 | 514 |
514 } // namespace blink | 515 } // namespace blink |
OLD | NEW |