On 10 Aug 2012, at 09:09, Fulbert Boussaton <4...@flubb.net> wrote:

> Hi everyone,
> 
> on iOS, I was using the following "immediate CG code" to display hundreds 
> procedural sprites :
> 
> CGContextSetShadow(Ctx, CGSizeMake(3, 4), 3.0f);
> CGMutablePathRef      ShapePath = CGPathCreateMutable();
> CGPathAddArc(ShapePath, &CGAffineTransformIdentity, radius+3, radius+3, 
> radius, 0, deg2rad(360), YES);
> CGContextSetStrokeColorWithColor(Ctx, [strokeColor CGColor]);
> CGContextSetFillColorWithColor(Ctx, [fillColor CGColor]);
> CGContextSetLineWidth(Ctx, strokeWidth);
> CGContextAddPath(Ctx, ShapePath);
> CGContextDrawPath(Ctx, kCGPathFillStroke);
> CGPathRelease(ShapePath);
> 
> Ctx is the current context and the sprite is a filled circle with a shadow.
> 
> Of course, an iPad was *really* slow to draw all of these, even if each one 
> represents 32px * 32px. So I optimized it using CGLayerRef stored in a 
> NSdictionary and, yes, it was a lot faster.
> 
> But still, it's not really satisfying, and I'm sure something better can be 
> done. Do any of you got any idea ? I'm kind of stuck in the CG documentation. 
> Is there a book specifically dedicated to CG optimisation ? (I know a WWDC 12 
> presentation talks about CG optimisation but haven't had time to spare yet).

So you have a performance problem. You used Instruments to diagnose it, yes? 
What did you learn?


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to