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

symbols_texture.hpp « drape - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 219f7f4e53321e0207b89b316b49241eab757217 (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
#pragma once

#include "drape/texture.hpp"

#include "std/string.hpp"
#include "std/map.hpp"
#include "std/vector.hpp"

namespace dp
{

class SymbolsTexture : public Texture
{
public:
  class SymbolKey : public Key
  {
  public:
    SymbolKey(string const & symbolName);
    virtual ResourceType GetType() const;
    string const & GetSymbolName() const;

  private:
    string m_symbolName;
  };

  class SymbolInfo : public ResourceInfo
  {
  public:
    SymbolInfo(m2::RectF const & texRect);
    virtual ResourceType GetType() const;
  };

  explicit SymbolsTexture(string const & skinPathName, ref_ptr<HWTextureAllocator> allocator);

  ref_ptr<ResourceInfo> FindResource(Key const & key, bool & newResource) override;

  void Invalidate(string const & skinPathName, ref_ptr<HWTextureAllocator> allocator);

  static bool DecodeToMemory(string const & skinPathName, vector<uint8_t> & symbolsSkin,
                             map<string, m2::RectU> & symbolsIndex,
                             uint32_t & skinWidth, uint32_t & skinHeight);
private:
  void Fail();
  void Load(string const & skinPathName, ref_ptr<HWTextureAllocator> allocator);

  typedef map<string, SymbolInfo> TSymDefinition;
  mutable TSymDefinition m_definition;
};

} // namespace dp