Hi everyone
I have a small run speed problem. On load, I generate a CGMutablePath containing at least 1000 points. I want to scroll this path on the screen, so I use this kind of code :
-(void) drawRect:(CGRect)rect {
/*
Here, I have a timer calling drawRect 60 times per second.
There's also code for the scale and currentTime, based on
an MP3 playback (AVAudioPlayer);
*/
CGContextRef ref = UIGraphicsGetCurrentContext();
CGContextClearRect(ref, [self frame]);
CGContextSaveGState(ref);
CGContextTranslateCTM(ref, s.width/2+currentTime, 1);
CGContextScaleCTM(ref, scale, 1);
CGContextAddPath(ref, myGraphPath);
CGContextSetRGBFillColor(ref, .1, .1, .1, .8);
CGContextFillPath(ref);
CGContextRestoreGState(ref);
}
The problem is that it's a bit slow, not very much, but as I need to add a whole lot more of graphic code... I was wondering if the device is drawing the whole path (once the scale is applied, the path is about 10.000 pixels wide), or just the part visible on the screen ? What can I do to optimize this ?