Fix progressive WebP decoding by creating data provider with actual data size

This commit is contained in:
DreamPiggy 2017-12-16 00:29:48 +08:00
parent d2443d9c56
commit 283d66c308
1 changed files with 2 additions and 1 deletions

View File

@ -169,8 +169,9 @@
// last_y may be 0, means no enough bitmap data to decode, ignore this
if (width + height > 0 && last_y > 0 && height >= last_y) {
// Construct a UIImage from the decoded RGBA value array
size_t rgbaSize = last_y * stride;
CGDataProviderRef provider =
CGDataProviderCreateWithData(NULL, rgba, 0, NULL);
CGDataProviderCreateWithData(NULL, rgba, rgbaSize, NULL);
CGColorSpaceRef colorSpaceRef = SDCGColorSpaceGetDeviceRGB();
CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast;