CGContextDrawImage is very slow on iPhone 4

I am using CGBitmapContextRef for a large mutable image. Than I draw one part in UIView.drawRect. This works well on the iPhone 3GS - 17FPS. But on iPhone 4, calling the subj method is very slow - and the overall FPS is 1.5!

The profiler says: CGSBlendBGRA8888toRGBA8888 is called on 3GS, which takes 23% of the total time. on 4G, the same code calls argb32_sample_RGBA32 / argb32_image_mark, which takes ~ 90%. Wow!

The color space for the bitmap is CGColorSpaceCreateDeviceRGB. And the creating flag is kCGImageAlphaPremultipliedLast.

What can I do to improve performance on the iPhone 4? Any suggestions?

+2
iphone bitmap
source share
1 answer

Try to install:

CGContextSetInterpolationQuality(myBitmapContext, kCGInterpolationNone); 

on your bitmap. kCGInterpolationLow is another option.

Another way that might help is to add CALayer to your view and set the contents of CALayer in your bitmap, rather than drawing a bitmap inside the drawRect view.

+8
source share

All Articles