• 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
No regions, reason for Cocoa's inefficient window resizing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No regions, reason for Cocoa's inefficient window resizing?


  • Subject: No regions, reason for Cocoa's inefficient window resizing?
  • From: Henk Kampman <email@hidden>
  • Date: Fri, 13 Sep 2002 08:39:41 +0200

The first thing a Classic MacOS user notices on MacOSX is the slow/laggy window resizing and redraws.
Double buffering alone cannot be the reason for this, I often used double buffering in Classic MacOS apps and it caused no noticable slowdown.

After some experimenting with Cocoa I think I've found a (small) piece of the puzzle.

In Cocoa the view update area is described as a rect instead of a region(the Classic MacOS way), in my opinion this has some serious performance implications, especially on window resizing.

Suppose I have a window that contains a FIXED SIZED (0x,0y,200h,200w) view but the window only shows (100h,100w)
When I resize the window to (110h,110w) the view drawRect method is called with a rect (0x,0y,110h,110w) because there is no way describe the real dirty area as a single rect.

Even worse when I resize the same window to (0x,0x,90h,90w) drawRect is called with rect (0x,0x,90h,90w)! Why is that? Remember this is a fixed sized view so no redraw is needed.

Selective drawing is not as effective as in Classic MacOS because you cannot determine the actual dirty region from a single rect.

I'm not sure about the folIowing but I also suspect that Cocoa/Windowmanager clips redraws using the same mechanism, causing a lot of unneeded data movement.

Some numbers.

Assume that the sample view I mentioned earlier erases its background (16 bits color) like this

- (void)drawRect:(NSRect)rect {
[[NSColor whiteColor] set];
NSRectFill(rect);
}

Current Cocoa
A resize to (0x,0y,110h,110w) would touch 24.2KB.

If Cocoa would use regions
A resize to (0x,0y,110h,110w) would only touch 4.2KB

A big improvement for such a small window.


Henk
_______________________________________________
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: No regions, reason for Cocoa's inefficient window resizing?
      • From: Timothy Ritchey <email@hidden>
  • Prev by Date: Re: setFrameUsingName , setFrameAutosaveName
  • Next by Date: Easy/Quick Question...
  • Previous by thread: Re: setFrameUsingName , setFrameAutosaveName
  • Next by thread: Re: No regions, reason for Cocoa's inefficient window resizing?
  • Index(es):
    • Date
    • Thread