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

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: PNG alpha & partial decode fixes. Created 4 years, 7 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void WEBPImageDecoder::onSetData(SharedBuffer*) 158 void WEBPImageDecoder::onSetData(SharedBuffer*)
159 { 159 {
160 m_haveAlreadyParsedThisData = false; 160 m_haveAlreadyParsedThisData = false;
161 } 161 }
162 162
163 int WEBPImageDecoder::repetitionCount() const 163 int WEBPImageDecoder::repetitionCount() const
164 { 164 {
165 return failed() ? cAnimationLoopOnce : m_repetitionCount; 165 return failed() ? cAnimationLoopOnce : m_repetitionCount;
166 } 166 }
167 167
168 bool WEBPImageDecoder::frameIsCompleteAtIndex(size_t index) const 168 bool WEBPImageDecoder::frameIsFullyReceivedAtIndex(size_t index) const
169 { 169 {
170 if (!m_demux || m_demuxState <= WEBP_DEMUX_PARSING_HEADER) 170 if (!m_demux || m_demuxState <= WEBP_DEMUX_PARSING_HEADER)
171 return false; 171 return false;
172 if (!(m_formatFlags & ANIMATION_FLAG)) 172 if (!(m_formatFlags & ANIMATION_FLAG))
173 return ImageDecoder::frameIsCompleteAtIndex(index); 173 return ImageDecoder::frameIsFullyReceivedAtIndex(index);
174 bool frameIsLoadedAtIndex = index < m_frameBufferCache.size(); 174 bool frameIsLoadedAtIndex = index < m_frameBufferCache.size();
175 return frameIsLoadedAtIndex; 175 return frameIsLoadedAtIndex;
176 } 176 }
177 177
178 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const 178 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const
179 { 179 {
180 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio n() : 0; 180 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio n() : 0;
181 } 181 }
182 182
183 bool WEBPImageDecoder::updateDemuxer() 183 bool WEBPImageDecoder::updateDemuxer()
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 m_decoderBuffer.u.RGBA.rgba = reinterpret_cast<uint8_t*>(buffer.getAddr(fram eRect.x(), frameRect.y())); 488 m_decoderBuffer.u.RGBA.rgba = reinterpret_cast<uint8_t*>(buffer.getAddr(fram eRect.x(), frameRect.y()));
489 489
490 switch (WebPIUpdate(m_decoder, dataBytes, dataSize)) { 490 switch (WebPIUpdate(m_decoder, dataBytes, dataSize)) {
491 case VP8_STATUS_OK: 491 case VP8_STATUS_OK:
492 applyPostProcessing(frameIndex); 492 applyPostProcessing(frameIndex);
493 buffer.setHasAlpha((m_formatFlags & ALPHA_FLAG) || m_frameBackgroundHasA lpha); 493 buffer.setHasAlpha((m_formatFlags & ALPHA_FLAG) || m_frameBackgroundHasA lpha);
494 buffer.setStatus(ImageFrame::FrameComplete); 494 buffer.setStatus(ImageFrame::FrameComplete);
495 clearDecoder(); 495 clearDecoder();
496 return true; 496 return true;
497 case VP8_STATUS_SUSPENDED: 497 case VP8_STATUS_SUSPENDED:
498 if (!isAllDataReceived() && !frameIsCompleteAtIndex(frameIndex)) { 498 if (!isAllDataReceived() && !frameIsFullyReceivedAtIndex(frameIndex)) {
499 applyPostProcessing(frameIndex); 499 applyPostProcessing(frameIndex);
500 return false; 500 return false;
501 } 501 }
502 // FALLTHROUGH 502 // FALLTHROUGH
503 default: 503 default:
504 clear(); 504 clear();
505 return setFailed(); 505 return setFailed();
506 } 506 }
507 } 507 }
508 508
509 } // namespace blink 509 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698