I am currently implementing a VNC Server using MenuDesigner.
For this, it would be great if it where possible to request a partial redraw of the screen contents.
Hi,
the idea of having a partial redraw is interesting, but should, in my opinion, not be part of the core interpreter to keep the system small and simple.
However an implementation could be an interesting extra. I would implement partial redraw in the menu_screen_flush function:
1. Have a copy of the screen of the previous menu_screen_flush function
2. Check which pixels or bytes have been changed and only transfer them (together with the position) to the display or over the network.
3. Copy the current screen for the next menu_screen_flush
Of course this will result in two disadvantages:
1. There has to be RAM for two instead of one screen. If this is a problem depends on the hardware resources the system has.
2. Transferring an index for each modified pixel or byte will result in an significant overhead. My guess is that as soon as 1/3 or more of the screen changes, this will be slower than sending the whole screen. A more sophisticated algorithm could find whole rectangles which were changed, but this wont be trivial.
I could provide an example, as soon as I have some time.
An alternate approach could be to disable the menu_screen_clear() call in the menu_redraw() function (and add it whenever a screen changes).
Then only the pixels of the objects are redrawn, however then you have to put white boxes below every text which changes while the same screen is shown, because the text may be sometimes longer or shorter. I had this behavior in the first 1.0 version and came to the conclusion that it was a bad idea. Moreover this does not help as soon as subwindows are visible, because they always need to draw a white box at the beginning.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
the idea of having a partial redraw is interesting, but should, in my opinion, not be part of the core interpreter to keep the system small and simple.
However an implementation could be an interesting extra. I would implement partial redraw in the menu_screen_flush function:
1. Have a copy of the screen of the previous menu_screen_flush function
2. Check which pixels or bytes have been changed and only transfer them (together with the position) to the display or over the network.
3. Copy the current screen for the next menu_screen_flush
Of course this will result in two disadvantages:
1. There has to be RAM for two instead of one screen. If this is a problem depends on the hardware resources the system has.
2. Transferring an index for each modified pixel or byte will result in an significant overhead. My guess is that as soon as 1/3 or more of the screen changes, this will be slower than sending the whole screen. A more sophisticated algorithm could find whole rectangles which were changed, but this wont be trivial.
I could provide an example, as soon as I have some time.
An alternate approach could be to disable the menu_screen_clear() call in the menu_redraw() function (and add it whenever a screen changes).
Then only the pixels of the objects are redrawn, however then you have to put white boxes below every text which changes while the same screen is shown, because the text may be sometimes longer or shorter. I had this behavior in the first 1.0 version and came to the conclusion that it was a bad idea. Moreover this does not help as soon as subwindows are visible, because they always need to draw a white box at the beginning.