| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
I just coded something fairly similiar (though only with 16384 rectangles). The speed was frustrating. AFAIK you can't do much about it in Cocoa. You can do a little better if you have the possibility to cache the color, and only set them if it changes. I was only drawing black and white blocks and caching the color and avoiding the -set, got me somewhere like a 30% speedup. But a 30% faster snail is still no sprinter...
In the end I used a lot of little views (64) instead of one big view and I "hand draw" everything into one NSBitmapImageRep or one view and blit those during -drawRect. I went from 0.5 fps to "quite sufficient" (>15 fps) with that approach :) It doesn't look quite as pretty though.
One big problem of Cocoa (and maybe even Quartz) with drawing lots of little stuff is that there is too much locking going on. Everytime you call NSRectFill there is a internally lock opened and closed :), which kills your performance. A big improvement would be to expose the locks (probably in graphics context) and feature some non-locking calls, but that's something only Apple can do.
| References: | |
| >Re: Cocoa graphics speed (From: Nat! <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.