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
path: root/drape
diff options
context:
space:
mode:
authorExMix <rahuba.youri@mapswithme.com>2015-01-06 12:03:00 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:35:54 +0300
commitac80186f7db8cee3dd7b1772f8eddfbd7f808258 (patch)
treeda3afd7261da0fd9d80975d1acf77ebd1751b528 /drape
parent15fe59a27bc750d6bd5e668e6f6ce2cd02291f16 (diff)
review fixes
Diffstat (limited to 'drape')
-rw-r--r--drape/drape_tests/drape_tests.pro2
-rw-r--r--drape/dynamic_texture.hpp9
-rw-r--r--drape/font_texture.hpp3
-rw-r--r--drape/glstate.cpp4
-rw-r--r--drape/glyph_manager.cpp2
-rw-r--r--drape/glyph_manager.hpp2
-rw-r--r--drape/render_bucket.hpp1
-rw-r--r--drape/texture_manager.cpp27
-rw-r--r--drape/texture_manager.hpp2
9 files changed, 29 insertions, 23 deletions
diff --git a/drape/drape_tests/drape_tests.pro b/drape/drape_tests/drape_tests.pro
index 6e685a3eef..ccca39b820 100644
--- a/drape/drape_tests/drape_tests.pro
+++ b/drape/drape_tests/drape_tests.pro
@@ -48,4 +48,4 @@ HEADERS += \
glmock_functions.hpp \
memory_comparer.hpp \
img.hpp \
- dummy_texture.hpp
+ dummy_texture.hpp \
diff --git a/drape/dynamic_texture.hpp b/drape/dynamic_texture.hpp
index e395cfda12..655f23c561 100644
--- a/drape/dynamic_texture.hpp
+++ b/drape/dynamic_texture.hpp
@@ -45,10 +45,13 @@ protected:
void Init(RefPointer<TIndexer> indexer, TextureParams const & params)
{
+ Init(indexer, params, MakeStackRefPointer<void>(nullptr));
+ }
+
+ void Init(RefPointer<TIndexer> indexer, TextureParams const & params, RefPointer<void> data)
+ {
m_indexer = indexer;
- vector<uint8_t> buf(params.m_size.x * params.m_size.y * 4, 0);
- Create(params.m_size.x, params.m_size.y, params.m_format, MakeStackRefPointer<void>(buf.data()));
- //Create(params.m_size.x, params.m_size.y, params.m_format);
+ Create(params.m_size.x, params.m_size.y, params.m_format, data);
SetFilterParams(params.m_minFilter, params.m_magFilter);
}
diff --git a/drape/font_texture.hpp b/drape/font_texture.hpp
index 01867d91c6..87247399a3 100644
--- a/drape/font_texture.hpp
+++ b/drape/font_texture.hpp
@@ -94,7 +94,8 @@ public:
params.m_minFilter = gl_const::GLLinear;
params.m_magFilter = gl_const::GLLinear;
- TBase::Init(MakeStackRefPointer(&m_index), params);
+ vector<uint8_t> initData(params.m_size.x * params.m_size.y, 0);
+ TBase::Init(MakeStackRefPointer(&m_index), params, MakeStackRefPointer<void>(initData.data()));
}
~FontTexture() { TBase::Reset(); }
diff --git a/drape/glstate.cpp b/drape/glstate.cpp
index 3e9dc36dae..e076d71ebd 100644
--- a/drape/glstate.cpp
+++ b/drape/glstate.cpp
@@ -96,7 +96,7 @@ void ApplyState(GLState state, RefPointer<GpuProgram> program)
RefPointer<Texture> tex = state.GetColorTexture();
if (!tex.IsNull())
{
- int8_t colorTexLoc = program->GetUniformLocation("u_colorTex");
+ int8_t const colorTexLoc = program->GetUniformLocation("u_colorTex");
GLFunctions::glActiveTexture(gl_const::GLTexture0);
tex->Bind();
GLFunctions::glUniformValuei(colorTexLoc, 0);
@@ -105,7 +105,7 @@ void ApplyState(GLState state, RefPointer<GpuProgram> program)
tex = state.GetMaskTexture();
if (!tex.IsNull())
{
- int8_t maskTexLoc = program->GetUniformLocation("u_maskTex");
+ int8_t const maskTexLoc = program->GetUniformLocation("u_maskTex");
GLFunctions::glActiveTexture(gl_const::GLTexture0 + 1);
tex->Bind();
GLFunctions::glUniformValuei(maskTexLoc, 1);
diff --git a/drape/glyph_manager.cpp b/drape/glyph_manager.cpp
index f6a2b9b64a..4c50fe997a 100644
--- a/drape/glyph_manager.cpp
+++ b/drape/glyph_manager.cpp
@@ -472,7 +472,7 @@ GlyphManager::Glyph GlyphManager::GetGlyph(strings::UniChar unicodePoint)
return GetInvalidGlyph();
}
-void GlyphManager::ForEachUnicodeBlock(GlyphManager::TUniBlockCallback const & fn)
+void GlyphManager::ForEachUnicodeBlock(GlyphManager::TUniBlockCallback const & fn) const
{
for (UnicodeBlock const & uni : m_impl->m_blocks)
fn(uni.m_start, uni.m_end);
diff --git a/drape/glyph_manager.hpp b/drape/glyph_manager.hpp
index ee4290a41e..24b4a74d92 100644
--- a/drape/glyph_manager.hpp
+++ b/drape/glyph_manager.hpp
@@ -65,7 +65,7 @@ public:
Glyph GetGlyph(strings::UniChar unicodePoints);
typedef function<void (strings::UniChar start, strings::UniChar end)> TUniBlockCallback;
- void ForEachUnicodeBlock(TUniBlockCallback const & fn);
+ void ForEachUnicodeBlock(TUniBlockCallback const & fn) const;
private:
Glyph GetInvalidGlyph() const;
diff --git a/drape/render_bucket.hpp b/drape/render_bucket.hpp
index 347cf3853e..b0964016cb 100644
--- a/drape/render_bucket.hpp
+++ b/drape/render_bucket.hpp
@@ -25,6 +25,7 @@ public:
void CollectOverlayHandles(RefPointer<OverlayTree> tree);
void Render(ScreenBase const & screen);
+ /// Only for testing! Don't use this function in production code!
template <typename ToDo>
void ForEachOverlay(ToDo const & todo)
{
diff --git a/drape/texture_manager.cpp b/drape/texture_manager.cpp
index 44807407cb..f53821789b 100644
--- a/drape/texture_manager.cpp
+++ b/drape/texture_manager.cpp
@@ -18,6 +18,9 @@
namespace dp
{
+uint32_t const STIPPLE_TEXTURE_SIZE = 1024;
+uint32_t const COLOR_TEXTURE_SIZE = 1024;
+
bool TextureManager::BaseRegion::IsValid() const
{
return !m_info.IsNull() && !m_texture.IsNull();
@@ -33,12 +36,12 @@ void TextureManager::BaseRegion::SetTexture(RefPointer<Texture> texture)
m_texture = texture;
}
-void TextureManager::BaseRegion::GetPixelSize(m2::PointU & size) const
+m2::PointU TextureManager::BaseRegion::GetPixelSize() const
{
ASSERT(IsValid(), ());
m2::RectF const & texRect = m_info->GetTexRect();
- size.x = ceil(texRect.SizeX() * m_texture->GetWidth());
- size.y = ceil(texRect.SizeY() * m_texture->GetHeight());
+ return m2::PointU(ceil(texRect.SizeX() * m_texture->GetWidth()),
+ ceil(texRect.SizeY() * m_texture->GetHeight()));
}
uint32_t TextureManager::BaseRegion::GetPixelHeight() const
@@ -124,15 +127,15 @@ void TextureManager::Init(Params const & params)
symbols->Load(my::JoinFoldersToPath(string("resources-") + params.m_resPrefix, "symbols"));
m_symbolTexture.Reset(symbols);
- m_stipplePenTexture.Reset(new StipplePenTexture(m2::PointU(1024, 1024)));
- m_colorTexture.Reset(new ColorTexture(m2::PointU(1024, 1024)));
+ m_stipplePenTexture.Reset(new StipplePenTexture(m2::PointU(STIPPLE_TEXTURE_SIZE, STIPPLE_TEXTURE_SIZE)));
+ m_colorTexture.Reset(new ColorTexture(m2::PointU(COLOR_TEXTURE_SIZE, COLOR_TEXTURE_SIZE)));
m_glyphManager.Reset(new GlyphManager(params.m_glyphMngParams));
- m_maxTextureSize = min(8192, GLFunctions::glGetInteger(gl_const::GLMaxTextureSize));
+ m_maxTextureSize = GLFunctions::glGetInteger(gl_const::GLMaxTextureSize);
- uint32_t textureSquare = m_maxTextureSize * m_maxTextureSize;
- uint32_t baseGlyphHeight = params.m_glyphMngParams.m_baseGlyphHeight;
- uint32_t avarageGlyphSquare = baseGlyphHeight * baseGlyphHeight;
+ uint32_t const textureSquare = m_maxTextureSize * m_maxTextureSize;
+ uint32_t const baseGlyphHeight = params.m_glyphMngParams.m_baseGlyphHeight;
+ uint32_t const avarageGlyphSquare = baseGlyphHeight * baseGlyphHeight;
m_glyphGroups.push_back(GlyphGroup());
uint32_t glyphCount = ceil(0.9 * textureSquare / avarageGlyphSquare);
@@ -148,9 +151,7 @@ void TextureManager::Init(Params const & params)
ASSERT_LESS_OR_EQUAL(group.m_endChar, start, ());
if (end - group.m_startChar < glyphCount)
- {
group.m_endChar = end;
- }
else
m_glyphGroups.push_back(GlyphGroup(start, end));
});
@@ -197,7 +198,7 @@ void TextureManager::GetGlyphRegions(strings::UniString const & text, TGlyphsBuf
size_t groupIndex = INVALID_GROUP;
for (strings::UniChar const & c : text)
{
- auto iter = lower_bound(m_glyphGroups.begin(), m_glyphGroups.end(), c, [](GlyphGroup const & g, strings::UniChar const & c)
+ auto const iter = lower_bound(m_glyphGroups.begin(), m_glyphGroups.end(), c, [](GlyphGroup const & g, strings::UniChar const & c)
{
return g.m_endChar < c;
});
@@ -215,7 +216,7 @@ void TextureManager::GetGlyphRegions(strings::UniString const & text, TGlyphsBuf
regions.reserve(text.size());
if (groupIndex == INVALID_GROUP)
{
- /// some magic with hybrid textures
+ /// TODO some magic with hybrid textures
}
else
{
diff --git a/drape/texture_manager.hpp b/drape/texture_manager.hpp
index 8a5ca4bbac..9b7d42616f 100644
--- a/drape/texture_manager.hpp
+++ b/drape/texture_manager.hpp
@@ -21,7 +21,7 @@ public:
RefPointer<Texture> GetTexture() const { return m_texture; }
bool IsValid() const;
- void GetPixelSize(m2::PointU & size) const;
+ m2::PointU GetPixelSize() const;
uint32_t GetPixelHeight() const;
m2::RectF const & GetTexRect() const;