[ExecString] combine SplitParameters with identical function of CUtil
[xbmc.git] / xbmc / guilib / GUIFontTTFDX.h
blobab44ce20dab8070bd35e725dcac4c98b6bef3b56
1 /*
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.
7 */
9 #pragma once
11 /*!
12 \file GUIFont.h
13 \brief
16 #include "D3DResource.h"
17 #include "GUIFontTTF.h"
19 #include <list>
20 #include <memory>
21 #include <vector>
23 #include <wrl/client.h>
25 /*!
26 \ingroup textures
27 \brief
29 class CGUIFontTTFDX : public CGUIFontTTF, public ID3DResource
31 public:
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);
46 protected:
47 std::unique_ptr<CTexture> ReallocTexture(unsigned int& newHeight) override;
48 bool CopyCharToTexture(FT_BitmapGlyph bitGlyph,
49 unsigned int x1,
50 unsigned int y1,
51 unsigned int x2,
52 unsigned int y2) override;
53 void DeleteHardwareTexture() override;
55 private:
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;