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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better check in unit test 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) 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 bool DeferredImageDecoder::frameHasAlphaAtIndex(size_t index) const 182 bool DeferredImageDecoder::frameHasAlphaAtIndex(size_t index) const
183 { 183 {
184 if (m_actualDecoder) 184 if (m_actualDecoder)
185 return m_actualDecoder->frameHasAlphaAtIndex(index); 185 return m_actualDecoder->frameHasAlphaAtIndex(index);
186 if (!m_frameGenerator->isMultiFrame()) 186 if (!m_frameGenerator->isMultiFrame())
187 return m_frameGenerator->hasAlpha(index); 187 return m_frameGenerator->hasAlpha(index);
188 return true; 188 return true;
189 } 189 }
190 190
191 bool DeferredImageDecoder::frameIsCompleteAtIndex(size_t index) const 191 bool DeferredImageDecoder::frameIsFullyReceivedAtIndex(size_t index) const
192 { 192 {
193 if (m_actualDecoder) 193 if (m_actualDecoder)
194 return m_actualDecoder->frameIsCompleteAtIndex(index); 194 return m_actualDecoder->frameIsFullyReceivedAtIndex(index);
195 if (index < m_frameData.size()) 195 if (index < m_frameData.size())
196 return m_frameData[index].m_isComplete; 196 return m_frameData[index].m_isFullyReceived;
197 return false; 197 return false;
198 } 198 }
199 199
200 float DeferredImageDecoder::frameDurationAtIndex(size_t index) const 200 float DeferredImageDecoder::frameDurationAtIndex(size_t index) const
201 { 201 {
202 if (m_actualDecoder) 202 if (m_actualDecoder)
203 return m_actualDecoder->frameDurationAtIndex(index); 203 return m_actualDecoder->frameDurationAtIndex(index);
204 if (index < m_frameData.size()) 204 if (index < m_frameData.size())
205 return m_frameData[index].m_duration; 205 return m_frameData[index].m_duration;
206 return 0; 206 return 0;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 m_frameData.resize(m_actualDecoder->frameCount()); 254 m_frameData.resize(m_actualDecoder->frameCount());
255 255
256 // We have encountered a broken image file. Simply bail. 256 // We have encountered a broken image file. Simply bail.
257 if (m_frameData.size() < previousSize) 257 if (m_frameData.size() < previousSize)
258 return; 258 return;
259 259
260 for (size_t i = previousSize; i < m_frameData.size(); ++i) { 260 for (size_t i = previousSize; i < m_frameData.size(); ++i) {
261 m_frameData[i].m_haveMetadata = true; 261 m_frameData[i].m_haveMetadata = true;
262 m_frameData[i].m_duration = m_actualDecoder->frameDurationAtIndex(i); 262 m_frameData[i].m_duration = m_actualDecoder->frameDurationAtIndex(i);
263 m_frameData[i].m_orientation = m_actualDecoder->orientation(); 263 m_frameData[i].m_orientation = m_actualDecoder->orientation();
264 m_frameData[i].m_isComplete = m_actualDecoder->frameIsCompleteAtIndex(i) ; 264 m_frameData[i].m_isFullyReceived = m_actualDecoder->frameIsFullyReceived AtIndex(i);
265 } 265 }
266 266
267 // The last lazy decoded frame created from previous call might be 267 // The last lazy decoded frame created from previous call might be
268 // incomplete so update its state. 268 // incomplete so update its state.
269 if (previousSize) { 269 if (previousSize) {
270 const size_t lastFrame = previousSize - 1; 270 const size_t lastFrame = previousSize - 1;
271 m_frameData[lastFrame].m_isComplete = m_actualDecoder->frameIsCompleteAt Index(lastFrame); 271 m_frameData[lastFrame].m_isFullyReceived = m_actualDecoder->frameIsFully ReceivedAtIndex(lastFrame);
272 } 272 }
273 273
274 if (m_allDataReceived) { 274 if (m_allDataReceived) {
275 m_repetitionCount = m_actualDecoder->repetitionCount(); 275 m_repetitionCount = m_actualDecoder->repetitionCount();
276 m_actualDecoder.clear(); 276 m_actualDecoder.clear();
277 // Hold on to m_rwBuffer, which is still needed by createFrameAtIndex. 277 // Hold on to m_rwBuffer, which is still needed by createFrameAtIndex.
278 } 278 }
279 } 279 }
280 280
281 inline SkImageInfo imageInfoFrom(const SkISize& decodedSize, bool knownToBeOpaqu e) 281 inline SkImageInfo imageInfoFrom(const SkISize& decodedSize, bool knownToBeOpaqu e)
(...skipping 19 matching lines...) Expand all
301 return image.release(); 301 return image.release();
302 } 302 }
303 303
304 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const 304 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const
305 { 305 {
306 // TODO: Implement. 306 // TODO: Implement.
307 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; 307 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false;
308 } 308 }
309 309
310 } // namespace blink 310 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698