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) | |
172 return false; | |
173 if (!(m_formatFlags & ANIMATION_FLAG)) | 171 if (!(m_formatFlags & ANIMATION_FLAG)) |
174 return ImageDecoder::frameIsCompleteAtIndex(index); | 172 return ImageDecoder::frameIsFullyReceivedAtIndex(index) || frameIsComple
teAtIndex(index); |
175 bool frameIsLoadedAtIndex = index < m_frameBufferCache.size(); | 173 return index < m_frameBufferCache.size() || failed(); |
176 return frameIsLoadedAtIndex; | |
177 } | 174 } |
178 | 175 |
179 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const | 176 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const |
180 { | 177 { |
181 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio
n() : 0; | 178 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio
n() : 0; |
182 } | 179 } |
183 | 180 |
184 bool WEBPImageDecoder::updateDemuxer() | 181 bool WEBPImageDecoder::updateDemuxer() |
185 { | 182 { |
186 if (failed()) | 183 if (failed()) |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 return false; | 502 return false; |
506 } | 503 } |
507 // FALLTHROUGH | 504 // FALLTHROUGH |
508 default: | 505 default: |
509 clear(); | 506 clear(); |
510 return setFailed(); | 507 return setFailed(); |
511 } | 508 } |
512 } | 509 } |
513 | 510 |
514 } // namespace blink | 511 } // namespace blink |
OLD | NEW |