[PATCH] d3dx9: Implement D3DXLoadSurfaceFromSurface
Tony Wasserka
tony.wasserka at freenet.de
Mon Jun 22 10:57:20 CDT 2009
---
dlls/d3dx9_36/Makefile.in | 2 +-
dlls/d3dx9_36/d3dx9_36.spec | 2 +-
dlls/d3dx9_36/surface.c | 55 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx9_36/Makefile.in b/dlls/d3dx9_36/Makefile.in
index c094071..7e64a13 100644
--- a/dlls/d3dx9_36/Makefile.in
+++ b/dlls/d3dx9_36/Makefile.in
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = d3dx9_36.dll
IMPORTLIB = d3dx9
-IMPORTS = d3d9 d3dx8 gdi32 kernel32
+IMPORTS = d3d9 d3dx8 gdi32 user32 kernel32
C_SRCS = \
d3dx9_36_main.c \
diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec
index 63c2fb3..8a7cdf7 100644
--- a/dlls/d3dx9_36/d3dx9_36.spec
+++ b/dlls/d3dx9_36/d3dx9_36.spec
@@ -188,7 +188,7 @@
@ stdcall D3DXLoadSurfaceFromMemory(ptr ptr ptr ptr long long ptr ptr long long)
@ stdcall D3DXLoadSurfaceFromResourceA(ptr ptr ptr ptr str ptr long long ptr)
@ stdcall D3DXLoadSurfaceFromResourceW(ptr ptr ptr ptr wstr ptr long long ptr)
-@ stub D3DXLoadSurfaceFromSurface
+@ stdcall D3DXLoadSurfaceFromSurface(ptr ptr ptr ptr ptr ptr long long)
@ stub D3DXLoadVolumeFromFileA
@ stub D3DXLoadVolumeFromFileInMemory
@ stub D3DXLoadVolumeFromFileW
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index 064958a..2ab9af5 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -370,3 +370,58 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface,
if(SrcFormat == D3DFMT_UNKNOWN || pSrcRect->left >= pSrcRect->right || pSrcRect->top >= pSrcRect->bottom) return E_FAIL;
return E_NOTIMPL;
}
+
+/************************************************************
+ * D3DXLoadSurfaceFromSurface
+ *
+ * Copies the contents from one surface to another, performing any required
+ * format conversion, resizing or filtering.
+ *
+ * PARAMS
+ * pDestSurface [I] pointer to the destination surface
+ * pDestPalette [I] palette to use
+ * pDestRect [I] to be filled area of the surface
+ * pSrcSurface [I] pointer to the source surface
+ * pSrcPalette [I] palette used for the source surface
+ * pSrcRect [I] area of the source data to load
+ * dwFilter [I] filter to apply on resizing
+ * Colorkey [I] any ARGB value or 0 to disable color-keying
+ *
+ * RETURNS
+ * Success: D3D_OK
+ * Failure: D3DERR_INVALIDCALL, if pDestSurface or pSrcSurface are NULL
+ * D3DXERR_INVALIDDATA, if one of the surfaces is not lockable
+ *
+ */
+HRESULT WINAPI D3DXLoadSurfaceFromSurface(LPDIRECT3DSURFACE9 pDestSurface,
+ CONST PALETTEENTRY *pDestPalette,
+ CONST RECT *pDestRect,
+ LPDIRECT3DSURFACE9 pSrcSurface,
+ CONST PALETTEENTRY *pSrcPalette,
+ CONST RECT *pSrcRect,
+ DWORD dwFilter,
+ D3DCOLOR Colorkey)
+{
+ RECT rect;
+ D3DLOCKED_RECT lock;
+ D3DSURFACE_DESC SrcDesc;
+ HRESULT hr;
+ TRACE("(void): relay\n");
+
+ if( !pDestSurface || !pSrcSurface ) return D3DERR_INVALIDCALL;
+
+ IDirect3DSurface9_GetDesc(pSrcSurface, &SrcDesc);
+
+ if( !pSrcRect ) SetRect(&rect, 0, 0, SrcDesc.Width, SrcDesc.Height);
+ else rect = *pSrcRect;
+
+ hr = IDirect3DSurface9_LockRect(pSrcSurface, &lock, NULL, D3DLOCK_READONLY);
+ if(FAILED(hr)) return D3DXERR_INVALIDDATA;
+
+ hr = D3DXLoadSurfaceFromMemory(pDestSurface, pDestPalette, pDestRect,
+ lock.pBits, SrcDesc.Format, lock.Pitch,
+ pSrcPalette, &rect, dwFilter, Colorkey);
+
+ IDirect3DSurface9_UnlockRect(pSrcSurface);
+ return hr;
+}
--
1.6.0.2
--------------040901020804030806020509--
More information about the wine-patches
mailing list