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

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2015-03-25 13:42:36 +0300
committerr.kuznetsov <r.kuznetsov@corp.mail.ru>2015-11-30 16:04:11 +0300
commit4bdaf1f2da5d85c9fd895824bb089a798d06009d (patch)
treea20363ce97248e9b02f313930d25ae0a702e9585 /drape/texture_manager.hpp
parent0ddaf9a46cd136117cc7193559783896ad3e2879 (diff)
Review fixes #2
Diffstat (limited to 'drape/texture_manager.hpp')
-rw-r--r--drape/texture_manager.hpp41
1 files changed, 33 insertions, 8 deletions
diff --git a/drape/texture_manager.hpp b/drape/texture_manager.hpp
index 369b758e7a..e49ca419e9 100644
--- a/drape/texture_manager.hpp
+++ b/drape/texture_manager.hpp
@@ -125,6 +125,8 @@ private:
size_t GetNumberOfUnfoundCharacters(strings::UniString const & text, HybridGlyphGroup const & group) const;
void MarkCharactersUsage(strings::UniString const & text, HybridGlyphGroup & group);
+ /// it's a dummy method to support generic code
+ void MarkCharactersUsage(strings::UniString const & text, GlyphGroup & group) {}
template<typename TGlyphGroup>
void FillResultBuffer(strings::UniString const & text, TGlyphGroup & group, TGlyphsBuffer & regions)
@@ -142,30 +144,53 @@ private:
}
}
- static constexpr size_t GetInvalidGlyphGroup();
+ template<typename TGlyphGroup>
+ void FillResults(strings::UniString const & text, TGlyphsBuffer & buffers, TGlyphGroup & group)
+ {
+ MarkCharactersUsage(text, group);
+ FillResultBuffer<TGlyphGroup>(text, group, buffers);
+ }
+
+ template<typename TGlyphGroup>
+ void FillResults(TMultilineText const & text, TMultilineGlyphsBuffer & buffers, TGlyphGroup & group)
+ {
+ buffers.resize(text.size());
+ for (size_t i = 0; i < text.size(); ++i)
+ {
+ strings::UniString const & str = text[i];
+ TGlyphsBuffer & buffer = buffers[i];
+ FillResults<TGlyphGroup>(str, buffer, group);
+ }
+ }
template<typename TText, typename TBuffer>
- void CalcGlyphRegions(TText const & text, TBuffer & buffers,
- function<void(TText const &, TBuffer &, GlyphGroup &)> callback,
- function<void(TText const &, TBuffer &, HybridGlyphGroup &)> hybridCallback)
+ void CalcGlyphRegions(TText const & text, TBuffer & buffers)
{
size_t const groupIndex = FindGlyphsGroup(text);
if (groupIndex != GetInvalidGlyphGroup())
{
GlyphGroup & group = m_glyphGroups[groupIndex];
- if (callback != nullptr)
- callback(text, buffers, group);
+ FillResults<GlyphGroup>(text, buffers, group);
}
else
{
size_t const hybridGroupIndex = FindHybridGlyphsGroup(text);
ASSERT(hybridGroupIndex != GetInvalidGlyphGroup(), ());
HybridGlyphGroup & group = m_hybridGlyphGroups[hybridGroupIndex];
- if (hybridCallback != nullptr)
- hybridCallback(text, buffers, group);
+ FillResults<HybridGlyphGroup>(text, buffers, group);
}
}
+ template<typename TGlyphGroups>
+ void UpdateGlyphTextures(TGlyphGroups & groups)
+ {
+ for (auto & g : groups)
+ if (!g.m_texture.IsNull())
+ g.m_texture->UpdateState();
+ }
+
+ static constexpr size_t GetInvalidGlyphGroup();
+
private:
MasterPointer<Texture> m_symbolTexture;
MasterPointer<Texture> m_stipplePenTexture;