Re: Cocoa Clipping != Performance?
Re: Cocoa Clipping != Performance?
- Subject: Re: Cocoa Clipping != Performance?
- From: "Erik M. Buck" <email@hidden>
- Date: Wed, 23 Jan 2002 16:49:53 -0600
I have not seen the particular impact that you are reporting, but I think I
can squash your hypothesis for the cause. I don't think Quartz vector or
image compositing is ever optimized by graphics hardware. The final BLT
from you window's backing store to the graphics card's frame buffer may be
optimized, but even that is impacted by issues like window shadows and the
features of the "Quartz Compositer" which is responsible for tiling the
backing stores for various windows into the graphics card's frame buffer in
VRAM.
Clipping is happening to all image composites within your window. Complex
clipping paths may degrade performance, but just clipping to the window's
content view's frame is not. That happens automatically for all operations
and can not easily be turned off.
I am not sure what you are talking about regarding image subviews. In a
game, you probably do not want to use lots of overlapping views. It is
better to do all drawing in the -drawRect: of a single view. If you have
controls overlapping game elements, the slowdown that you see is probably
the result of the controls being redrawn as well as your game graphics. If
only the game graphics are drawn (because nothing overlaps) then a lot of
work is saved.
Ultimately, you probably want to use OpenGL for game performance.
Regarding views:
- Sibling views should not be overlapped. (this is not supported and if it
works you are just lucky)
- If a view containing sub views is re-displayed, some of the subviews are
almost certainly re-displayed also.
- Use QuartzDebug to find extraneous drawing.
- NSView is a heavy weight class. That is why NSCell exists. See
http://www.stepwise.com/Articles/Technical/NSCell.html
As an aside, Quartz may very well implement the Postscript imaging model,
but Display Postscript was a lot faster. My company sells a high end
animation development tool that performs much better on a 266 Mhz Pentium
running Windows NT and Openstep 4.2 with DPS than it does on a 400 Mhz G4
running OS-X with Quartz. I love the Quartz imaging model. Its current
implementation has performance problems.
----- Original Message -----