summaryrefslogtreecommitdiffstats
path: root/xbmc/guilib/GUIFontTTFGL.h
blob: 22fbe6419b81c13d1cac0d9172573805af7949f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "GUIFontTTF.h"

#include <string>
#include <vector>

#include "system_gl.h"

class CGUIFontTTFGL : public CGUIFontTTF
{
public:
  explicit CGUIFontTTFGL(const std::string& fontIdent);
  ~CGUIFontTTFGL(void) override;

  bool FirstBegin() override;
  void LastEnd() override;

  CVertexBuffer CreateVertexBuffer(const std::vector<SVertex>& vertices) const override;
  void DestroyVertexBuffer(CVertexBuffer& bufferHandle) const override;
  static void CreateStaticVertexBuffers(void);
  static void DestroyStaticVertexBuffers(void);

protected:
  std::unique_ptr<CTexture> ReallocTexture(unsigned int& newHeight) override;
  bool CopyCharToTexture(FT_BitmapGlyph bitGlyph,
                         unsigned int x1,
                         unsigned int y1,
                         unsigned int x2,
                         unsigned int y2) override;
  void DeleteHardwareTexture() override;

  static GLuint m_elementArrayHandle;

private:
  unsigned int m_updateY1{0};
  unsigned int m_updateY2{0};

  enum TextureStatus
  {
    TEXTURE_VOID = 0,
    TEXTURE_READY,
    TEXTURE_REALLOCATED,
    TEXTURE_UPDATED,
  };

  TextureStatus m_textureStatus{TEXTURE_VOID};

  static bool m_staticVertexBufferCreated;
};