title: -[CALayer setNeedsDisplayInRect:] causes the whole layer to be redrawn
body: <p>I'm subclassing CALayer to provide my own drawing in method. For optimization I call <code>-[MyLayer setNeedsDisplayInRect:]</code> instead of <code>-[MyLayer setNeedsDisplay]</code>. In the drawing method I get the rect which should be redrawn via <code>CGContextGetClipBoundingBox()</code>.</p>
  
  <p>If I use this layer as the <em>base</em> layer of an UIView every thing works as expected. The problem arises, as soon as I use my custom layer as a sublayer of an other CALayer. Than <code>CGContextGetClipBoundingBox()</code> always returns the rect of the bounds of that layer.</p>
  
  <p>Any ideas?</p>
  
  <p>[EDIT]</p>
  
  <p>It seems, that there is no guaranty, that the content of the CALayer is cached and only the dirty part gets redrawn. I did a small test and stored the rect that needs display as a separate property. The result was, that only this part was visible on the screen.</p>
  
  <p>I'll now render to an image context and keep that image as a cache. In the draw method I'll only display the cached image.</p>