开发者

How to avoid calls to png_read_filter_row and transform_premul_argb_fn in Core Graphics?

I'm having some performance problems with images in my app. I assign a UIImageView to the backgroundView property of a UITableViewCell. The Time Profiler instrument tells me that I'm spending most of my time here:

How to avoid calls to png_read_filter_row and transform_premul_argb_fn in Core Graphics?

My table view has semi-transparent cells to let the background shine through. I know this is not good. But from what I can tell from the Profiler, this is not the bottleneck, right?

png_read_filter_row sounds like if there is some kind of expensive filtering going on.

Also down the bottom, there are 10.6% spent on transform_premul_argb_fn ... which sounds like some kind of scaling. My images are not sca开发者_如何学Cled at all. I use them naturally (i.e. if the display needs 200 x 100, it gets 200 x 100. If it's retina, it gets a 400 x 200 version).

And finally, 6.7% on gzopen which sounds strange. My images reside in the Documents directory, not in the zipped App Bundle.

Maybe someone with deep Core Graphics knowledge can tell what those calls mean and how to avoid them?


Make sure your images are uncompressed after loading. Use the following code from http://markmail.org/message/vav7a5khncak2u3h

UIGraphicsBeginImageContext(image.size);
[image drawAtPoint:CGPointZero blendMode:kCGBlendModeCopy alpha:1.0];
UIImage *decompressed = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜