我在调用iOS 4中的CGContextDrawLayerAtPoint时出现了一些性能问题,这些问题似乎并不存在于先前版本的操作系统中。iOS 4.0中的CGContextDrawLayerAtPoint中的性能问题
我在drawRect调用期间将从CGBitmapContextCreate创建的位图上下文中获得的图层复制到我的视图的上下文中。视图和位图的大小相同。在表明我花的CGContextDrawLayerAtPoint更多的时间比我上运行OS 3.2设备
CGBitmapContextCreate(NULL, width, height, 8, width * 4, genericRGBSpace, kCGBitmapByteOrder32Host | kCGImageAlphaNoneSkipFirst);
仪器:
位图与创建。事实上堆栈跟踪指示以下堆栈跟踪服用的时间更高百分比:而下3.2节目
argb32_image_mark_rgb32
argb32_image
ripl_Mark
ripl_BltImage
ripc_RenderImage
ripc_DrawLayer
CGContextDelegateDrawLayer
CGContextDrawLayerAtPoint
随着时间的低得多的百分比运行相同的代码
argb32_sample_argb32
argb32_image_mark
argb32_image
ripl_Mark
ripl_BltImage
RIPLayerBltImage
ripc_RenderImage
ripc_DrawLayer
CGContextDelegateDrawlayer
CGContextDrawLayerAtPoint
。我不确定为什么在iOS 4上调用argb32_sample_argb32以及它在做什么 - 将现有数据抽样到新的缓冲区中?我不知道为什么这是必要的。视图和位图大小相同,并且没有执行缩放。
任何洞察到这一点,将不胜感激。