d3dx9: Get rid of ID3DXFontImpl.

This commit is contained in:
Józef Kucia 2012-06-19 01:15:36 +02:00 committed by Alexandre Julliard
parent 6f3c571a05
commit caf1c1a775

View File

@ -26,7 +26,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
typedef struct ID3DXFontImpl
struct d3dx_font
{
ID3DXFont ID3DXFont_iface;
LONG ref;
@ -36,11 +36,11 @@ typedef struct ID3DXFontImpl
HDC hdc;
HFONT hfont;
} ID3DXFontImpl;
};
static inline ID3DXFontImpl *impl_from_ID3DXFont(ID3DXFont *iface)
static inline struct d3dx_font *impl_from_ID3DXFont(ID3DXFont *iface)
{
return CONTAINING_RECORD(iface, ID3DXFontImpl, ID3DXFont_iface);
return CONTAINING_RECORD(iface, struct d3dx_font, ID3DXFont_iface);
}
static HRESULT WINAPI ID3DXFontImpl_QueryInterface(ID3DXFont *iface, REFIID riid, void **out)
@ -63,18 +63,18 @@ static HRESULT WINAPI ID3DXFontImpl_QueryInterface(ID3DXFont *iface, REFIID riid
static ULONG WINAPI ID3DXFontImpl_AddRef(ID3DXFont *iface)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
struct d3dx_font *This = impl_from_ID3DXFont(iface);
ULONG ref=InterlockedIncrement(&This->ref);
TRACE("(%p)->(): AddRef from %d\n", This, ref-1);
TRACE("%p increasing refcount to %u\n", iface, ref);
return ref;
}
static ULONG WINAPI ID3DXFontImpl_Release(ID3DXFont *iface)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
struct d3dx_font *This = impl_from_ID3DXFont(iface);
ULONG ref=InterlockedDecrement(&This->ref);
TRACE("(%p)->(): ReleaseRef to %d\n", This, ref);
TRACE("%p decreasing refcount to %u\n", iface, ref);
if(ref==0) {
DeleteObject(This->hfont);
@ -85,11 +85,11 @@ static ULONG WINAPI ID3DXFontImpl_Release(ID3DXFont *iface)
return ref;
}
static HRESULT WINAPI ID3DXFontImpl_GetDevice(ID3DXFont *iface, LPDIRECT3DDEVICE9 *device)
static HRESULT WINAPI ID3DXFontImpl_GetDevice(ID3DXFont *iface, IDirect3DDevice9 **device)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
struct d3dx_font *This = impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, device);
TRACE("iface %p, device %p\n", iface, device);
if( !device ) return D3DERR_INVALIDCALL;
*device = This->device;
@ -100,9 +100,9 @@ static HRESULT WINAPI ID3DXFontImpl_GetDevice(ID3DXFont *iface, LPDIRECT3DDEVICE
static HRESULT WINAPI ID3DXFontImpl_GetDescA(ID3DXFont *iface, D3DXFONT_DESCA *desc)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
struct d3dx_font *This = impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, desc);
TRACE("iface %p, desc %p\n", iface, desc);
if( !desc ) return D3DERR_INVALIDCALL;
memcpy(desc, &This->desc, FIELD_OFFSET(D3DXFONT_DESCA, FaceName));
@ -113,9 +113,9 @@ static HRESULT WINAPI ID3DXFontImpl_GetDescA(ID3DXFont *iface, D3DXFONT_DESCA *d
static HRESULT WINAPI ID3DXFontImpl_GetDescW(ID3DXFont *iface, D3DXFONT_DESCW *desc)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
struct d3dx_font *This = impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, desc);
TRACE("iface %p, desc %p\n", iface, desc);
if( !desc ) return D3DERR_INVALIDCALL;
*desc = This->desc;
@ -125,22 +125,22 @@ static HRESULT WINAPI ID3DXFontImpl_GetDescW(ID3DXFont *iface, D3DXFONT_DESCW *d
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsA(ID3DXFont *iface, TEXTMETRICA *metrics)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, metrics);
struct d3dx_font *This = impl_from_ID3DXFont(iface);
TRACE("iface %p, metrics %p\n", iface, metrics);
return GetTextMetricsA(This->hdc, metrics);
}
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsW(ID3DXFont *iface, TEXTMETRICW *metrics)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, metrics);
struct d3dx_font *This = impl_from_ID3DXFont(iface);
TRACE("iface %p, metrics %p\n", iface, metrics);
return GetTextMetricsW(This->hdc, metrics);
}
static HDC WINAPI ID3DXFontImpl_GetDC(ID3DXFont *iface)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p)->()\n", This);
struct d3dx_font *This = impl_from_ID3DXFont(iface);
TRACE("iface %p\n", iface);
return This->hdc;
}
@ -149,36 +149,31 @@ static HRESULT WINAPI ID3DXFontImpl_GetGlyphData(ID3DXFont *iface, UINT glyph,
{
FIXME("iface %p, glyph %#x, texture %p, baclbox %s, cellinc %s stub!\n",
iface, glyph, texture, wine_dbgstr_rect(blackbox), wine_dbgstr_point(cellinc));
return D3D_OK;
return E_NOTIMPL;
}
static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters(ID3DXFont *iface, UINT first, UINT last)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%u, %u): stub\n", This, first, last);
return D3D_OK;
FIXME("iface %p, first %u, last %u stub!\n", iface, first, last);
return E_NOTIMPL;
}
static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs(ID3DXFont *iface, UINT first, UINT last)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%u, %u): stub\n", This, first, last);
return D3D_OK;
FIXME("iface %p, first %u, last %u stub!\n", iface, first, last);
return E_NOTIMPL;
}
static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(ID3DXFont *iface, LPCSTR string, INT count)
static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(ID3DXFont *iface, const char *string, INT count)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%s, %d): stub\n", This, string, count);
return D3D_OK;
FIXME("iface %p, string %s, count %d stub!\n", iface, debugstr_a(string), count);
return E_NOTIMPL;
}
static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(ID3DXFont *iface, LPCWSTR string, INT count)
static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(ID3DXFont *iface, const WCHAR *string, INT count)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%s, %d): stub\n", This, debugstr_w(string), count);
return D3D_OK;
FIXME("iface %p, string %s, count %d stub!\n", iface, debugstr_w(string), count);
return E_NOTIMPL;
}
static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite,
@ -199,15 +194,13 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
static HRESULT WINAPI ID3DXFontImpl_OnLostDevice(ID3DXFont *iface)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(): stub\n", This);
FIXME("iface %p stub!\n", iface);
return D3D_OK;
}
static HRESULT WINAPI ID3DXFontImpl_OnResetDevice(ID3DXFont *iface)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(): stub\n", This);
FIXME("iface %p stub\n", iface);
return D3D_OK;
}
@ -257,8 +250,8 @@ HRESULT WINAPI D3DXCreateFontA(LPDIRECT3DDEVICE9 device, INT height, UINT width,
return D3DXCreateFontIndirectA(device, &desc, font);
}
HRESULT WINAPI D3DXCreateFontW(LPDIRECT3DDEVICE9 device, INT height, UINT width, UINT weight, UINT miplevels, BOOL italic, DWORD charset,
DWORD precision, DWORD quality, DWORD pitchandfamily, LPCWSTR facename, LPD3DXFONT *font)
HRESULT WINAPI D3DXCreateFontW(IDirect3DDevice9 *device, INT height, UINT width, UINT weight, UINT miplevels, BOOL italic, DWORD charset,
DWORD precision, DWORD quality, DWORD pitchandfamily, const WCHAR *facename, ID3DXFont **font)
{
D3DXFONT_DESCW desc;
@ -282,7 +275,7 @@ HRESULT WINAPI D3DXCreateFontW(LPDIRECT3DDEVICE9 device, INT height, UINT width,
/***********************************************************************
* D3DXCreateFontIndirectA (D3DX9_36.@)
*/
HRESULT WINAPI D3DXCreateFontIndirectA(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_DESCA *desc, LPD3DXFONT *font)
HRESULT WINAPI D3DXCreateFontIndirectA(IDirect3DDevice9 *device, const D3DXFONT_DESCA *desc, ID3DXFont **font)
{
D3DXFONT_DESCW widedesc;
@ -299,11 +292,11 @@ HRESULT WINAPI D3DXCreateFontIndirectA(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_
/***********************************************************************
* D3DXCreateFontIndirectW (D3DX9_36.@)
*/
HRESULT WINAPI D3DXCreateFontIndirectW(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_DESCW *desc, LPD3DXFONT *font)
HRESULT WINAPI D3DXCreateFontIndirectW(IDirect3DDevice9 *device, const D3DXFONT_DESCW *desc, ID3DXFont **font)
{
D3DDEVICE_CREATION_PARAMETERS cpars;
D3DDISPLAYMODE mode;
ID3DXFontImpl *object;
struct d3dx_font *object;
IDirect3D9 *d3d;
HRESULT hr;
@ -322,7 +315,7 @@ HRESULT WINAPI D3DXCreateFontIndirectW(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_
}
IDirect3D9_Release(d3d);
object=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXFontImpl));
object = HeapAlloc(GetProcessHeap(), 0, sizeof(struct d3dx_font));
if(object==NULL) {
*font=NULL;
return E_OUTOFMEMORY;