OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 ASSERT(height == size().height()); | 104 ASSERT(height == size().height()); |
105 if (!buffer.setSize(width, height)) | 105 if (!buffer.setSize(width, height)) |
106 return setFailed(); | 106 return setFailed(); |
107 buffer.setStatus(allDataReceived ? ImageFrame::FrameComplete : ImageFram
e::FramePartial); | 107 buffer.setStatus(allDataReceived ? ImageFrame::FrameComplete : ImageFram
e::FramePartial); |
108 // FIXME: We currently hard code false below because libwebp doesn't sup
port alpha yet. | 108 // FIXME: We currently hard code false below because libwebp doesn't sup
port alpha yet. |
109 buffer.setHasAlpha(false); | 109 buffer.setHasAlpha(false); |
110 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); | 110 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); |
111 m_rgbOutput.resize(height * stride); | 111 m_rgbOutput.resize(height * stride); |
112 } | 112 } |
113 int newLastVisibleRow = 0; // Last completed row. | 113 int newLastVisibleRow = 0; // Last completed row. |
114 if (allDataReceived) { | 114 if (allDataReceived && !m_decoder) { |
115 if (!WebPDecodeRGBInto(dataBytes, dataSize, m_rgbOutput.data(), m_rgbOut
put.size(), stride)) | 115 if (!WebPDecodeRGBInto(dataBytes, dataSize, m_rgbOutput.data(), m_rgbOut
put.size(), stride)) |
116 return setFailed(); | 116 return setFailed(); |
117 newLastVisibleRow = height; | 117 newLastVisibleRow = height; |
118 } else { | 118 } else { |
119 if (!m_decoder) { | 119 if (!m_decoder) { |
120 m_decoder = WebPINewRGB(MODE_RGB, m_rgbOutput.data(), m_rgbOutput.si
ze(), stride); | 120 m_decoder = WebPINewRGB(MODE_RGB, m_rgbOutput.data(), m_rgbOutput.si
ze(), stride); |
121 if (!m_decoder) | 121 if (!m_decoder) |
122 return setFailed(); | 122 return setFailed(); |
123 } | 123 } |
124 const VP8StatusCode status = WebPIUpdate(m_decoder, dataBytes, dataSize)
; | 124 const VP8StatusCode status = WebPIUpdate(m_decoder, dataBytes, dataSize)
; |
(...skipping 12 matching lines...) Expand all Loading... |
137 } | 137 } |
138 m_lastVisibleRow = newLastVisibleRow; | 138 m_lastVisibleRow = newLastVisibleRow; |
139 if (m_lastVisibleRow == height) | 139 if (m_lastVisibleRow == height) |
140 buffer.setStatus(ImageFrame::FrameComplete); | 140 buffer.setStatus(ImageFrame::FrameComplete); |
141 return m_lastVisibleRow == height; | 141 return m_lastVisibleRow == height; |
142 } | 142 } |
143 | 143 |
144 } | 144 } |
145 | 145 |
146 #endif | 146 #endif |
OLD | NEW |