Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1170)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review #23 fix - comments. cleanup. Thanks Leon. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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);
175 bool frameIsLoadedAtIndex = index < m_frameBufferCache.size(); 173
176 return frameIsLoadedAtIndex; 174 // Multi-frame WebP frame gets added to m_frameBufferCache through
175 // initializeNewFrame() only when the frame data is fully received.
Peter Kasting 2016/05/25 01:05:23 Really? That's not what it looks like to me. m_f
aleksandar.stojiljkovic 2016/05/30 16:12:20 Yes, it is like that. I could work on documenting
Peter Kasting 2016/05/31 03:46:42 That looks to me like a bug in the webp decoder, h
scroggo_chromium 2016/06/01 15:11:25 AFAICT, the GIF decoder does not know its frame co
Peter Kasting 2016/06/01 15:23:49 Huh. I was misled by the way there's a separate f
176 return index < m_frameBufferCache.size();
177 } 177 }
178 178
179 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const 179 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const
180 { 180 {
181 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio n() : 0; 181 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio n() : 0;
182 } 182 }
183 183
184 bool WEBPImageDecoder::updateDemuxer() 184 bool WEBPImageDecoder::updateDemuxer()
185 { 185 {
186 if (failed()) 186 if (failed())
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 return false; 505 return false;
506 } 506 }
507 // FALLTHROUGH 507 // FALLTHROUGH
508 default: 508 default:
509 clear(); 509 clear();
510 return setFailed(); 510 return setFailed();
511 } 511 }
512 } 512 }
513 513
514 } // namespace blink 514 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698