开发者

How to accelerate quartz 2d

开发者 https://www.devze.com 2023-01-23 15:12 出处:网络
I have the scene stored in array as collection of shapes that is represented by sequence of points. I\'m drawing this scene with CGContextMoveToPoint, CGContextAddLineToPoint, CGContextSetFillColorWit

I have the scene stored in array as collection of shapes that is represented by sequence of points. I'm drawing this scene with CGContextMoveToPoint, CGContextAddLineToPoint, CGContextSetFillColorWithColor and CGContextFillPath functions. The problem is that i need to redraw scene on timer event with short interval (0.01 sec) and the scene redrawing is very slow. Is there a开发者_如何转开发 way to accelerate this stuff? Or only OpenGLES can help me?


Quartz 2D (Core Graphics) graphics are not accelerated on the iPhone. Path fills are likely CPU bound as well. If you want hardware acceleration, you'll have to convert your scene to OpenGL ES (triangle strips and textures). Even using OpenGL ES, you will have to optimize your graphics fairly well to get a 60 Hz frame rate (0.017 sec).

One other possibility is to pre-render your shapes into CALayers, and just animate the layers (scale, rotate, overlay, hide, etc.) CALayer animation is also hardware assisted.

0

精彩评论

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

关注公众号