First, in the case of choosing the idirectdrawsurface :: BLT method, in what case should be selected or the idirectdrawsurface :: BLTFAST method. (This interpretation is from someone else COPY, but I don't know if it is correct, but I think it is reasonable)
1. If you are making a bit interlaced from a hidden screen buffer, you should use iDirectdrawsurface :: Bltfast.
2. If your system memory is used to use the hardware to make a bit interval, you will not really increase the speed of the copy, but it saves the system to simulate hardware time, so that the entire standby interchange copy time is about 10%. Therefore, I recommend readers to use iDirectdrawsurface :: BLTFast for all display operations (copy from the memory bits to the memory).
3. If you are copying from the system memory, or require a dedicated hardware flag, you must use iDirectdrawsurface :: BLT.
Second, what is the addRef () function?
IDirectDrawsurface7 :: addref ()
This is the case in DirectX8 SDK Help
INCREASES The Reference Count of the Object By 1.
When the object is created, its reference count is set to 1. Every time an application obtains an interface to the object or calls the AddRef method, the object's reference count is increased by 1. Use the Release method to decrease the object's reference count by 1.
Big intending is to say: addRef () functions are used to indicate how many "associated" of Object is added 1. And when Release is called, this value is reduced by 1.
And I have two places where the example included in DirectX has two:
1. After g_lpfrontsurface-> getattachedsurface (& DDSCAPS, & g_lpbacksurface), the "Front Cache page GetAttachedSurface Background Cache" is used to use G_lpBacksurface-> addRef () ;.
2. Another situation is: Suppose there are two DirectDraw entities, we apply for two pointers, LPDIRECTDRAW7 LPDD1, LPDIRECTDRAW7 LPDD1, LPDD2; Used in ADDREF ();
So about that English is to say that this function should be used after obtaining a Surface that is not created by CreateSurface, which is not by your own DirectDRAW pointer, with iDirectdraw7 :: addref. I can only understand this way, if the brother is high, I hope I will not keep the enlightenment.
Third, after Alt Tab, the problem of page loss.
We use a function idirectdrawsurface7 :: restore (); this function can only restore the page the original memory location size, but can not restore the original content, so we also reload the content manually. In the DirectDraw program, all DirectDraw functions will not be done without anything, and only returns DDERR_SURFACELOST indicates that the page is lost. At the same time IdirectDrawSurface7 :: islost () also has a function to determine if the page is lost. If the call is successful, the return value is DD_OK, indicating that the page memory is not released. If the call fails, the return value may be one of the following values: DDERR_INVALIDOBJECT; DDERR_INVALIDPARAMS; DDERR_SURFACELOST turned out to be the number one by calling Surface will now IDirectDraw7 :: RestoreAllSurface () to solve this problem, just call one entity pointer of DirectDraw RestoreAllSurface ( Once you can restore the memory size and location of all related pages. The content is still to be re-transferred. (I think that addRef () function may have some association with this restoreAllSurface ()!)
Third, don't need a palette? ?
When DISPLAYMODE is set to 640 × 480 × 8 bits (256 colors), you must use the palette management page color, otherwise, the examples like the previous talk sometimes generate distortion. When the 640 × 480 × 16 bit color does not create a color distortion without CreatePalette.
There is such a sentence in the DirectX manual of "Old King": "Those pages that use 16-bit or higher pixel formats do not use palette."