Speeding Up GUI RenderingHere's another miscellaneous tidbit for you that will help you if you're trying to speed up your GUI drawing. The key concept here, just like with optimizing any other drawing routine, is simply "don't draw what you don't need to." By default, the GUI spends a lot of its time drawing stuff that hasn't changed. You can, however, optimize this a little, by telling the GUI to only draw windows that are "dirty." The windows set their dirty flag whenever their appearance needs to change, and they clear the dirty flag once they're drawn. There's one catch – since our GUI controls might be transparent, when a control is marked as dirty, its parent window must also be marked as dirty. That way, when it draws itself, the background is still intact, since the parent window has also just redrawn.
|
||||||||||||||||||||