I will just bring the Apple Doc and explain:
@property BOOL shouldRasterize
When the value of this property is YES, this layer is equally rendered as a bitmap in the local coordinate space, and then compiled to the destination with any other content. Shadow effects and any filters in the filter property are rasterized and included in the bitmap. However, the current opacity of the layer is not rasterized. If the rasterized bitmap needs to be scaled during layout, the filters in the minificationFilter and magnificationFilter properties are applied as needed.
So basically, when the isRasterize parameter is set to YES, each pixel that will make up the layer is computed, and the entire layer is cached as a bitmap.
- When will you benefit from this?
When you only need to draw it once. This means that you just need a โsimpleโ animation (like moving, transforming, scaling ...), because CoreAnimation will use this layer without redrawing each frame. This is a very powerful feature for caching complex layers (with shadows and angular radius) in combination with CoreAnimation.
- When will he kill you in frame rate?
When your layer is re-rendered many times because at the top of the drawing, which is already taking effect, shouldRasterize will process all the pixels to cache the bitmap image data.
So, the real question that you should ask yourself is: "On which layer do I apply shouldRasterize to YES? And how often does this layer redraw?"
Hope this was clear enough.
apouche Jul 17 '12 at 12:35 2012-07-17 12:35
source share