[PATCH] Implement the basics for D3DXMatrixStack

Adam David (none) david at Goss.
Thu Nov 29 11:26:30 CST 2007


---
 dlls/d3dx8/d3dx8_main.c        |    4 +-
 dlls/d3dx8/d3dx8_private.h     |   90 +++++++++++++++++++++++++++++++++++++=
+++
 dlls/d3dx8/d3dx8core_private.h |   73 --------------------------------
 dlls/d3dx8/d3dxbuffer.c        |    2 +-
 dlls/d3dx8/math.c              |   40 ++++++++++++++++++
 dlls/dxguid/dx8guid.c          |    3 +-
 6 files changed, 133 insertions(+), 79 deletions(-)
 create mode 100644 dlls/d3dx8/d3dx8_private.h
 delete mode 100644 dlls/d3dx8/d3dx8core_private.h

diff --git a/dlls/d3dx8/d3dx8_main.c b/dlls/d3dx8/d3dx8_main.c
index 9221221..28dd73f 100644
--- a/dlls/d3dx8/d3dx8_main.c
+++ b/dlls/d3dx8/d3dx8_main.c
@@ -30,9 +30,7 @@
 #include "winuser.h"
 #include "wine/debug.h"
=20
-#include "d3dx8core.h"
-#include "d3dx8core_private.h"
-
+#include "d3dx8_private.h"
=20
 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
=20
diff --git a/dlls/d3dx8/d3dx8_private.h b/dlls/d3dx8/d3dx8_private.h
new file mode 100644
index 0000000..d5f1ee0
--- /dev/null
+++ b/dlls/d3dx8/d3dx8_private.h
@@ -0,0 +1,90 @@
+/*
+ * Direct3D X 8 private include file
+ *
+ * Copyright 2002 Raphael Junqueira
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, US=
A
+ */
+
+#ifndef __WINE_D3DX8_PRIVATE_H
+#define __WINE_D3DX8_PRIVATE_H
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "d3dx8.h"
+
+/* Interfaces */
+typedef struct ID3DXBufferImpl ID3DXBufferImpl;
+typedef struct ID3DXFontImpl   ID3DXFontImpl;
+typedef struct ID3DXMatrixStackImpl ID3DXMatrixStackImpl;
+
+/* ----------- */
+/* ID3DXBuffer */
+/* ----------- */
+
+/**************************************************************************=
***
+ * Predeclare the interface implementation structures
+ */
+extern const ID3DXBufferVtbl D3DXBuffer_Vtbl;
+
+/**************************************************************************=
***
+ * ID3DXBufferImpl implementation structure
+ */
+struct ID3DXBufferImpl
+{
+  /* IUnknown fields */
+  const ID3DXBufferVtbl *lpVtbl;
+  LONG           ref;
+
+  /* ID3DXBuffer fields */
+  DWORD         *buffer;
+  DWORD          bufferSize;
+};
+
+/* --------- */
+/* ID3DXFont */
+/* --------- */
+
+/**************************************************************************=
***
+ * ID3DXFontImpl implementation structure
+ */
+struct ID3DXFontImpl
+{
+  /* IUnknown fields */
+  const ID3DXFontVtbl *lpVtbl;
+  LONG           ref;
+
+  /* ID3DXFont fields */
+};
+
+/* ----------- */
+/* ID3DXMatrix */
+/* ----------- */
+
+/**************************************************************************=
***
+ * ID3DXMatrixStackImpl implementation structure
+ */
+struct ID3DXMatrixStackImpl
+{
+  /* IUnknown fields */
+  const ID3DXMatrixStackVtbl *lpVtbl;
+  LONG                   ref;
+
+  /* ID3DXFont fields */
+};
+
+#endif /*__WINE_D3DX8_PRIVATE_H */
diff --git a/dlls/d3dx8/d3dx8core_private.h b/dlls/d3dx8/d3dx8core_private.h
deleted file mode 100644
index fb98b38..0000000
--- a/dlls/d3dx8/d3dx8core_private.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Direct3D X 8 private include file
- *
- * Copyright 2002 Raphael Junqueira
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, US=
A
- */
-
-#ifndef __WINE_D3DX8CORE_PRIVATE_H
-#define __WINE_D3DX8CORE_PRIVATE_H
-
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "d3dx8core.h"
-
-/* Interfaces */
-typedef struct ID3DXBufferImpl ID3DXBufferImpl;
-typedef struct ID3DXFontImpl   ID3DXFontImpl;
-
-/* ----------- */
-/* ID3DXBuffer */
-/* ----------- */
-
-/**************************************************************************=
***
- * Predeclare the interface implementation structures
- */
-extern const ID3DXBufferVtbl D3DXBuffer_Vtbl;
-
-/**************************************************************************=
***
- * ID3DXBufferImpl implementation structure
- */
-struct ID3DXBufferImpl
-{
-  /* IUnknown fields */
-  const ID3DXBufferVtbl *lpVtbl;
-  LONG           ref;
-
-  /* ID3DXBuffer fields */
-  DWORD         *buffer;
-  DWORD          bufferSize;
-};
-
-/* --------- */
-/* ID3DXFont */
-/* --------- */
-
-/**************************************************************************=
***
- * ID3DXFontImpl implementation structure
- */
-struct ID3DXFontImpl
-{
-  /* IUnknown fields */
-  const ID3DXFontVtbl *lpVtbl;
-  LONG           ref;
-
-  /* ID3DXFont fields */
-};
-
-#endif /*__WINE_D3DX8CORE_PRIVATE_H */
diff --git a/dlls/d3dx8/d3dxbuffer.c b/dlls/d3dx8/d3dxbuffer.c
index 369714c..56591c0 100644
--- a/dlls/d3dx8/d3dxbuffer.c
+++ b/dlls/d3dx8/d3dxbuffer.c
@@ -31,7 +31,7 @@
 #include "wine/debug.h"
=20
 #include "d3d8.h"
-#include "d3dx8core_private.h"
+#include "d3dx8_private.h"
=20
 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
=20
diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c
index 55da2d9..b9e2942 100644
--- a/dlls/d3dx8/math.c
+++ b/dlls/d3dx8/math.c
@@ -21,12 +21,15 @@
 #include <stdarg.h>
 #include <assert.h>
=20
+#define COBJMACROS
+
 #define NONAMELESSUNION
=20
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
 #include "d3dx8.h"
+#include "d3dx8_private.h"
=20
 #include "wine/debug.h"
=20
@@ -1166,3 +1169,40 @@ D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4 *po=
ut, CONST D3DXVECTOR4 *pv,
     pout->w =3D pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[2][=
3] * pv->z + pm->u.m[3][3] * pv->w;
     return pout;
 }
+
+/*_________________D3DXMatrixStack____________________*/
+
+HRESULT WINAPI ID3DXMatrixStackImpl_QueryInterface(ID3DXMatrixStack *iface,=
 REFIID riid, void **ppvObject)
+{
+    ID3DXMatrixStackImpl *This =3D (ID3DXMatrixStackImpl *)iface;
+    if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXMat=
rixStack))
+    {
+     IClassFactory_AddRef(iface);
+     *ppvObject =3D This;
+     return D3D_OK;
+    }
+    ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
+    return E_NOINTERFACE;
+}
+
+ULONG WINAPI ID3DXMatrixStackImpl_AddRef(ID3DXMatrixStack* iface)
+{
+    ID3DXMatrixStackImpl *This =3D (ID3DXMatrixStackImpl *)iface;
+    ULONG ref =3D InterlockedIncrement(&This->ref);
+    return ref;
+}
+
+ULONG WINAPI ID3DXMatrixStackImpl_Release(ID3DXMatrixStack* iface)
+{
+    ID3DXMatrixStackImpl *This =3D (ID3DXMatrixStackImpl *)iface;
+    ULONG ref =3D InterlockedDecrement(&This->ref);
+    if ( !ref ) HeapFree(GetProcessHeap(), 0, This);
+    return ref;
+}
+
+static const ID3DXMatrixStackVtbl ID3DXMatrixStack_Vtbl =3D
+{
+    ID3DXMatrixStackImpl_QueryInterface,
+    ID3DXMatrixStackImpl_AddRef,
+    ID3DXMatrixStackImpl_Release
+};
diff --git a/dlls/dxguid/dx8guid.c b/dlls/dxguid/dx8guid.c
index 78c6114..aad8a5f 100644
--- a/dlls/dxguid/dx8guid.c
+++ b/dlls/dxguid/dx8guid.c
@@ -30,5 +30,4 @@
 #include "olectl.h"
 #include "initguid.h"
=20
-#include "d3d8.h"
-#include "d3dx8core.h"
+#include "d3dx8.h"
--=20
1.5.3.2


--=_5h7jsxrxo1s0--



More information about the wine-patches mailing list