• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: I have an idea how to handle this, looking for feedback.... Re: NSImageCell Optimization.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSImageCell Optimization. (From: James Andrews <email@hidden>)
 >I have an idea how to handle this, looking for feedback.... Re: NSImageCell Optimization. (From: James Andrews <email@hidden>)

  • Prev by Date: Re: I have an idea how to handle this, looking for feedback.... Re: NSImageCell Optimization.
  • Next by Date: Making new targets in Xcode for Command Line App.
  • Previous by thread: Re: I have an idea how to handle this, looking for feedback.... Re: NSImageCell Optimization.
  • Next by thread: interface builder renaming my file
  • Index(es):
    • Date
    • Thread