[英]CATiledLayer and thread safety
我正在测试使用CATiledLayer绘制图像,尽管发生了更多的绘制操作,但它似乎比使用默认图层要快(奇)
在drawRect中,我有:
CGContextRef context = UIGraphicsGetCurrentContext () ;
CGContextSaveGState (context) ;
CGContextTranslateCTM (context, referencePoint.x, referencePoint.y) ;
CGContextScaleCTM(context, zoom * pixelScalingX / SCALE, zoom * pixelScalingY / SCALE) ;
CGContextRotateCTM (context, displayRotation) ;
CGPoint point = CGPointMake(displayCorner.x, displayCorner.y) ;
UIImage *image = [self getChartImage] ;
[image drawAtPoint:point] ;
CGContextRestoreGState(context) ;
我遇到的问题是不可预知的访问冲突在[image drawAtPoint]崩溃。
这向我提出了线程安全问题。
本文提到线程安全
https://developer.apple.com/library/ios/qa/qa1637/_index.html
但似乎表示问题已解决。 似乎并非如此。
我的问题是:
答案是CATiledLayer绘图不是线程安全的。 您只需要使用Core Graphics功能。 没有用户界面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.