Changeset 102158 in webkit
- Timestamp:
- Dec 6, 2011 11:29:42 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102157 r102158 1 2011-12-06 Noel Gordon <noel.gordon@gmail.com> 2 3 WebPImageDecoder computes image width and height multiple times 4 https://bugs.webkit.org/show_bug.cgi?id=73796 5 6 Reviewed by Adam Barth. 7 8 Once sufficient image data arrives, we can compute the decoded image height 9 and width from the WEBP image header data. 10 11 From then on, the decoded image size is known so there's no need to re-read 12 it from the WEBP image header again. 13 14 No change in behavior, so no new tests. 15 16 * platform/image-decoders/webp/WEBPImageDecoder.cpp: 17 (WebCore::WEBPImageDecoder::decode): 18 1 19 2011-12-06 Mike Reed <reed@google.com> 2 20 -
trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp
r101948 r102158 86 86 return false; 87 87 88 const uint8_t* dataBytes = reinterpret_cast<const uint8_t*>(m_data->data()); 88 89 const size_t dataSize = m_data->size(); 89 if (dataSize < sizeOfHeader)90 return true;91 90 92 int width, height; 93 const uint8_t* dataBytes = reinterpret_cast<const uint8_t*>(m_data->data()); 94 if (!WebPGetInfo(dataBytes, dataSize, &width, &height)) 95 return setFailed(); 96 if (!ImageDecoder::isSizeAvailable() && !setSize(width, height)) 97 return setFailed(); 91 if (!ImageDecoder::isSizeAvailable()) { 92 if (dataSize < sizeOfHeader) 93 return false; 94 int width, height; 95 if (!WebPGetInfo(dataBytes, dataSize, &width, &height)) 96 return setFailed(); 97 if (!setSize(width, height)) 98 return setFailed(); 99 } 100 101 ASSERT(ImageDecoder::isSizeAvailable()); 98 102 if (onlySize) 99 103 return true; 104 int width = size().width(); 105 int height = size().height(); 100 106 101 107 bool allDataReceived = isAllDataReceived(); … … 103 109 ASSERT(!m_frameBufferCache.isEmpty()); 104 110 ImageFrame& buffer = m_frameBufferCache[0]; 111 105 112 if (buffer.status() == ImageFrame::FrameEmpty) { 106 ASSERT(width == size().width());107 ASSERT(height == size().height());108 113 if (!buffer.setSize(width, height)) 109 114 return setFailed(); … … 114 119 m_rgbOutput.resize(height * stride); 115 120 } 121 116 122 int newLastVisibleRow = 0; // Last completed row. 117 123 if (allDataReceived) { … … 133 139 ASSERT(newLastVisibleRow <= height); 134 140 } 141 135 142 // FIXME: remove this data copy. 136 143 for (int y = m_lastVisibleRow; y < newLastVisibleRow; ++y) { … … 139 146 buffer.setRGBA(x, y, src[bytesPerPixel * x + 0], src[bytesPerPixel * x + 1], src[bytesPerPixel * x + 2], 0xff); 140 147 } 148 141 149 m_lastVisibleRow = newLastVisibleRow; 142 150 if (m_lastVisibleRow == height)
Note: See TracChangeset
for help on using the changeset viewer.