| Electronic Components Datasheet Search |
|
AN1368 Datasheet(PDF) 30 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
AN1368 Datasheet(HTML) 30 Page - Microchip Technology |
|
30 / 34 page ![]() AN1368 DS01368A-page 30 2011 Microchip Technology Inc. APPENDIX B: DOUBLE-BUFFERING Manipulating pixels on the screen requires direct writes to the frame buffer. While these changes are being executed, the screen is also refreshed. This means that the changes are displayed immediately as the frame buffer is being updated. This is not a suitable scheme when the changes are slow, for example, decoding an image or having a large number of widgets on a screen. The display may appear slow in that case and can cause user dissatisfaction. One solution to this problem is to use a double-buffering scheme supported by the Microchip Graphics Library. In this scheme, the changes are not directly written to the frame buffer, but instead, they are written to a separate buffer, called the ‘Draw Buffer’. After all the changes are made, the draw buffer and frame buffer are exchanged. Now the draw buffer becomes the frame buffer, and because of all the changes drawn there, the changes appear spontaneous to the user. Of course, there will be a delay, as all the changes have to be written to the draw buffer before displaying it. This delay is generally more tolerable than displaying the changes slowly. After exchanging of the buffers, the latest buffer (which is now the frame buffer) is copied to the new draw buf- fer in the background, then the new draw buffer is in sync with what is being displayed. New changes are then written to the draw buffer and the cycle continues. As the double-buffering scheme uses two buffers, the RAM requirement will double. In the Microchip Graphics Library, if double-buffering is enabled, the frame buffer and draw buffer are exchanged after the changes of all the widgets on a screen are done (i.e., the new screen appears after the whole screen is updated and not after updating an individual widget). The workflow of double-buffering is as follows: 1. In the initial stage, the draw buffer and frame buffer have the same contents, as shown in Figure B-1. FIGURE B-1: INITIAL STAGE 2. In the drawing stage, only the draw buffer is modified, and therefore, the frame buffer is not visible to the user, as shown in Figure B-2. FIGURE B-2: DRAWING STAGE 3. In the swap stage, the draw buffer is swapped with the frame buffer (by exchange of pointers), as shown in Figure B-3. FIGURE B-3: SWAP STAGE 4. In the final stage, the frame buffer is copied to the draw buffer, so the buffers have the same contents, as shown in Figure B-4. FIGURE B-4: FINAL STAGE 5. The workflow cycle continues. When to Use Double-Buffering? Use double-buffering when: • There are large numbers of widgets on a screen • The decoding and displaying of images are required • The display resolution is larger than the WQVGA, even if the above points do not hold true When Not to Use Double-Buffering? Do not use double-buffering when: • The immediate display of changes is required. For example, plotting a graph. • The RAM available for display is limited. • The display resolution is smaller than the WQVGA (this is not a hard rule). How to Use Double-Buffering? Double-buffering can be used as follows: • Enable double-buffering by defining, USE_DOUBLE_BUFFERING in the GraphicsConfig.h . • See the section on double-buffering in the Microchip Graphics Library Help file for code examples. Draw Buffer Frame Buffer Draw Buffer Frame Buffer Draw Buffer Frame Buffer Exchange Frame Buffer Draw Buffer Copy |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |