Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CGContextSetLineWidth / performance issues



Hi

My code, below, renders a complex path (around 800 points) using quartz, and works pretty well when CGContextSetLineWidth(ctx, _strokewidth) is set to 1.0f. However as I increase _strokewidth then performance becomes significantly worse, infact unusable. Ultimately I want to apply CI filters and so forth...

Is there an optimization route for rendering lines >1.0f ?

Thanks

Nick


- (void)render:(void*)dst data:(void*)data { float w = _width; float h = _height; Float32* buffer = nil; UInt32 size = nil; BufferRecordPtr br = (BufferRecordPtr)data; buffer = br->buffer; size = br->size;

    CGContextRef ctx = (CGContextRef)dst;
    {
        CGContextSetRGBFillColor(ctx, 0.0, 0.0, 0.0, 1.0);
        CGContextFillRect(ctx, CGRectMake(0, 0, w, h));

if(buffer != nil && size != nil)
{
float xstep = w / size;
CGContextSetShouldAntialias(ctx, _antialias );
CGContextSetLineWidth(ctx, _strokewidth);
CGContextSetRGBStrokeColor(ctx, [_forecolor redComponent], [_forecolor greenComponent], [_forecolor blueComponent], _alpha);
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, 0.0, (float)((buffer[0]*_size)/ _scale)+h/2);
UInt32 i;
for (i = 1; i < size; i+=_resolution){
CGContextAddLineToPoint(ctx, (float)xstep * i, (float)((buffer[i]*_size)/_scale)+h/2);
}
CGContextStrokePath(ctx);
}
}
}



_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartz-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.