Copies rectangular subsets of pixels from one surface to another.
HRESULT UpdateSurface( [in] IDirect3DSurface9 *pSourceSurface, [in] const RECT *pSourceRect, [in] IDirect3DSurface9 *pDestinationSurface, [in] const POINT *pDestinationPoint );
- pSourceSurface [in]
Pointer to an IDirect3DSurface9 interface, representing the source surface. This parameter must point to a different surface than pDestinationSurface.
- pSourceRect [in]
Type: const RECT*
Pointer to a rectangle on the source surface. Specifying NULL for this parameter causes the entire surface to be copied.
- pDestinationSurface [in]
Pointer to an IDirect3DSurface9 interface, representing the destination surface.
- pDestinationPoint [in]
Type: const POINT*
Pointer to the upper left corner of the destination rectangle. Specifying NULL for this parameter causes the entire surface to be copied.
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be one of the following: D3DERR_INVALIDCALL.
This method is similar to CopyRects in DirectX 8.
This function has the following restrictions.
- The source surface must have been created with D3DPOOL_SYSTEMMEM.
- The destination surface must have been created with D3DPOOL_DEFAULT.
- Neither surface can be locked or holding an outstanding device context.
- Neither surface can be created with multisampling. The only valid flag for both surfaces is D3DMULTISAMPLE_NONE.
- The surface format cannot be a depth stencil format.
- The source and dest rects must fit within the surface.
- No stretching or shrinking is allowed (the rects must be the same size).
- The source format must match the dest format.
The following table shows the supported combinations.
|Texture||RT texture||RT||Off-screen plain|
* If the driver does not support the requested copy, it will be emulated using lock and copy.
If the application needs to copy data from a D3DPOOL_DEFAULT render target to a D3DPOOL_SYSTEMMEM surface, it can use GetRenderTargetData.