OLD | NEW |
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 Loading... |
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 if (m_frameBufferCache.size() == 1) |
| 148 return !frameIsCompleteAtIndex(index) || m_frameBufferCache[index].hasAl
pha(); |
| 149 return !frameIsFullyReceivedAtIndex(index) || m_frameBufferCache[index].hasA
lpha(); |
148 } | 150 } |
149 | 151 |
150 bool ImageDecoder::frameIsCompleteAtIndex(size_t index) const | 152 bool ImageDecoder::frameIsFullyReceivedAtIndex(size_t index) const |
151 { | 153 { |
152 return (index < m_frameBufferCache.size()) && | 154 return m_isAllDataReceived || failed(); |
153 (m_frameBufferCache[index].getStatus() == ImageFrame::FrameComplete); | |
154 } | 155 } |
155 | 156 |
156 size_t ImageDecoder::frameBytesAtIndex(size_t index) const | 157 size_t ImageDecoder::frameBytesAtIndex(size_t index) const |
157 { | 158 { |
158 if (index >= m_frameBufferCache.size() || m_frameBufferCache[index].getStatu
s() == ImageFrame::FrameEmpty) | 159 if (index >= m_frameBufferCache.size() || m_frameBufferCache[index].getStatu
s() == ImageFrame::FrameEmpty) |
159 return 0; | 160 return 0; |
160 | 161 |
161 struct ImageSize { | 162 struct ImageSize { |
162 | 163 |
163 explicit ImageSize(IntSize size) | 164 explicit ImageSize(IntSize size) |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 357 |
357 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8; | 358 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8; |
358 | 359 |
359 // FIXME: Don't force perceptual intent if the image profile contains an int
ent. | 360 // 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)); | 361 m_sourceToOutputDeviceColorTransform = adoptPtr(qcms_transform_create(inputP
rofile.get(), dataFormat, gOutputDeviceProfile, QCMS_DATA_RGBA_8, QCMS_INTENT_PE
RCEPTUAL)); |
361 } | 362 } |
362 | 363 |
363 #endif // USE(QCMSLIB) | 364 #endif // USE(QCMSLIB) |
364 | 365 |
365 } // namespace blink | 366 } // namespace blink |
OLD | NEW |