diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-12-30 16:06:16 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:35:48 +0300 |
commit | 5d3977bebd9fb7e68c7eec158e5ca06385372a5e (patch) | |
tree | 6990c3dc548a11c9f6ebb1faae04cc0ce1d670a0 /drape/stipple_pen_resource.cpp | |
parent | 8649b4e94cd701f124cb23b72dde6c8802fb7bb2 (diff) |
[drape] from now in drape we will use strong texturing model without texture sets.
- remove texture sets (controller and sets), applying and managing
- improve memory allocations for resources
- rewrite font texture for dynamic glyph mapping
- fragmentation unicode block on textures
- some minor stuff
Diffstat (limited to 'drape/stipple_pen_resource.cpp')
-rw-r--r-- | drape/stipple_pen_resource.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drape/stipple_pen_resource.cpp b/drape/stipple_pen_resource.cpp index 36a2e4d391..fd16237a52 100644 --- a/drape/stipple_pen_resource.cpp +++ b/drape/stipple_pen_resource.cpp @@ -14,12 +14,6 @@ namespace dp uint32_t const MAX_STIPPLE_PEN_LENGTH = 254; uint32_t const COLUMN_WIDTH = MAX_STIPPLE_PEN_LENGTH + 2; -StipplePenKey const & StipplePenKey::Solid() -{ - static StipplePenKey solidKey(buffer_vector<uint8_t, 8>((size_t)1, (uint8_t)1)); - return solidKey; -} - StipplePenPacker::StipplePenPacker(m2::PointU const & canvasSize) : m_canvasSize(canvasSize) , m_currentColumn(0) @@ -144,24 +138,22 @@ void StipplePenRasterizator::Rasterize(void * buffer) memcpy(pixels + COLUMN_WIDTH, pixels, COLUMN_WIDTH); } -StipplePenResourceInfo const * StipplePenIndex::MapResource(StipplePenKey const & key) +RefPointer<Texture::ResourceInfo> StipplePenIndex::MapResource(StipplePenKey const & key) { StipplePenHandle handle(key); - TResourceMapping::const_iterator it = m_resourceMapping.find(handle); + TResourceMapping::iterator it = m_resourceMapping.find(handle); if (it != m_resourceMapping.end()) - return it->second.GetRaw(); + return MakeStackRefPointer<Texture::ResourceInfo>(&it->second); StipplePenRasterizator resource(key); m2::RectU pixelRect = m_packer.PackResource(resource.GetSize()); m_pendingNodes.push_back(make_pair(pixelRect, resource)); - typedef pair<TResourceMapping::iterator, bool> TInsertionNode; - MasterPointer<StipplePenResourceInfo> info(new StipplePenResourceInfo(m_packer.MapTextureCoords(pixelRect), - resource.GetSize(), - resource.GetPatternSize())); - TInsertionNode result = m_resourceMapping.insert(TResourceMapping::value_type(handle, info)); - ASSERT(result.second, ()); - return result.first->second.GetRaw(); + auto res = m_resourceMapping.emplace(handle, StipplePenResourceInfo(m_packer.MapTextureCoords(pixelRect), + resource.GetSize(), + resource.GetPatternSize())); + ASSERT(res.second, ()); + return MakeStackRefPointer<Texture::ResourceInfo>(&res.first->second); } void StipplePenIndex::UploadResources(RefPointer<Texture> texture) |