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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ASSERT if frameCount not called to parse before calling... 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) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * 3 *
4 * Portions are Copyright (C) 2001-6 mozilla.org 4 * Portions are Copyright (C) 2001-6 mozilla.org
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Stuart Parmenter <stuart@mozilla.com> 7 * Stuart Parmenter <stuart@mozilla.com>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 959
960 void JPEGImageDecoder::complete() 960 void JPEGImageDecoder::complete()
961 { 961 {
962 if (m_frameBufferCache.isEmpty()) 962 if (m_frameBufferCache.isEmpty())
963 return; 963 return;
964 964
965 m_frameBufferCache[0].setHasAlpha(false); 965 m_frameBufferCache[0].setHasAlpha(false);
966 m_frameBufferCache[0].setStatus(ImageFrame::FrameComplete); 966 m_frameBufferCache[0].setStatus(ImageFrame::FrameComplete);
967 } 967 }
968 968
969 inline bool isComplete(const JPEGImageDecoder* decoder, bool onlySize)
970 {
971 if (decoder->hasImagePlanes() && !onlySize)
972 return true;
973
974 return decoder->frameIsCompleteAtIndex(0);
975 }
976
977 void JPEGImageDecoder::decode(bool onlySize) 969 void JPEGImageDecoder::decode(bool onlySize)
978 { 970 {
979 if (failed()) 971 if (failed())
980 return; 972 return;
981 973
982 if (!m_reader) { 974 if (!m_reader) {
983 m_reader = adoptPtr(new JPEGImageReader(this)); 975 m_reader = adoptPtr(new JPEGImageReader(this));
984 m_reader->setData(m_data.get()); 976 m_reader->setData(m_data.get());
985 } 977 }
986 978
987 // If we couldn't decode the image but have received all the data, decoding 979 // If we couldn't decode the image but have received all the data, decoding
988 // has failed. 980 // has failed.
989 if (!m_reader->decode(onlySize) && isAllDataReceived()) 981 if (!m_reader->decode(onlySize) && isAllDataReceived())
990 setFailed(); 982 setFailed();
991 983
992 // If decoding is done or failed, we don't need the JPEGImageReader anymore. 984 // If decoding is done or failed, we don't need the JPEGImageReader anymore.
993 if (isComplete(this, onlySize) || failed()) 985 if (frameIsCompleteAtIndex(0) || (hasImagePlanes() && !onlySize) || failed() )
994 m_reader.clear(); 986 m_reader.clear();
995 } 987 }
996 988
997 } // namespace blink 989 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698