AN1368
APPENDIX B: DOUBLE-BUFFERING
Manipulating pixels on the screen requires direct writes
to the frame buffer. While these changes are being
3.
In the swap stage, the draw buffer is swapped
with the frame buffer (by exchange of pointers),
as shown in Figure B-3 .
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
FIGURE B-3:
SWAP STAGE
image or having a large number of widgets on a screen.
The display may appear slow in that case and can
cause user dissatisfaction.
Draw Buffer
Exchange
Frame Buffer
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
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 .
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
FIGURE B-4:
Draw Buffer
FINAL STAGE
Copy
Frame Buffer
tolerable than displaying the changes slowly.
After exchanging of the buffers, the latest buffer (which
5.
The workflow cycle continues.
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 .
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
FIGURE B-1:
Draw Buffer
INITIAL STAGE
Frame Buffer
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
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 .
GraphicsConfig.h .
? See the section on double-buffering in the
Microchip Graphics Library Help file for code
FIGURE B-2:
DRAWING STAGE
examples.
Draw Buffer
DS01368A-page 30
Frame Buffer
? 2011 Microchip Technology Inc.
相关PDF资料
AC164130 BOARD DAUGHT PICTL PLUS ECAN/LIN
AC164131 BOARD DAUGHTER USB PICTAIL PLUS
AC164132 BOARD DAUGHTER PICTAIL ETHERNET
AC164141 BOARD SMART CARD / SIM CARD
AC164142 BOARD DAUGHTER PWR LINE MODEM
AC164144 LLC PICTAIL PLUS DAUGHTR BRD
AC164145 BOARD DAUGHTER PWR LINE MODEM
AC243005-1 KIT MEMORY SERIAL SUPERFLASH 1
相关代理商/技术参数
AC164128 功能描述:子卡和OEM板 dsPICDEM Motor Cntrl PICtail Plus RoHS:否 制造商:BeagleBoard by CircuitCo 产品:BeagleBone LCD4 Boards 用于:BeagleBone - BB-Bone - Open Source Development Kit
AC164129 功能描述:子卡和OEM板 Audio PICtail Plus Daughter Board RoHS:否 制造商:BeagleBoard by CircuitCo 产品:BeagleBone LCD4 Boards 用于:BeagleBone - BB-Bone - Open Source Development Kit
AC164130 功能描述:网络开发工具 ECAN/LIN PICtail Plus Daughter Board RoHS:否 制造商:Rabbit Semiconductor 产品:Development Kits 类型:Ethernet to Wi-Fi Bridges 工具用于评估:RCM6600W 数据速率:20 Mbps, 40 Mbps 接口类型:802.11 b/g, Ethernet 工作电源电压:3.3 V
AC164130-2 功能描述:子卡和OEM板 CAN/LIN PICtail Plus Daughter Board RoHS:否 制造商:BeagleBoard by CircuitCo 产品:BeagleBone LCD4 Boards 用于:BeagleBone - BB-Bone - Open Source Development Kit
AC164131 功能描述:子卡和OEM板 USB PICtail Plus Daughter Board RoHS:否 制造商:BeagleBoard by CircuitCo 产品:BeagleBone LCD4 Boards 用于:BeagleBone - BB-Bone - Open Source Development Kit
AC164132 功能描述:以太网开发工具 100Mbps Ethernet PICtail Plus DB RoHS:否 制造商:Micrel 产品:Evaluation Boards 类型:Ethernet Transceivers 工具用于评估:KSZ8873RLL 接口类型:RMII 工作电源电压:
AC164133 功能描述:电源管理IC开发工具 dsPIC BuckBoost PICtail Daughtr Brd RoHS:否 制造商:Maxim Integrated 产品:Evaluation Kits 类型:Battery Management 工具用于评估:MAX17710GB 输入电压: 输出电压:1.8 V
AC164133 制造商:Microchip Technology Inc 功能描述:Buck/Boost Converter PICtail P