[4/6] d3dx9: Implement ID3DXFont_GetDC

Stefan Dösinger stefandoesinger at gmx.at
Wed Jun 17 12:34:48 CDT 2009


Am Wednesday 17 June 2009 18:29:57 schrieb Tony Wasserka:

> @@ -300,6 +301,12 @@ HRESULT WINAPI 
D3DXCreateFontIndirectW(LPDIRECT3DDEVICE9 device, CONST D3DXFONT_
>     object->device=device;
>     object->desc=*desc;
>
> +    object->hdc = CreateCompatibleDC(NULL);
Device contexts are scarce resources, please avoid holding one all the time. 
Instead, create it in GetDC and destroy it in ReleaseDC. Besides this, after 
ReleaseDC the DC is supposed to be invalid - the only way to do this is to 
destroy it.
(Yes, I know that's broken in wined3d too. Needs fixing there as well)

You'll also have to attach the DC to the font bitmap, or whatever you have, to 
have it draw to the correct device. I think the current code means that the 
DC will draw to the screen directly, which is maybe not what you want.

If the font has a d3d surface underneath, you should use d3dsurface9::GetDC



More information about the wine-devel mailing list