Dirty GUIs
Today I had a go at trying to improve the speed of rendering the GUI. Previously I had been copying the entire screen to the framebuffer every update – that’s not very efficient.
Now windows can be dirty, that is when they’ve changed. So now each frame if less than 75% of the screen is dirty it will only redraw the windows that have changed if not, it will just draw the whole screen.
It’s difficult because windows overlap, if a window completely hides another window that is easy, just don’t draw it, but if the window sticks out on one side, the calculations needed to determine which bits are seen vs which bits are not seems to be more resource intensive than just displaying the whole screen.
The trade off is drawing each dirty window, even if they overlap (meaning the overlapped pixels get drawn twice), unless the sum of the area is more than 75% at which point we’re not really gaining anything (and quiet possibly could be slowing things down) we just draw the whole screen once.
I’ve also added a download section so you can download an OVA file and check it out yourself (not that you can tell anything has changed this time around – or at least I hope not).