[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;
=20
/* ----------- */
/* ID3DXBuffer */
@@ -70,4 +71,18 @@ struct ID3DXFontImpl
/* ID3DXFont fields */
};
=20
+/* ----------- */
+/* 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"
=20
#include "wine/debug.h"
=20
@@ -583,6 +583,46 @@ D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout=
, CONST D3DXMATRIX *pm)
return pout;
}
=20
+/*_________________D3DXMatrixStack____________________*/
+
+ULONG WINAPI ID3DXMatrixStackImpl_AddRef(ID3DXMatrixStack* iface)
+{
+ ID3DXMatrixStackImpl *This =3D (ID3DXMatrixStackImpl *)iface;
+ ULONG ref =3D 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 =3D (ID3DXMatrixStackImpl *)iface;
+ if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXMat=
rixStack))
+ {
+ ID3DXMatrixStack_AddRef(iface);
+ *ppobj =3D This;
+ return S_OK;
+ }
+ *ppobj =3D NULL;
+ ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
+ return E_NOINTERFACE;
+}
+
+ULONG WINAPI ID3DXMatrixStackImpl_Release(ID3DXMatrixStack* iface)
+{
+ ID3DXMatrixStackImpl *This =3D (ID3DXMatrixStackImpl *)iface;
+ ULONG ref =3D InterlockedDecrement(&This->ref);
+ if ( !ref ) HeapFree(GetProcessHeap(), 0, This);
+ TRACE("(%p) : ReleaseRef to %d\n", This, ref);
+ return ref;
+}
+
+static const ID3DXMatrixStackVtbl ID3DXMatrixStack_Vtbl =3D
+{
+ ID3DXMatrixStackImpl_QueryInterface,
+ ID3DXMatrixStackImpl_AddRef,
+ ID3DXMatrixStackImpl_Release
+};
+
/*_________________D3DXPLANE________________*/
=20
D3DXPLANE* WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, CONST D3DXVECTO=
R3 *pvpoint, CONST D3DXVECTOR3 *pvnormal)
--=20
1.5.3.2
--=_5spb06ofw408--
More information about the wine-patches
mailing list