iOS-WebP
iOS-WebP copied to clipboard
iOS 11.2 Beta
Is it just me or it does not work anymore on iOS 11.2 Beta? The imageRef
in:
CGImageRef imageRef = CGImageCreate(width, height, 8, 32, 4 * width, colorSpaceRef, bitmapInfo, provider, NULL, YES, renderingIntent);
always return nil.
I think this issue worth checking since it can potentially break everyone code when Apple officially release 11.2...
Instead of this
CGDataProviderRef provider = CGDataProviderCreateWithData(config, data, config->options.scaled_width * config->options.scaled_height * 4, free_image_data);
it should be like this
CGDataProviderRef provider = CGDataProviderCreateWithData(config, data, width * height * 4, free_image_data);
Since you did not update the dimension for config, both scaled_* are 0. Apparently, someone on Apple Dev Team decided to verify the size of data and the pass-in size, so shit happened... #47
I've confirmed with Apple, that this is indeed the case. Now they consider this behaviour as correct, when the size passed to CGDataProviderCreateWithData
is 0.