Right after Build 5550 was released work on the new GUI rendering began.
From the very first SkyOS version up until Build 5550 the GUI redraw handling was implemented in following way:
- Whenever an area of a window got exposed, or the window content changed, the redraw routine from the widget was called
- The widget private GraphicContext was used to draw the widget itself. The drawing was done directly onto the screen. GIWM clipped every drawing operations to the visible rectangles of the window
This method had some drastic disadvantages:
- High CPU usage. The redraw which could happen a few hundred times per second required a lot of CPU power
- Flickering. Redrawing the widget "flickered" if the widget itself didn't implement double buffering
- Speed. The frequent data transfers between CPU and VRAM over the slow PCI bus slowed down the entire GUI
The new rendering engine
The main difference is that the window content is now buffered. The drawing operations don't draw on the screen anymore, but they draw into a application window private layer. The only time a widget has to redraw itself now, is:
- When the widget gets created
- When the size changes
- When the actual displayed content must be changed
The part which is responsible for bringing the actual window content onto the screen is the GIWM Composer. This plugin based Composer takes the offscreen layers from every window and composed the actual desktop layout.
Before sending the window content to the screen the Composer may perform various operations on the layer surface.
These operations (which are implemented in loadable plugins) may perform things like Alpha blending, Color conversion, Scaling, etc. (On a side note, there is also an interesting "debug" plugin which slowes down the redraws and draws a red rectangle about regions which are going to be updated.)
To conclude, this change has following advantages:
- Speed. Because not utilizing the PCI/AGP bus that much, the GUI gained a dramatical speed increase.
- Composing. A window content can now be blitted with various effects. (Alpha, translucent, colorize, scale, ....)
- CPU Usage. Much lower CPU Usage because of lesser widget redraw operations
- Layers. Applications can access the content from other windows. For instance, the Application Manager (ALT+TAB) displays a preview of the applications
No source changes in your applications are required for all these changes.
Proof-of-concept implementation of the window transparency and window shapes (window shadows disabled):
Proof-of-concept implementation of the new application manager showing live previews of opened applications: