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

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

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: BMPDecoder + remove partial 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) Research In Motion Limited 2009-2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 decode(index); 137 decode(index);
138 PlatformInstrumentation::didDecodeImage(); 138 PlatformInstrumentation::didDecodeImage();
139 } 139 }
140 140
141 frame->notifyBitmapIfPixelsChanged(); 141 frame->notifyBitmapIfPixelsChanged();
142 return frame; 142 return frame;
143 } 143 }
144 144
145 bool ImageDecoder::frameHasAlphaAtIndex(size_t index) const 145 bool ImageDecoder::frameHasAlphaAtIndex(size_t index) const
146 { 146 {
147 return !frameIsCompleteAtIndex(index) || m_frameBufferCache[index].hasAlpha( ); 147 return index >= m_frameBufferCache.size() || m_frameBufferCache[index].hasAl pha();
148 } 148 }
149 149
150 bool ImageDecoder::frameIsCompleteAtIndex(size_t index) const 150 bool ImageDecoder::frameIsFullyReceivedAtIndex(size_t index) const
151 { 151 {
152 return (index < m_frameBufferCache.size()) && 152 return m_isAllDataReceived || failed();
153 (m_frameBufferCache[index].getStatus() == ImageFrame::FrameComplete);
154 } 153 }
155 154
156 size_t ImageDecoder::frameBytesAtIndex(size_t index) const 155 size_t ImageDecoder::frameBytesAtIndex(size_t index) const
157 { 156 {
158 if (index >= m_frameBufferCache.size() || m_frameBufferCache[index].getStatu s() == ImageFrame::FrameEmpty) 157 if (index >= m_frameBufferCache.size() || m_frameBufferCache[index].getStatu s() == ImageFrame::FrameEmpty)
159 return 0; 158 return 0;
160 159
161 struct ImageSize { 160 struct ImageSize {
162 161
163 explicit ImageSize(IntSize size) 162 explicit ImageSize(IntSize size)
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 355
357 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8; 356 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8;
358 357
359 // FIXME: Don't force perceptual intent if the image profile contains an int ent. 358 // FIXME: Don't force perceptual intent if the image profile contains an int ent.
360 m_sourceToOutputDeviceColorTransform = adoptPtr(qcms_transform_create(inputP rofile.get(), dataFormat, gOutputDeviceProfile, QCMS_DATA_RGBA_8, QCMS_INTENT_PE RCEPTUAL)); 359 m_sourceToOutputDeviceColorTransform = adoptPtr(qcms_transform_create(inputP rofile.get(), dataFormat, gOutputDeviceProfile, QCMS_DATA_RGBA_8, QCMS_INTENT_PE RCEPTUAL));
361 } 360 }
362 361
363 #endif // USE(QCMSLIB) 362 #endif // USE(QCMSLIB)
364 363
365 } // namespace blink 364 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698