Merge pull request #2131 from dreampiggy/fix_progressive_webp_decoding

Fix progressive WebP decoding by creating data provider with actual data size
This commit is contained in:
DreamPiggy 2017-12-16 00:42:54 +08:00 committed by GitHub
commit df7ed34c14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;