Re: No regions, reason for Cocoa's inefficient window resizing?
Re: No regions, reason for Cocoa's inefficient window resizing?
- Subject: Re: No regions, reason for Cocoa's inefficient window resizing?
- From: Timothy Ritchey <email@hidden>
- Date: Fri, 13 Sep 2002 09:29:32 -0500
I've always just used:
[self inLiveResize]
In my drawing routines to determine when I am in the exact situation
you posit. I cache the old rect size in the previous call, and then can
compute the newly exposed regions myself.
Cheers,
tim
On Friday, September 13, 2002, at 01:39 AM, Henk Kampman wrote:
>
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.
_______________________________________________
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.