Lisp HUG Maillist Archive

Defer redrawing

Hi List,

Is there any way to defer (re)drawing of an output-pane?

I find myself often using this pattern: an output-pane descendent has a read-only property, and a setf method, which sets the slot and calls gp:invalidate-rectangle on the pane. While this works well, if the calling code wants to update multiple slots in the pane, it will be redrawn several times, which is unefficient.

The documentation for capi:with-atomic-redisplay explicitly states that it does NOT defer GP drawing operations, but perhaps there is some other (undocumented?) function?

Of course, one way would be to use a wrapper function, or override invalidate-rectangle for the pane in question. Using a wrapper function would require the calling code to be changed everywhere throughout the project, which would be tedious and error-prone. Overriding invalidate-rectangle would be more elegant, but I am not sure if it would have side effects that I haven't counted for.

Any suggestions?

Thanks!
Erik



_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: Defer redrawing

Erik,

You may want to look at what I did for opengl-pane. I still use gp:invalidate-rectangle, but wrapped it in my own post-redisplay function (https://github.com/massung/lwgl/blob/master/pane.lisp#L136) , which ensures that the pane is clean and will only call gp:invalidate-rectangle if that's the case.

My use-case was multi-threaded, so it might be overkill for you. If everything is being executed from within the CAPI pane process, you should be able to call gp:invalidate-rectangle as many times as you want and only a single display-callback will be issued. The invalidate function is merely telling the OS that a portion of the window needs to be redrawn the next time it gets around to firing off the event to do so.

For example, if you invalidate <10,10> - <20,20>, and then invalidate <40,40> - <50,50>, you *should* get a single display-callback with the bounds of <10,10> - <50,50> and not two separate display callbacks.

Hope this helps,

Jeff M.
Erik Ronström
Monday, January 26, 2015 9:56 AM
Hi List,

Is there any way to defer (re)drawing of an output-pane?

I find myself often using this pattern: an output-pane descendent has a read-only property, and a setf method, which sets the slot and calls gp:invalidate-rectangle on the pane. While this works well, if the calling code wants to update multiple slots in the pane, it will be redrawn several times, which is unefficient.

The documentation for capi:with-atomic-redisplay explicitly states that it does NOT defer GP drawing operations, but perhaps there is some other (undocumented?) function?

Of course, one way would be to use a wrapper function, or override invalidate-rectangle for the pane in question. Using a wrapper function would require the calling code to be changed everywhere throughout the project, which would be tedious and error-prone. Overriding invalidate-rectangle would be more elegant, but I am not sure if it would have side effects that I haven't counted for.

Any suggestions?

Thanks!
Erik



_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Updated at: 2020-12-10 08:33 UTC