> On 26 Jun 2015, at 9:10 am, Raglan T. Tiger <r...@crusaderrabbit.net> wrote:
> 
> I have a list of generic bitmaps that are to be transformed to NSImages.  The 
> list can be long, I haven limits on it.
> 
> Here is the code I use to populate an NSMenu that gets set into an 
> NSPopUpButton.
> 
> I need to speed this process up ... any suggestions?


Instead of creating a CGBitmapContext to wrap your pixel buffer, then turning 
it into a CGImage, then copying it to an NSImage, why not create a 
NSBitmapImageRep directly wrapping the original buffer? Then it can be added to 
an NSImage as a rep without any copying being necessary at any point. The 
slowness here (which you imply is a problem) is very likely due to the fact 
that you are having to copy each bitmap twice (once when you create the 
CGImage, the second time when you blit that into the NSImage).

—Graham



_______________________________________________

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