I am seeing dramatic differences in drawing speed depending 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?