2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
16 #include "D3DResource.h"
17 #include "GUIFontTTF.h"
23 #include <wrl/client.h>
29 class CGUIFontTTFDX
: public CGUIFontTTF
, public ID3DResource
32 explicit CGUIFontTTFDX(const std::string
& fontIdent
);
33 virtual ~CGUIFontTTFDX(void);
35 bool FirstBegin() override
;
36 void LastEnd() override
;
37 CVertexBuffer
CreateVertexBuffer(const std::vector
<SVertex
>& vertices
) const override
;
38 void DestroyVertexBuffer(CVertexBuffer
& bufferHandle
) const override
;
40 void OnDestroyDevice(bool fatal
) override
;
41 void OnCreateDevice() override
;
43 static void CreateStaticIndexBuffer(void);
44 static void DestroyStaticIndexBuffer(void);
47 std::unique_ptr
<CTexture
> ReallocTexture(unsigned int& newHeight
) override
;
48 bool CopyCharToTexture(FT_BitmapGlyph bitGlyph
,
52 unsigned int y2
) override
;
53 void DeleteHardwareTexture() override
;
56 bool UpdateDynamicVertexBuffer(const SVertex
* pSysMem
, unsigned int count
);
57 static void AddReference(CGUIFontTTFDX
* font
, CD3DBuffer
* pBuffer
);
58 static void ClearReference(CGUIFontTTFDX
* font
, CD3DBuffer
* pBuffer
);
60 unsigned m_vertexWidth
{0};
61 std::unique_ptr
<CD3DTexture
> m_speedupTexture
; // extra texture to speed up reallocations
62 Microsoft::WRL::ComPtr
<ID3D11Buffer
> m_vertexBuffer
;
63 std::list
<CD3DBuffer
*> m_buffers
;
65 static bool m_staticIndexBufferCreated
;
66 static Microsoft::WRL::ComPtr
<ID3D11Buffer
> m_staticIndexBuffer
;