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

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: 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) 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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 960
961 void JPEGImageDecoder::complete() 961 void JPEGImageDecoder::complete()
962 { 962 {
963 if (m_frameBufferCache.isEmpty()) 963 if (m_frameBufferCache.isEmpty())
964 return; 964 return;
965 965
966 m_frameBufferCache[0].setHasAlpha(false); 966 m_frameBufferCache[0].setHasAlpha(false);
967 m_frameBufferCache[0].setStatus(ImageFrame::FrameComplete); 967 m_frameBufferCache[0].setStatus(ImageFrame::FrameComplete);
968 } 968 }
969 969
970 inline bool isComplete(const JPEGImageDecoder* decoder, bool onlySize)
971 {
972 if (decoder->hasImagePlanes() && !onlySize)
973 return true;
974
975 return decoder->frameIsCompleteAtIndex(0);
976 }
977
978 void JPEGImageDecoder::decode(bool onlySize) 970 void JPEGImageDecoder::decode(bool onlySize)
979 { 971 {
980 if (failed()) 972 if (failed())
981 return; 973 return;
982 974
983 if (!m_reader) { 975 if (!m_reader) {
984 m_reader = adoptPtr(new JPEGImageReader(this)); 976 m_reader = adoptPtr(new JPEGImageReader(this));
985 m_reader->setData(m_data.get()); 977 m_reader->setData(m_data.get());
986 } 978 }
987 979
988 // If we couldn't decode the image but have received all the data, decoding 980 // If we couldn't decode the image but have received all the data, decoding
989 // has failed. 981 // has failed.
990 if (!m_reader->decode(onlySize) && isAllDataReceived()) 982 if (!m_reader->decode(onlySize) && isAllDataReceived())
991 setFailed(); 983 setFailed();
992 984
993 // If decoding is done or failed, we don't need the JPEGImageReader anymore. 985 // If decoding is done or failed, we don't need the JPEGImageReader anymore.
994 if (isComplete(this, onlySize) || failed()) 986 if (frameIsCompleteAtIndex(0) || (hasImagePlanes() && !onlySize) || failed() )
995 m_reader.clear(); 987 m_reader.clear();
996 } 988 }
997 989
998 } // namespace blink 990 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698