Files
comaps/drape/symbols_texture.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

59 lines
1.9 KiB
C++

#pragma once
#include "drape/texture.hpp"
#include <map>
#include <string>
#include <vector>
namespace dp
{
class SymbolsTexture : public Texture
{
public:
class SymbolKey : public Key
{
public:
explicit SymbolKey(std::string const & symbolName);
ResourceType GetType() const override;
std::string const & GetSymbolName() const;
private:
std::string m_symbolName;
};
class SymbolInfo : public ResourceInfo
{
public:
explicit SymbolInfo(m2::RectF const & texRect);
ResourceType GetType() const override;
};
SymbolsTexture(ref_ptr<dp::GraphicsContext> context, std::string const & skinPathName,
std::string const & textureName, ref_ptr<HWTextureAllocator> allocator);
ref_ptr<ResourceInfo> FindResource(Key const & key, bool & newResource) override;
void Invalidate(ref_ptr<dp::GraphicsContext> context, std::string const & skinPathName,
ref_ptr<HWTextureAllocator> allocator);
void Invalidate(ref_ptr<dp::GraphicsContext> context, std::string const & skinPathName,
ref_ptr<HWTextureAllocator> allocator,
std::vector<drape_ptr<HWTexture>> & internalTextures);
bool IsSymbolContained(std::string const & symbolName) const;
static bool DecodeToMemory(std::string const & skinPathName, std::string const & textureName,
std::vector<uint8_t> & symbolsSkin,
std::map<std::string, m2::RectU> & symbolsIndex,
uint32_t & skinWidth, uint32_t & skinHeight);
private:
void Fail(ref_ptr<dp::GraphicsContext> context);
void Load(ref_ptr<dp::GraphicsContext> context, std::string const & skinPathName,
ref_ptr<HWTextureAllocator> allocator);
using TSymDefinition = std::map<std::string, SymbolInfo>;
std::string m_name;
mutable TSymDefinition m_definition;
};
} // namespace dp