blob: d9aeb0fe2fb19148cee324b38221d765b95328cb (
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
|
#pragma once
#include "../base/mutex.hpp"
#include "../geometry/screenbase.hpp"
#include "../yg/info_layer.hpp"
#include "../yg/styles_cache.hpp"
#include "tile.hpp"
#include "tiler.hpp"
#include "render_policy.hpp"
class TileRenderer;
namespace yg
{
namespace gl
{
class Screen;
}
}
class CoverageGenerator;
struct LessRectInfo
{
bool operator()(Tile const * l, Tile const * r) const;
};
class ScreenCoverage
{
private:
TileRenderer * m_tileRenderer; //< queue to put new rendering tasks in
Tiler m_tiler; //< tiler to compute visible and predicted tiles
ScreenBase m_screen; //< last covered screen
typedef set<Tile const *, LessRectInfo> TileSet;
typedef set<Tiler::RectInfo> TileRectSet;
TileRectSet m_tileRects; //< rects, that forms a set of tiles in current rect.
TileSet m_tiles; //< set of tiles, that are visible for the m_screen
yg::InfoLayer m_infoLayer; //< composite infoLayers for visible tiles
CoverageGenerator * m_coverageGenerator;
yg::StylesCache * m_stylesCache;
ScreenCoverage(ScreenCoverage const & src);
ScreenCoverage const & operator=(ScreenCoverage const & src);
public:
ScreenCoverage();
~ScreenCoverage();
ScreenCoverage(TileRenderer * tileRenderer,
CoverageGenerator * coverageGenerator,
size_t tileSize,
size_t scaleEtalonSize);
ScreenCoverage * Clone();
void SetStylesCache(yg::StylesCache * stylesCache);
/// add rendered tile to coverage. Tile is locked, so make sure to unlock it in case it's not needed.
void Merge(Tiler::RectInfo const & ri);
/// remove tile from coverage
void Remove(Tile const * tile);
/// recalculate screen coverage, using as much info from prev coverage as possible
void SetScreen(ScreenBase const & screen, bool mergePathNames = true);
/// draw screen coverage
void Draw(yg::gl::Screen * s, ScreenBase const & currentScreen);
void EndFrame(yg::gl::Screen * s);
};
|