Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
99 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Introduction
 Saving Windows
 Loading Windows
 Resource Editors
 Subclassing
 Speeding Up
 GUI Rendering

 Conclusion

 Printable version

 


  The Series

 Part I
 Part II
 Part III
 Part IV

 

Speeding Up GUI Rendering

Here'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.


Next : Conclusion