Re: isOpaque (was: Use -display INSTEAD)
Re: isOpaque (was: Use -display INSTEAD)
- Subject: Re: isOpaque (was: Use -display INSTEAD)
- From: rsharp <email@hidden>
- Date: Mon, 17 Dec 2001 12:41:06 -0600 (CST)
On Mon, 17 Dec 2001, Christopher Lloyd wrote:
>
I know I'm not supposed to post guesses, but my guess is that adding to
>
SlowView.m:
>
>
-(BOOL)isOpaque { return YES; }
>
>
Will produce better results. The default is NO.
>
>
Non-opaque views need to have their "background view" (opaqueAncestor)
>
redrawn which can involve redrawing other views sitting inside the same
>
background view.
Most definitely. This is a huge performance gain especially if you have
many layers in your view hierarchy. The goal of any rendering pipeline is
to remove redundancy and never draw obscured views.
The engine that my Carbon apps live on is a multi-layer compositing
engine. At some point, I added the "opaque" API to greatly speed up
rendering. I don't have numbers, but I conservatively guess about a 2x to
3x speed boost.
For areas where I really needed speed, I inject a widget in between static
layers and dynamic layers. The special widget basically takes a "screen
shot" of what it covers and that becomes its contents. The widget is then
marked as being opaque. Thus, as my app constantly re-renders the several
dynamic top-most layers, it will potentially hit this opaque widget and
won't look at other layers beneath that one. I realize that this
particular "feature" isn't in the Cocoa widgets, but I'm describing it
here to further illustrate the benefits of "opaque".
Rick Sharp
Instant Interactive(tm)