| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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)
; |
| 125 if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) | 125 if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) |
| 126 return setFailed(); | 126 return setFailed(); |
| 127 if (!WebPIDecGetRGB(m_decoder, &newLastVisibleRow, 0, 0, 0)) | 127 if (!WebPIDecGetRGB(m_decoder, &newLastVisibleRow, 0, 0, 0)) |
| 128 return setFailed(); | 128 return false; |
| 129 ASSERT(newLastVisibleRow >= 0); | 129 ASSERT(newLastVisibleRow >= 0); |
| 130 ASSERT(newLastVisibleRow <= height); | 130 ASSERT(newLastVisibleRow <= height); |
| 131 } | 131 } |
| 132 // FIXME: remove this data copy. | 132 // FIXME: remove this data copy. |
| 133 for (int y = m_lastVisibleRow; y < newLastVisibleRow; ++y) { | 133 for (int y = m_lastVisibleRow; y < newLastVisibleRow; ++y) { |
| 134 const uint8_t* const src = &m_rgbOutput[y * stride]; | 134 const uint8_t* const src = &m_rgbOutput[y * stride]; |
| 135 for (int x = 0; x < width; ++x) | 135 for (int x = 0; x < width; ++x) |
| 136 buffer.setRGBA(x, y, src[bytesPerPixel * x + 0], src[bytesPerPixel *
x + 1], src[bytesPerPixel * x + 2], 0xff); | 136 buffer.setRGBA(x, y, src[bytesPerPixel * x + 0], src[bytesPerPixel *
x + 1], src[bytesPerPixel * x + 2], 0xff); |
| 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 |