Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gpu_drawer.hpp « render - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d45cd2b4e8ee8f8e80ca5f95990284651bba9322 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma once

#include "drawer.hpp"

#include "graphics/screen.hpp"

#include "std/unique_ptr.hpp"

class ScreenBase;

namespace drule
{
  class BaseRule;
}

namespace graphics
{
  namespace gl
  {
    class FrameBuffer;
    class BaseTexture;
  }

  class ResourceManager;
}

class GPUDrawer : public Drawer
{
  using TBase = Drawer;

public:
  struct Params : Drawer::Params
  {
    graphics::Screen::Params m_screenParams;
  };

  GPUDrawer(Params const & params);

  graphics::Screen * Screen() const;

  void BeginFrame();
  void EndFrame();
  void OnSize(int w, int h);
  graphics::GlyphCache * GetGlyphCache() override;

  static graphics::Screen * GetScreen(Drawer * drawer);

protected:
  typedef shared_ptr<graphics::gl::BaseTexture> texture_t;
  typedef shared_ptr<graphics::gl::FrameBuffer> frame_buffer_t;

  int ThreadSlot() const;

  void DrawSymbol(m2::PointD const & pt,
                  graphics::EPosition pos,
                  di::DrawRule const & rule) override;

  void DrawCircle(m2::PointD const & pt,
                  graphics::EPosition pos,
                  di::DrawRule const & rule) override;

  void DrawCircledSymbol(m2::PointD const & pt,
                         graphics::EPosition pos,
                         di::DrawRule const & symbolRule,
                         di::DrawRule const & circleRule) override;

  void DrawPath(di::PathInfo const & path,
                di::DrawRule const * rules,
                size_t count) override;

  void DrawArea(di::AreaInfo const & area,
                di::DrawRule const & rule) override;

  void DrawText(m2::PointD const & pt,
                graphics::EPosition pos,
                di::FeatureStyler const & fs,
                di::DrawRule const & rule) override;

  void DrawPathText(di::PathInfo const & info,
                    di::FeatureStyler const & fs,
                    di::DrawRule const & rule) override;

  void DrawPathNumber(di::PathInfo const & path,
                      di::FeatureStyler const & fs,
                      di::DrawRule const & rule) override;

private:
  static void ClearResourceCache(size_t threadSlot, uint8_t pipelineID);

  unique_ptr<graphics::Screen> const m_pScreen;
};