Re: I have an idea how to handle this, looking for feedback.... Re: NSImageCell Optimization.
Re: I have an idea how to handle this, looking for feedback.... Re: NSImageCell Optimization.
- Subject: Re: I have an idea how to handle this, looking for feedback.... Re: NSImageCell Optimization.
- From: Steven Kramer <email@hidden>
- Date: Fri, 21 Jan 2005 10:48:25 +0100
Op 21-jan-05 om 7:20 heeft James Andrews het volgende geschreven:
I would take my array of NSImageCells and figure out how many rows I
need to draw. based on the cell size and the view frame size. Then I
would create an array of arrays that are the length of the number of
columns in the calculated matrix. Using the value of the scroller I
could then decide what images to draw to te screen. This way instead
of loading 67 images I could be drawing maybe 15 or 20. Reducing the
overhead by 2/3s. I was also looking at NSImageRep some, and think
that may help as well, but I need to figure out how it works before I
can say for sure.
I think there's a far simpler solution. You could see if
initByReferencingFile works for you
(<http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/ObjC_classic/Classes/NSImage.html#//apple_ref/doc/uid/
20000344/initByReferencingFile_>).
Otherwise, what you want is notification when a cell is about to be
drawn, so you can load the image 'just in time'. In a matrix, I think
the only way to achieve this is to subclass NSCell and add extra
information to it (like a filepath, or an NSImage* initialized using
initByReferencingFile. Use this information to load the image when the
cell's drawInteriorWithFrame:inView: is called. I used the latter
approach and it performs admirably.
Regards,
Steven Kramer
--
email@hidden
http://sprintteam.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden