The ClearBackground function is designed so you can specify the background color with the three arguments r, g and b at execution time. Assume the background will be fixed to a specific color. In this case, it might seem unnecessary to do a dynamic display list, and that the load at execution time could be reduced by defining this as a static display list. However, there is a reason why this display list is defined dynamically. In fact, it is impossible to substitute a static display list.
List 3-4 See basic3 "graphic.c" | |
|
If you look carefully at the contents of ClearBackground, you will see that the symbol nuGfxCfb_ptr is referenced. nuGfxCfb_ptr is a pointer managed by NuSystem that is always set to point to the next framebuffer for rendering. Since this pointer points to a different framebuffer in every rendering frame, it cannot be determined at compile time. Consequently, it is impossible to implement ClearBackground as a static display list.