Merge pull request #4156 from bopohaa/patch-1

closed #3159: Webp Test Crashes.
This commit is contained in:
James Chen 2013-11-11 18:31:03 -08:00
commit cfd82a26bb
1 changed files with 3 additions and 3 deletions

View File

@ -1737,12 +1737,12 @@ bool Image::initWithWebpData(const unsigned char * data, int dataLen)
_width = config.input.width; _width = config.input.width;
_height = config.input.height; _height = config.input.height;
int bufferSize = _width * _height * 4; _dataLen = _width * _height * 4;
_data = new unsigned char[bufferSize]; _data = new unsigned char[_dataLen];
config.output.u.RGBA.rgba = static_cast<uint8_t*>(_data); config.output.u.RGBA.rgba = static_cast<uint8_t*>(_data);
config.output.u.RGBA.stride = _width * 4; config.output.u.RGBA.stride = _width * 4;
config.output.u.RGBA.size = bufferSize; config.output.u.RGBA.size = _dataLen;
config.output.is_external_memory = 1; config.output.is_external_memory = 1;
if (WebPDecode(static_cast<const uint8_t*>(data), dataLen, &config) != VP8_STATUS_OK) if (WebPDecode(static_cast<const uint8_t*>(data), dataLen, &config) != VP8_STATUS_OK)