[PATCH] d3dx9: Add stubs for the ID3DXFont functions

Tony Wasserka tony.wasserka at freenet.de
Sat Feb 23 10:54:23 CST 2008


---
 dlls/d3dx9_36/Makefile.in        |    3 +-
 dlls/d3dx9_36/d3dx9_36.spec      |    8 +-
 dlls/d3dx9_36/d3dx9_36_private.h |    6 +
 dlls/d3dx9_36/font.c             |  262 ++++++++++++++++++++++++++++++++++=
++++
 4 files changed, 274 insertions(+), 5 deletions(-)
 create mode 100755 dlls/d3dx9_36/font.c

diff --git a/dlls/d3dx9_36/Makefile.in b/dlls/d3dx9_36/Makefile.in
index 523ad33..bd85bed 100644
--- a/dlls/d3dx9_36/Makefile.in
+++ b/dlls/d3dx9_36/Makefile.in
@@ -8,7 +8,8 @@ IMPORTS   =3D d3d9 d3dx8 kernel32
 EXTRALIBS =3D -ldxguid -luuid
=20
 C_SRCS =3D=20
-=09d3dx9_36_main.c
+=09d3dx9_36_main.c=20
+=09font.c
=20
 @MAKE_DLL_RULES@
=20
diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec
index 607a098..b1e52c8 100644
--- a/dlls/d3dx9_36/d3dx9_36.spec
+++ b/dlls/d3dx9_36/d3dx9_36.spec
@@ -62,10 +62,10 @@
 @ stub D3DXCreateEffectFromResourceExW
 @ stub D3DXCreateEffectFromResourceW
 @ stub D3DXCreateEffectPool
-@ stub D3DXCreateFontA
-@ stub D3DXCreateFontIndirectA
-@ stub D3DXCreateFontIndirectW
-@ stub D3DXCreateFontW
+@ stdcall D3DXCreateFontA(ptr long long long long long long long long long=
 str ptr)
+@ stdcall D3DXCreateFontIndirectA(ptr ptr ptr)
+@ stdcall D3DXCreateFontIndirectW(ptr ptr ptr)
+@ stdcall D3DXCreateFontW(ptr long long long long long long long long long=
 str ptr)
 @ stub D3DXCreateFragmentLinker
 @ stub D3DXCreateFragmentLinkerEx
 @ stub D3DXCreateKeyframedAnimationSet
diff --git a/dlls/d3dx9_36/d3dx9_36_private.h b/dlls/d3dx9_36/d3dx9_36_priv=
ate.h
index 2fb7e06..1aa2875 100755
--- a/dlls/d3dx9_36/d3dx9_36_private.h
+++ b/dlls/d3dx9_36/d3dx9_36_private.h
@@ -22,8 +22,14 @@
=20
 #include <stdarg.h>
=20
+#define COBJMACROS
 #include "windef.h"
 #include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
 #include "d3dx9.h"
=20
 /**********************************************
diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
new file mode 100755
index 0000000..c438cb3
--- /dev/null
+++ b/dlls/d3dx9_36/font.c
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2008 Tony Wasserka
+ *
+ * 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, U=
SA
+ *
+ */
+
+#include "config.h"
+#include "wine/port.h"
+#include "d3dx9_36_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
+
+HRESULT WINAPI D3DXCreateFontA(LPDIRECT3DDEVICE9 device, INT height, UINT =
width, UINT weight, UINT miplevels, BOOL italic, DWORD charset,
+                               DWORD precision, DWORD quality, DWORD pitch=
andfamily, LPCSTR facename, LPD3DXFONT *font)
+{
+    ID3DXFontImpl *object=3DNULL;
+
+    TRACE("stubn");
+    object=3DHeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXFon=
tImpl));
+    if(object=3D=3DNULL) {
+        *font=3D(LPD3DXFONT)NULL;
+        return E_OUTOFMEMORY;
+    }
+    object->lpVtbl=3D&D3DXFont_Vtbl;
+    object->ref=3D1;
+
+    *font=3D(LPD3DXFONT)object;
+    return S_OK;
+}
+
+HRESULT WINAPI D3DXCreateFontW(LPDIRECT3DDEVICE9 device, INT height, UINT =
width, UINT weight, UINT miplevels, BOOL italic, DWORD charset,
+                               DWORD precision, DWORD quality, DWORD pitch=
andfamily, LPCWSTR facename, LPD3DXFONT *font)
+{
+    ID3DXFontImpl *object=3DNULL;
+
+    TRACE("stubn");
+    object=3DHeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXFon=
tImpl));
+    if(object=3D=3DNULL) {
+        *font=3D(LPD3DXFONT)NULL;
+        return E_OUTOFMEMORY;
+    }
+    object->lpVtbl=3D&D3DXFont_Vtbl;
+    object->ref=3D1;
+
+    *font=3D(LPD3DXFONT)object;
+    return S_OK;
+}
+
+HRESULT WINAPI D3DXCreateFontIndirectA(LPDIRECT3DDEVICE9 device, CONST D3D=
XFONT_DESCA *desc, LPD3DXFONT *font)
+{
+    ID3DXFontImpl *object=3DNULL;
+
+    TRACE("stubn");
+    object=3DHeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXFon=
tImpl));
+    if(object=3D=3DNULL) {
+        *font=3D(LPD3DXFONT)NULL;
+        return E_OUTOFMEMORY;
+    }
+    object->lpVtbl=3D&D3DXFont_Vtbl;
+    object->ref=3D1;
+
+    *font=3D(LPD3DXFONT)object;
+    return S_OK;
+}
+
+HRESULT WINAPI D3DXCreateFontIndirectW(LPDIRECT3DDEVICE9 device, CONST D3D=
XFONT_DESCW *desc, LPD3DXFONT *font)
+{
+    ID3DXFontImpl *object=3DNULL;
+
+    TRACE("stubn");
+    object=3DHeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXFon=
tImpl));
+    if(object=3D=3DNULL) {
+        *font=3D(LPD3DXFONT)NULL;
+        return E_OUTOFMEMORY;
+    }
+    object->lpVtbl=3D&D3DXFont_Vtbl;
+    object->ref=3D1;
+
+    *font=3D(LPD3DXFONT)object;
+    return S_OK;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_QueryInterface(LPD3DXFONT iface, REFII=
D riid, LPVOID *object)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+
+    if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXFon=
t)) {
+        TRACE("(%p): QueryInterface from %sn", This, debugstr_guid(riid));
+        IUnknown_AddRef(iface);
+        *object=3DThis;
+        return S_OK;
+    }
+    WARN("(%p)->(%s, %p): not foundn", iface, debugstr_guid(riid), object)=
;
+    object=3DNULL;
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI ID3DXFontImpl_AddRef(LPD3DXFONT iface)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    ULONG ref=3DInterlockedIncrement(&This->ref);
+    TRACE("(%p): AddRef from %dn", This, ref-1);
+    return ref;
+}
+
+static ULONG WINAPI ID3DXFontImpl_Release(LPD3DXFONT iface)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    ULONG ref=3DInterlockedDecrement(&This->ref);
+    TRACE("(%p): ReleaseRef to %dn", This, ref);
+    return ref;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_GetDevice(LPD3DXFONT iface, LPDIRECT3D=
DEVICE9 *device)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    device=3DNULL;
+    return S_OK;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_GetDescA(LPD3DXFONT iface, D3DXFONT_DE=
SCA *desc)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    desc=3DNULL;
+    return S_OK;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_GetDescW(LPD3DXFONT iface, D3DXFONT_DE=
SCW *desc)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    desc=3DNULL;
+    return S_OK;
+}
+
+static BOOL WINAPI ID3DXFontImpl_GetTextMetricsA(LPD3DXFONT iface, TEXTMET=
RICA *metrics)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    metrics=3DNULL;
+    return FALSE;
+}
+
+static BOOL WINAPI ID3DXFontImpl_GetTextMetricsW(LPD3DXFONT iface, TEXTMET=
RICW *metrics)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    metrics=3DNULL;
+    return FALSE;
+}
+
+static HDC WINAPI ID3DXFontImpl_GetDC(LPD3DXFONT iface)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    return NULL;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_GetGlyphData(LPD3DXFONT iface, UINT gl=
yph, LPDIRECT3DTEXTURE9 *texture, RECT *blackbox, POINT *cellinc)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    texture=3DNULL;
+    blackbox=3DNULL;
+    cellinc=3DNULL;
+    return S_OK;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters(LPD3DXFONT iface, UI=
NT first, UINT last)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    return S_OK;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs(LPD3DXFONT iface, UINT f=
irst, UINT last)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    return S_OK;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(LPD3DXFONT iface, LPCSTR =
string, INT count)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    return S_OK;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(LPD3DXFONT iface, LPCWSTR=
 string, INT count)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    return S_OK;
+}
+
+static INT WINAPI ID3DXFontImpl_DrawTextA(LPD3DXFONT iface, LPD3DXSPRITE s=
prite, LPCSTR string, INT count, LPRECT rect, DWORD format, D3DCOLOR color)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    return 1;
+}
+
+static INT WINAPI ID3DXFontImpl_DrawTextW(LPD3DXFONT iface, LPD3DXSPRITE s=
prite, LPCWSTR string, INT count, LPRECT rect, DWORD format, D3DCOLOR color=
)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    return 1;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_OnLostDevice(LPD3DXFONT iface)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    return S_OK;
+}
+
+static HRESULT WINAPI ID3DXFontImpl_OnResetDevice(LPD3DXFONT iface)
+{
+    ID3DXFontImpl *This=3D(ID3DXFontImpl*)iface;
+    TRACE("(%p): stubn", This);
+    return S_OK;
+}
+
+const ID3DXFontVtbl D3DXFont_Vtbl =3D
+{
+    /*** IUnknown methods ***/
+    ID3DXFontImpl_QueryInterface,
+    ID3DXFontImpl_AddRef,
+    ID3DXFontImpl_Release,
+    /*** ID3DXFont methods ***/
+    ID3DXFontImpl_GetDevice,
+    ID3DXFontImpl_GetDescA,
+    ID3DXFontImpl_GetDescW,
+    ID3DXFontImpl_GetTextMetricsA,
+    ID3DXFontImpl_GetTextMetricsW,
+    ID3DXFontImpl_GetDC,
+    ID3DXFontImpl_GetGlyphData,
+    ID3DXFontImpl_PreloadCharacters,
+    ID3DXFontImpl_PreloadGlyphs,
+    ID3DXFontImpl_PreloadTextA,
+    ID3DXFontImpl_PreloadTextW,
+    ID3DXFontImpl_DrawTextA,
+    ID3DXFontImpl_DrawTextW,
+    ID3DXFontImpl_OnLostDevice,
+    ID3DXFontImpl_OnResetDevice
+};
--=20
1.5.3.7

=0A=0A=0A=0A=0A=0A=0A=0A



More information about the wine-patches mailing list