I'm currently using the open-source libPNG library to read & decompress bitmaps. It works great on Android, OS X, and Win32 but for some reason performs 30X slower on iOS devices. The same libPNG source code tree (unmodified) is used on all platforms.
Several things I found in the Cocos2D forums lead me to believe it's an issue with the zlib implementation on iOS, but I've tried using both stb_image and LodePng to avoid zlib and those libraries actually performed EVEN WORSE than libPNG!
Is there some special way of building libPNG "properly" for iOS? If not then what is libPNG doing that's SO much slower on iOS? Why would stb_image also be slow/slower? Is there a known way to work around or correct this problem?
Thanks, AF
CGImageCreateWithPNGDataProvider
, then create a bitmap context (CGBitmapContextCreate
) and draw the PNG into the bitmap context. This way you can avoid LibPNG altogether. – Dietrich Epp May 17 '12 at 22:14