Note that there are some explanatory texts on larger screens.

plurals
  1. POPerfromance Issues In CGContextDrawLayerAtPoint in iOS 4.0
    text
    copied!<p>I'm having some performance issues calling CGContextDrawLayerAtPoint in iOS 4 that didn't seem to exist in previous version of the OS.</p> <p>I'm copying a layer obtained from a bitmap context created with CGBitmapContextCreate to my view's context during a drawRect call. The view and the bitmap are the same size. </p> <p>The bitmap was created with:</p> <pre><code>CGBitmapContextCreate(NULL, width, height, 8, width * 4, genericRGBSpace, kCGBitmapByteOrder32Host | kCGImageAlphaNoneSkipFirst); </code></pre> <p>Instruments in indicating I'm spending more time in CGContextDrawLayerAtPoint than I was on devices running OS 3.2. In fact the stack trace indicates the following stack trace taking a higher percentage of time:</p> <pre><code>argb32_sample_argb32 argb32_image_mark argb32_image ripl_Mark ripl_BltImage RIPLayerBltImage ripc_RenderImage ripc_DrawLayer CGContextDelegateDrawlayer CGContextDrawLayerAtPoint </code></pre> <p>whereas the same code running under 3.2 shows</p> <pre><code>argb32_image_mark_rgb32 argb32_image ripl_Mark ripl_BltImage ripc_RenderImage ripc_DrawLayer CGContextDelegateDrawLayer CGContextDrawLayerAtPoint </code></pre> <p>with a much lower percentage of time. I'm not sure exactly why argb32_sample_argb32 is being called on iOS 4 and what it's doing - sampling the existing data into a new buffer? I'm not sure why this would be necessary. The view and the bitmap are the same size and no scaling has been performed. </p> <p>Any insight into this would be appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload