Commit 7342f34e authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3dx9_36: COM cleanup for the ID3DXFont iface.

parent 76605263
...@@ -50,21 +50,6 @@ HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, LPVOID *buffer, ...@@ -50,21 +50,6 @@ HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, LPVOID *buffer,
const PixelFormatDesc *get_format_info(D3DFORMAT format); const PixelFormatDesc *get_format_info(D3DFORMAT format);
const PixelFormatDesc *get_format_info_idx(int idx); const PixelFormatDesc *get_format_info_idx(int idx);
/* ID3DXFont */
typedef struct ID3DXFontImpl
{
/* IUnknown fields */
const ID3DXFontVtbl *lpVtbl;
LONG ref;
/* ID3DXFont fields */
IDirect3DDevice9 *device;
D3DXFONT_DESCW desc;
HDC hdc;
HFONT hfont;
} ID3DXFontImpl;
/* ID3DXMatrixStack */ /* ID3DXMatrixStack */
typedef struct ID3DXMatrixStackImpl typedef struct ID3DXMatrixStackImpl
{ {
......
...@@ -26,9 +26,26 @@ ...@@ -26,9 +26,26 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3dx); WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
static HRESULT WINAPI ID3DXFontImpl_QueryInterface(LPD3DXFONT iface, REFIID riid, LPVOID *object) typedef struct ID3DXFontImpl
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFont ID3DXFont_iface;
LONG ref;
IDirect3DDevice9 *device;
D3DXFONT_DESCW desc;
HDC hdc;
HFONT hfont;
} ID3DXFontImpl;
static inline ID3DXFontImpl *impl_from_ID3DXFont(ID3DXFont *iface)
{
return CONTAINING_RECORD(iface, ID3DXFontImpl, ID3DXFont_iface);
}
static HRESULT WINAPI ID3DXFontImpl_QueryInterface(ID3DXFont *iface, REFIID riid, void **object)
{
ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p): QueryInterface from %s\n", This, debugstr_guid(riid)); TRACE("(%p): QueryInterface from %s\n", This, debugstr_guid(riid));
if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXFont)) { if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXFont)) {
...@@ -40,17 +57,17 @@ static HRESULT WINAPI ID3DXFontImpl_QueryInterface(LPD3DXFONT iface, REFIID riid ...@@ -40,17 +57,17 @@ static HRESULT WINAPI ID3DXFontImpl_QueryInterface(LPD3DXFONT iface, REFIID riid
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI ID3DXFontImpl_AddRef(LPD3DXFONT iface) static ULONG WINAPI ID3DXFontImpl_AddRef(ID3DXFont *iface)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
ULONG ref=InterlockedIncrement(&This->ref); ULONG ref=InterlockedIncrement(&This->ref);
TRACE("(%p)->(): AddRef from %d\n", This, ref-1); TRACE("(%p)->(): AddRef from %d\n", This, ref-1);
return ref; return ref;
} }
static ULONG WINAPI ID3DXFontImpl_Release(LPD3DXFONT iface) static ULONG WINAPI ID3DXFontImpl_Release(ID3DXFont *iface)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
ULONG ref=InterlockedDecrement(&This->ref); ULONG ref=InterlockedDecrement(&This->ref);
TRACE("(%p)->(): ReleaseRef to %d\n", This, ref); TRACE("(%p)->(): ReleaseRef to %d\n", This, ref);
...@@ -64,9 +81,9 @@ static ULONG WINAPI ID3DXFontImpl_Release(LPD3DXFONT iface) ...@@ -64,9 +81,9 @@ static ULONG WINAPI ID3DXFontImpl_Release(LPD3DXFONT iface)
return ref; return ref;
} }
static HRESULT WINAPI ID3DXFontImpl_GetDevice(LPD3DXFONT iface, LPDIRECT3DDEVICE9 *device) static HRESULT WINAPI ID3DXFontImpl_GetDevice(ID3DXFont *iface, LPDIRECT3DDEVICE9 *device)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, device); TRACE("(%p)->(%p)\n", This, device);
...@@ -77,9 +94,9 @@ static HRESULT WINAPI ID3DXFontImpl_GetDevice(LPD3DXFONT iface, LPDIRECT3DDEVICE ...@@ -77,9 +94,9 @@ static HRESULT WINAPI ID3DXFontImpl_GetDevice(LPD3DXFONT iface, LPDIRECT3DDEVICE
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI ID3DXFontImpl_GetDescA(LPD3DXFONT iface, D3DXFONT_DESCA *desc) static HRESULT WINAPI ID3DXFontImpl_GetDescA(ID3DXFont *iface, D3DXFONT_DESCA *desc)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, desc); TRACE("(%p)->(%p)\n", This, desc);
...@@ -90,9 +107,9 @@ static HRESULT WINAPI ID3DXFontImpl_GetDescA(LPD3DXFONT iface, D3DXFONT_DESCA *d ...@@ -90,9 +107,9 @@ static HRESULT WINAPI ID3DXFontImpl_GetDescA(LPD3DXFONT iface, D3DXFONT_DESCA *d
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI ID3DXFontImpl_GetDescW(LPD3DXFONT iface, D3DXFONT_DESCW *desc) static HRESULT WINAPI ID3DXFontImpl_GetDescW(ID3DXFont *iface, D3DXFONT_DESCW *desc)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, desc); TRACE("(%p)->(%p)\n", This, desc);
...@@ -102,86 +119,89 @@ static HRESULT WINAPI ID3DXFontImpl_GetDescW(LPD3DXFONT iface, D3DXFONT_DESCW *d ...@@ -102,86 +119,89 @@ static HRESULT WINAPI ID3DXFontImpl_GetDescW(LPD3DXFONT iface, D3DXFONT_DESCW *d
return D3D_OK; return D3D_OK;
} }
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsA(LPD3DXFONT iface, TEXTMETRICA *metrics) static BOOL WINAPI ID3DXFontImpl_GetTextMetricsA(ID3DXFont *iface, TEXTMETRICA *metrics)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, metrics); TRACE("(%p)->(%p)\n", This, metrics);
return GetTextMetricsA(This->hdc, metrics); return GetTextMetricsA(This->hdc, metrics);
} }
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsW(LPD3DXFONT iface, TEXTMETRICW *metrics) static BOOL WINAPI ID3DXFontImpl_GetTextMetricsW(ID3DXFont *iface, TEXTMETRICW *metrics)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p)->(%p)\n", This, metrics); TRACE("(%p)->(%p)\n", This, metrics);
return GetTextMetricsW(This->hdc, metrics); return GetTextMetricsW(This->hdc, metrics);
} }
static HDC WINAPI ID3DXFontImpl_GetDC(LPD3DXFONT iface) static HDC WINAPI ID3DXFontImpl_GetDC(ID3DXFont *iface)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
return This->hdc; return This->hdc;
} }
static HRESULT WINAPI ID3DXFontImpl_GetGlyphData(LPD3DXFONT iface, UINT glyph, LPDIRECT3DTEXTURE9 *texture, RECT *blackbox, POINT *cellinc) static HRESULT WINAPI ID3DXFontImpl_GetGlyphData(ID3DXFont *iface, UINT glyph,
LPDIRECT3DTEXTURE9 *texture, RECT *blackbox, POINT *cellinc)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%u, %p, %p, %p): stub\n", This, glyph, texture, blackbox, cellinc); FIXME("(%p)->(%u, %p, %p, %p): stub\n", This, glyph, texture, blackbox, cellinc);
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters(LPD3DXFONT iface, UINT first, UINT last) static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters(ID3DXFont *iface, UINT first, UINT last)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%u, %u): stub\n", This, first, last); FIXME("(%p)->(%u, %u): stub\n", This, first, last);
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs(LPD3DXFONT iface, UINT first, UINT last) static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs(ID3DXFont *iface, UINT first, UINT last)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%u, %u): stub\n", This, first, last); FIXME("(%p)->(%u, %u): stub\n", This, first, last);
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(LPD3DXFONT iface, LPCSTR string, INT count) static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(ID3DXFont *iface, LPCSTR string, INT count)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%s, %d): stub\n", This, string, count); FIXME("(%p)->(%s, %d): stub\n", This, string, count);
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(LPD3DXFONT iface, LPCWSTR string, INT count) static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(ID3DXFont *iface, LPCWSTR string, INT count)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%s, %d): stub\n", This, debugstr_w(string), count); FIXME("(%p)->(%s, %d): stub\n", This, debugstr_w(string), count);
return D3D_OK; return D3D_OK;
} }
static INT WINAPI ID3DXFontImpl_DrawTextA(LPD3DXFONT iface, LPD3DXSPRITE sprite, LPCSTR string, INT count, LPRECT rect, DWORD format, D3DCOLOR color) static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, LPD3DXSPRITE sprite, LPCSTR string,
INT count, LPRECT rect, DWORD format, D3DCOLOR color)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%p, %s, %d, %p, %d, %#x): stub\n", This, sprite, string, count, rect, format, color); FIXME("(%p)->(%p, %s, %d, %p, %d, %#x): stub\n", This, sprite, string, count, rect, format, color);
return 1; return 1;
} }
static INT WINAPI ID3DXFontImpl_DrawTextW(LPD3DXFONT iface, LPD3DXSPRITE sprite, LPCWSTR string, INT count, LPRECT rect, DWORD format, D3DCOLOR color) static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, LPD3DXSPRITE sprite, LPCWSTR string,
INT count, LPRECT rect, DWORD format, D3DCOLOR color)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(%p, %s, %d, %p, %d, %#x): stub\n", This, sprite, debugstr_w(string), count, rect, format, color); FIXME("(%p)->(%p, %s, %d, %p, %d, %#x): stub\n", This, sprite, debugstr_w(string), count, rect, format, color);
return 1; return 1;
} }
static HRESULT WINAPI ID3DXFontImpl_OnLostDevice(LPD3DXFONT iface) static HRESULT WINAPI ID3DXFontImpl_OnLostDevice(ID3DXFont *iface)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(): stub\n", This); FIXME("(%p)->(): stub\n", This);
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI ID3DXFontImpl_OnResetDevice(LPD3DXFONT iface) static HRESULT WINAPI ID3DXFontImpl_OnResetDevice(ID3DXFont *iface)
{ {
ID3DXFontImpl *This=(ID3DXFontImpl*)iface; ID3DXFontImpl *This=impl_from_ID3DXFont(iface);
FIXME("(%p)->(): stub\n", This); FIXME("(%p)->(): stub\n", This);
return D3D_OK; return D3D_OK;
} }
...@@ -302,7 +322,7 @@ HRESULT WINAPI D3DXCreateFontIndirectW(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_ ...@@ -302,7 +322,7 @@ HRESULT WINAPI D3DXCreateFontIndirectW(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_
*font=NULL; *font=NULL;
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
object->lpVtbl=&D3DXFont_Vtbl; object->ID3DXFont_iface.lpVtbl = &D3DXFont_Vtbl;
object->ref=1; object->ref=1;
object->device=device; object->device=device;
object->desc=*desc; object->desc=*desc;
...@@ -323,7 +343,7 @@ HRESULT WINAPI D3DXCreateFontIndirectW(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_ ...@@ -323,7 +343,7 @@ HRESULT WINAPI D3DXCreateFontIndirectW(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_
SelectObject(object->hdc, object->hfont); SelectObject(object->hdc, object->hfont);
IDirect3DDevice9_AddRef(device); IDirect3DDevice9_AddRef(device);
*font=(LPD3DXFONT)object; *font=&object->ID3DXFont_iface;
return D3D_OK; return D3D_OK;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment