开发者

Objective C (iPhone): CGContextDrawImage is too slow

开发者 https://www.devze.com 2023-03-07 23:31 出处:网络
I\'m writing a program that does various types of image processing while getting pictures at a rate of 15 FPS. When I comment out the code that prints out the images and only leave in the processing,

I'm writing a program that does various types of image processing while getting pictures at a rate of 15 FPS. When I comment out the code that prints out the images and only leave in the processing, I find that I can print images at a maximal speed of 13/14 FPS.

However, upon calling CGContextDrawImage 6 times in a row (6 different images), my drawing rate drops down to 6/7 FPS. I was wondering if anyone knows an alternative 开发者_StackOverflow中文版to CGContext's CGContextDrawImage such that printing the image takes minimal time.


scale it to the right size and/or render intermediates to an offscreen cached context (e.g. composite and merge multiple images), which can be easily copied. make sure that your image uses an optimal layout -- assuming you render it multiple times. only draw when needed. profile to see what takes the most time. determine what needs to be drawn -- if you have 6 images and they overlap, do not draw portions which are not visible.

0

精彩评论

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

关注公众号