Today, when I installed an iOS 4.3 iPad, I suddenly found that all the JPG images in the game were very dark. In fact, JPG became translucent. It was previously run on more than 5.1 systems, so this problem was not found.
After reading the code, we found that it was an error when ccimage set alpha for JPG images.
Solution:
Find the/libs/cocos2dx/platform/IOS/ccimage. MM file.
After opening, find the code:
pImageinfo->hasAlpha = (info == kCGImageAlphaPremultipliedLast) || (info == kCGImageAlphaPremultipliedFirst) || (info == kCGImageAlphaLast) || (info == kCGImageAlphaFirst);
Replace it with the following:
pImageinfo->hasAlpha = ((info == kCGImageAlphaNoneSkipLast) || (info == kCGImageAlphaPremultipliedLast) || (info == kCGImageAlphaPremultipliedFirst) || (info == kCGImageAlphaLast) || (info == kCGImageAlphaFirst) ? YES : NO);
Run the command to check if it is okay.
JPG is generally used to reduce the capacity, so large background images are all in JPG format.
However, one thing you need to know is that the speed of JPG loading is slower than that of PNG loading. Therefore, you must weigh the trade-off between using JPG and other parts.