I use CGBitmapContextRef for large alterable image. Than I draw one's parts in UIView.drawRect. That's work well on iPhone 3GS - 17FPS. But on iPhone 4 calling subj method is very slow - and total FPS is 1.5!
profiler says that: on 3GS开发者_C百科 invokes CGSBlendBGRA8888toRGBA8888 which takes 23% of total time. on 4G same code invokes argb32_sample_RGBA32/argb32_image_mark which takes ~90%. wow!
Color space for bitmap is CGColorSpaceCreateDeviceRGB. And creating flag is kCGImageAlphaPremultipliedLast.
What can I do for better performance on iPhone 4 ? Any suggestions ?
Try setting:
CGContextSetInterpolationQuality(myBitmapContext, kCGInterpolationNone);
on your bitmap. kCGInterpolationLow is another option.
Another technique that may help is add a CALayer to your view, and to set the CALayer's contents to your bitmap, instead of drawing the bitmap image inside the view's drawRect.
精彩评论