• 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: NSView and rectangle management
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView and rectangle management


  • Subject: Re: NSView and rectangle management
  • From: Cameron Hayne <email@hidden>
  • Date: Tue, 25 Jun 2002 13:15:27 -0400

Paul Fox <email@hidden> wrote:
Consider this: I have an NSView, with two children. These children
implement my scrollbar (placed at the left and bottom of the
window). Now if I draw into this view, I currently have to send
a setNeedsDisplay: to the two children views, causing them to redraw themselves
in their entirety. Visually this is ok, but CPU wise, it makes the
machine run like a dog with lead boots.

I may be missing something, but it seems to me that you ought to have an NSView with *three* children:
1) your content view (the one in which you draw)
2) your horizontal scrollbar
3) your vertical scrollbar

I.e. you should try to avoid drawing directly in a view which has children. Instead have a "container" view which does nothing more than hold the child views, and do your drawing in the child views.
Note also that you probably want to set the isOpaque flag in your content view (for efficiency).
I have ported my own X/Motif app to Cocoa and have seen a small gain in performance (compared to running the X /Motif version on the same machine - with the OroborOSX X server).

... Cameron
--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSView and rectangle management
      • From: Brent Gulanowski <email@hidden>
  • Prev by Date: NSTextStorage Problems - re-post
  • Next by Date: Re: My object won't alloc.
  • Previous by thread: Re: NSView and rectangle management
  • Next by thread: Re: NSView and rectangle management
  • Index(es):
    • Date
    • Thread