[PATCH] Implement basic functions for MatrixStack
David Adam
David.Adam at math.cnrs.fr
Sun Dec 9 16:47:14 CST 2007
---
dlls/d3dx8/d3dx8_private.h | 15 +++++++++++++++
dlls/d3dx8/math.c | 42 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 56 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dx8/d3dx8_private.h b/dlls/d3dx8/d3dx8_private.h
index 63cc91e..29df662 100644
--- a/dlls/d3dx8/d3dx8_private.h
+++ b/dlls/d3dx8/d3dx8_private.h
@@ -30,6 +30,7 @@
/* Interfaces */
typedef struct ID3DXBufferImpl ID3DXBufferImpl;
typedef struct ID3DXFontImpl ID3DXFontImpl;
+typedef struct ID3DXMatrixStackImpl ID3DXMatrixStackImpl;
/* ----------- */
/* ID3DXBuffer */
@@ -70,4 +71,18 @@ struct ID3DXFontImpl
/* ID3DXFont fields */
};
+/* ----------- */
+/* ID3DXMatrix */
+/* ----------- */
+
+/*****************************************************************************
+ * ID3DXMatrixStackImpl implementation structure
+ */
+struct ID3DXMatrixStackImpl
+{
+ /* IUnknown fields */
+ const ID3DXMatrixStackVtbl *lpVtbl;
+ LONG ref;
+};
+
#endif /*__WINE_D3DX8_PRIVATE_H */
diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c
index 18115b4..c8b5ebd 100644
--- a/dlls/d3dx8/math.c
+++ b/dlls/d3dx8/math.c
@@ -26,7 +26,7 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
-#include "d3dx8.h"
+#include "d3dx8_private.h"
#include "wine/debug.h"
@@ -583,6 +583,46 @@ D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *pm)
return pout;
}
+/*_________________D3DXMatrixStack____________________*/
+
+ULONG WINAPI ID3DXMatrixStackImpl_AddRef(ID3DXMatrixStack* iface)
+{
+ ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
+ ULONG ref = InterlockedIncrement(&This->ref);
+ TRACE("(%p) : AddRef from %d\n", This, ref - 1);
+ return ref;
+}
+
+HRESULT WINAPI ID3DXMatrixStackImpl_QueryInterface(ID3DXMatrixStack *iface, REFIID riid, void **ppobj)
+{
+ ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
+ if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXMatrixStack))
+ {
+ ID3DXMatrixStack_AddRef(iface);
+ *ppobj = This;
+ return S_OK;
+ }
+ *ppobj = NULL;
+ ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
+ return E_NOINTERFACE;
+}
+
+ULONG WINAPI ID3DXMatrixStackImpl_Release(ID3DXMatrixStack* iface)
+{
+ ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
+ ULONG ref = InterlockedDecrement(&This->ref);
+ if ( !ref ) HeapFree(GetProcessHeap(), 0, This);
+ TRACE("(%p) : ReleaseRef to %d\n", This, ref);
+ return ref;
+}
+
+static const ID3DXMatrixStackVtbl ID3DXMatrixStack_Vtbl =
+{
+ ID3DXMatrixStackImpl_QueryInterface,
+ ID3DXMatrixStackImpl_AddRef,
+ ID3DXMatrixStackImpl_Release
+};
+
/*_________________D3DXPLANE________________*/
D3DXPLANE* WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, CONST D3DXVECTOR3 *pvpoint, CONST D3DXVECTOR3 *pvnormal)
--
1.5.3.2
--0-171629213-1197386767=:1203--
More information about the wine-patches
mailing list