... | ... | @@ -8,6 +8,34 @@ Table of Contents |
|
|
|
|
|
## Overview
|
|
|
|
|
|
In the development of a GUI app, we often need to update an area on the
|
|
|
screen multiple times just for a user input. For example, if the user
|
|
|
presses the up and down keys, the highlighted item in the list box will
|
|
|
change. At this point, the program should perform the following operations:
|
|
|
|
|
|
1. Erase the original highlighted item with the background color of
|
|
|
a normal item;
|
|
|
1. Draw the text of the original highlighted item with the foreground
|
|
|
color of the normal item;
|
|
|
1. Erase the new highlighted item with the background color of the
|
|
|
highlighted item;
|
|
|
1. Draw the text of the new highlighted item with the foreground color
|
|
|
of the highlighted item.
|
|
|
|
|
|
This frequent drawing will cause the screen to flicker if we don't do
|
|
|
any special processing.
|
|
|
|
|
|
Generally, we can use one of the following ways to eliminate this flicker:
|
|
|
|
|
|
1. Create a memory DC and draw content to the memory DC first, then
|
|
|
call `BitBlt` to blit the content to screen.
|
|
|
1. Use MiniGUI's double buffer main window. This is essentially the
|
|
|
same as the first method.
|
|
|
1. Use the new synchronous update mechanism introduced in MiniGUI 3.2.x.
|
|
|
|
|
|
This documents describes how to the synchronous update mechanism to
|
|
|
reduce screen flicker.
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
- Including option `--enable-syncupdate` when configuring MiniGUI.
|
... | ... | @@ -31,3 +59,4 @@ the screen flicker. However, it has the following restrictions: |
|
|
Therefore, for modern graphics stack (system shipped with a GPU),
|
|
|
the better way is using off-screen surface and exploiting the
|
|
|
hardware acceleration as far as possible.
|
|
|
|