Browse CVS Repository
Contents of /freetrain/FreeTrain/devdoc/DirectDraw lost surfaces.txt
Parent Directory
| Revision Log
| Revision Graph
Revision 1.1 -
( show annotations)
( download)
Sun Mar 2 16:02:00 2003 UTC
(21 years, 1 month ago)
by kkawa
Branch: MAIN
CVS Tags: kohsuke-checkpoint-20031229, HEAD
Branch point for: BRANCH_VS2008, C477_Unofficial200309
File MIME type: text/plain
adding documents for developers
| 1 |
HOW FREETRAIN HANDLES LOST DIRECTDRAW SURFACES |
| 2 |
============================================== |
| 3 |
|
| 4 |
Refer to MSDN for the background information about lost surfaces. |
| 5 |
|
| 6 |
DETECTION |
| 7 |
========= |
| 8 |
|
| 9 |
DirectDraw.net library doesn't provide any means for detecting lost surfaces in an OO way. It just throws a COMException whose error code indicates that the error is due to a lost surface. This design is primarily because of a perceived (but groundless) performance penalty in setting up a try-catch block at every DirectDraw invocation. The application is expected to catch such an exception and do the recovery by itself. |
| 10 |
|
| 11 |
FreeTrain does the recovery by setting up a try-catch block at the root of the drawing operation. One such place is at QuarterViewDrawer. In this way, we could save the number of try-catch overheads. |
| 12 |
|
| 13 |
Once a lost surface is detected, it is required to trigger the PictureManager.onSurfaceLost event. |
| 14 |
|
| 15 |
|
| 16 |
RECOVERY |
| 17 |
======== |
| 18 |
|
| 19 |
Objects interested in being notified of a lost surface should register their event handler at the PictureManager.onSurfaceLost event. |
| 20 |
|
| 21 |
The PictureManager object takes care of all the picture objects. QuarterViewDrawer does the right thing, too. So only those who directly manipulate DirectDraw surfaces are required to handle them. |
| 22 |
|
| 23 |
|
| 24 |
TEST |
| 25 |
==== |
| 26 |
|
| 27 |
To simulate surface lost, do the following procedure: |
| 28 |
|
| 29 |
Run FreeTrain, then run another full-screen DirectDraw/Direct3D program. This will force FreeTrain to loose surfaces. |
|