diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-03-18 17:55:28 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:12:55 +0300 |
commit | 136e54a332da44772835ab57c19dd36630a36688 (patch) | |
tree | 8bad41e5646fa39fae72b1ca6c2445f3e9cfa618 /drape/symbols_texture.cpp | |
parent | a2b5bb80468f80100caa80ee54c56669c8cddda3 (diff) |
[drape] load symbols skin
Diffstat (limited to 'drape/symbols_texture.cpp')
-rw-r--r-- | drape/symbols_texture.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drape/symbols_texture.cpp b/drape/symbols_texture.cpp new file mode 100644 index 0000000000..2c6a58b8b8 --- /dev/null +++ b/drape/symbols_texture.cpp @@ -0,0 +1,25 @@ +#include "symbols_texture.hpp" + +#include "utils/lodepng.h" + +SymbolsTexture::SymbolsTexture(const string & skinPathName) +{ + uint32_t width, height; + m_desc.Load(skinPathName + ".sdf", width, height); + + vector<unsigned char> pngData; + unsigned w, h; + lodepng::decode(pngData, w, h, skinPathName + ".png"); + + ASSERT(width == w && height == h, ()); + Create(width, height, Texture::RGBA8, MakeStackRefPointer<void>(&pngData[0])); +} + +m2::RectD SymbolsTexture::FindSymbol(const string & symbolName) +{ + m2::RectU r; + if (!m_desc.GetResource(symbolName, r)) + return m2::RectD(); + + return m2::RectD(GetS(r.minX()), GetT(r.minY()), GetS(r.maxX()), GetT(r.maxY())); +} |