Re: Overlaying views to optimise drawing
Re: Overlaying views to optimise drawing
- Subject: Re: Overlaying views to optimise drawing
- From: Allan Odgaard <email@hidden>
- Date: Tue, 27 Jul 2004 21:10:31 +0200
On 27. Jul 2004, at 20:11, Ken Tabb wrote:
I'm considering offloading this "meta-drawing" (selection handles,
bounding boxes, and the rubber band rectangle when drag-selecting
multiple objects) to another view which is drawn over the view
containing the graphics objects. This would mean, if the user is only
selecting / deselecting objects, that the main view wouldn't need a
redraw, I'd only need to redraw the "meta-drawing" view, which is a
much more lightweight thing to have to do.
This would indicate that all views have their own off-screen buffer,
which is not the case, and the reason why NSView has an isOpaque method
(to skip redrawing the views that it cover).
This is however the case with windows, so in theory you could place a
transparent window ontop of your view, which would draw the selection
etc. -- not that I'd recommend it though ;)
[...] I'm aware that having transparent views isn't necessarily
renowned for gaining performance, but it's not that I need FPS
performance, just that single redraws in the graphics view require an
amount of computation, so I'd rather do it as infrequently as
possible.
I'm a bit confused here -- so what is it that you want to gain?
If you have a static background on which you render the selection, and
rendering the static background each time is expensive, I'd suggest
either a) render the background to an NSImage which you use in
drawRect: or b) use NSWindow's cacheImageInRect: before you draw the
selection, so that you can clear it again with a simple
restoreCachedImage.
_______________________________________________
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.