开发者

iPhone: How does CGContextConcatCTM affect CGContextDrawImage speed?

I am seeing dramatic differences in drawing speed dep开发者_Go百科ending on whether I transform my context.

- (void)drawLayer:(CALayer *)myLayer inContext:(CGContextRef)context {
 NSDate *startDate = [[NSDate date] retain];

 //CGContextConcatCTM(context, finalTransform);
    CGContextDrawImage(context, imageRect, imageRef);

 NSLog(@"%f", [[NSDate date] timeIntervalSinceDate:startDate]);
}

Average output:

- With transform = 0.0125

- Without transform = 0.000175

The image is about 100x100 and I am transforming it be to slightly less than iPad screen resolution. The pixel data of this image often needs to be updated which is why performance is an issue.

Is this dramatic difference in drawing time (more than 50 times faster) to be expected? Is there a better way to apply a scaling transform when drawing to the screen?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜