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>2013-09-18 15:45:42 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:02:45 +0300
commit968c2365395dd73218d6242a7fc2fb0f72d21fe6 (patch)
treedc5b1d3aac54d09806d7e061c6df29d8d6560e4c /drape
parent70ffc276a0aaf69000a8658cd137c2622066fb27 (diff)
[drape] review fixes
Diffstat (limited to 'drape')
-rw-r--r--drape/attribute_provider.cpp12
-rw-r--r--drape/attribute_provider.hpp4
-rw-r--r--drape/batcher.cpp30
-rw-r--r--drape/batcher.hpp22
-rw-r--r--drape/binding_info.cpp37
-rw-r--r--drape/drape.pro1
-rw-r--r--drape/glfunctions.cpp22
-rw-r--r--drape/glstate.cpp2
-rw-r--r--drape/glstate.hpp2
-rw-r--r--drape/gpu_program.cpp5
-rw-r--r--drape/gpu_program.hpp4
-rw-r--r--drape/gpu_program_manager.cpp12
-rw-r--r--drape/gpu_program_manager.hpp8
-rw-r--r--drape/pointers.hpp36
-rw-r--r--drape/texture.cpp4
-rw-r--r--drape/texture.hpp6
-rw-r--r--drape/uniform_value.cpp4
-rw-r--r--drape/uniform_value.hpp6
-rw-r--r--drape/vertex_array_buffer.cpp8
-rw-r--r--drape/vertex_array_buffer.hpp8
20 files changed, 119 insertions, 114 deletions
diff --git a/drape/attribute_provider.cpp b/drape/attribute_provider.cpp
index cdb2256e3c..3c0af9f2f4 100644
--- a/drape/attribute_provider.cpp
+++ b/drape/attribute_provider.cpp
@@ -39,28 +39,28 @@ uint8_t AttributeProvider::GetStreamCount() const
const void * AttributeProvider::GetRawPointer(uint8_t streamIndex)
{
- ASSERT(streamIndex < GetStreamCount(), ("Stream index = ", streamIndex, " out of range [0 : ", GetStreamCount(), ")"));
+ ASSERT_LESS(streamIndex, GetStreamCount(), ());
CHECK_STREAMS;
return m_streams[streamIndex].m_data.GetRaw();
}
const BindingInfo & AttributeProvider::GetBindingInfo(uint8_t streamIndex) const
{
- ASSERT(streamIndex < GetStreamCount(), ("Stream index = ", streamIndex, " out of range [0 : ", GetStreamCount(), ")"));
+ ASSERT_LESS(streamIndex, GetStreamCount(), ());
CHECK_STREAMS;
return m_streams[streamIndex].m_binding;
}
void AttributeProvider::Advance(uint16_t vertexCount)
{
- assert(m_vertexCount >= vertexCount);
+ ASSERT_LESS_OR_EQUAL(vertexCount, m_vertexCount, ());
CHECK_STREAMS;
for (size_t i = 0; i < GetStreamCount(); ++i)
{
const BindingInfo & info = m_streams[i].m_binding;
uint32_t offset = vertexCount * info.GetElementSize();
void * rawPointer = m_streams[i].m_data.GetRaw();
- m_streams[i].m_data = WeakPointer<void>((void *)(((uint8_t *)rawPointer) + offset));
+ m_streams[i].m_data = ReferencePoiner<void>((void *)(((uint8_t *)rawPointer) + offset));
}
m_vertexCount -= vertexCount;
@@ -68,9 +68,9 @@ void AttributeProvider::Advance(uint16_t vertexCount)
void AttributeProvider::InitStream(uint8_t streamIndex,
const BindingInfo &bindingInfo,
- WeakPointer<void> data)
+ ReferencePoiner<void> data)
{
- ASSERT(streamIndex < GetStreamCount(), ("Stream index = ", streamIndex, " out of range [0 : ", GetStreamCount(), ")"));
+ ASSERT_LESS(streamIndex, GetStreamCount(), ());
AttributeStream s;
s.m_binding = bindingInfo;
s.m_data = data;
diff --git a/drape/attribute_provider.hpp b/drape/attribute_provider.hpp
index 6a9b355c95..e95bd9808b 100644
--- a/drape/attribute_provider.hpp
+++ b/drape/attribute_provider.hpp
@@ -22,7 +22,7 @@ public:
void InitStream(uint8_t streamIndex,
const BindingInfo & bindingInfo,
- WeakPointer<void> data);
+ ReferencePoiner<void> data);
private:
int32_t m_vertexCount;
@@ -30,7 +30,7 @@ private:
struct AttributeStream
{
BindingInfo m_binding;
- WeakPointer<void> m_data;
+ ReferencePoiner<void> m_data;
};
vector<AttributeStream> m_streams;
#ifdef DEBUG
diff --git a/drape/batcher.cpp b/drape/batcher.cpp
index 4d4022bbf9..e1a182d94d 100644
--- a/drape/batcher.cpp
+++ b/drape/batcher.cpp
@@ -32,12 +32,12 @@ namespace
struct TrianglesListStrategy : public BaseStrategy
{
public:
- uint16_t GetIndexCount(uint16_t vertexCount)
+ uint16_t GetIndexCount(uint16_t vertexCount) const
{
return vertexCount;
}
- uint16_t GetVertexCount(uint16_t indexCount)
+ uint16_t GetVertexCount(uint16_t indexCount) const
{
return indexCount;
}
@@ -51,12 +51,12 @@ namespace
struct TrianglesStripStrategy : public BaseStrategy
{
public:
- uint16_t GetIndexCount(uint16_t vertexCount)
+ uint16_t GetIndexCount(uint16_t vertexCount) const
{
return 3* (vertexCount - 2);
}
- uint16_t GetVertexCount(uint16_t indexCount)
+ uint16_t GetVertexCount(uint16_t indexCount) const
{
return (indexCount / 3) + 2;
}
@@ -71,12 +71,12 @@ namespace
struct TrianglesFanStrategy : public BaseStrategy
{
public:
- uint16_t GetIndexCount(uint16_t vertexCount)
+ uint16_t GetIndexCount(uint16_t vertexCount) const
{
return 3* (vertexCount - 2);
}
- uint16_t GetVertexCount(uint16_t indexCount)
+ uint16_t GetVertexCount(uint16_t indexCount) const
{
return (indexCount / 3) + 2;
}
@@ -91,7 +91,7 @@ namespace
};
}
-Batcher::Batcher(WeakPointer<IBatchFlush> flushInterface)
+Batcher::Batcher(ReferencePoiner<IBatchFlush> flushInterface)
: m_flushInterface(flushInterface)
{
}
@@ -104,14 +104,14 @@ Batcher::~Batcher()
}
template <typename strategy>
-void Batcher::InsertTriangles(const GLState & state, strategy s, WeakPointer<AttributeProvider> params)
+void Batcher::InsertTriangles(const GLState & state, strategy s, ReferencePoiner<AttributeProvider> params)
{
while (params->IsDataExists())
{
uint16_t vertexCount = params->GetVertexCount();
uint16_t indexCount = s.GetIndexCount(vertexCount);
- WeakPointer<VertexArrayBuffer> buffer = GetBuffer(state);
+ ReferencePoiner<VertexArrayBuffer> buffer = GetBuffer(state);
uint16_t availableVertexCount = buffer->GetAvailableVertexCount();
uint16_t availableIndexCount = buffer->GetAvailableIndexCount();
@@ -142,7 +142,7 @@ void Batcher::InsertTriangles(const GLState & state, strategy s, WeakPointer<Att
/// upload data from params to GPU buffers
for (size_t i = 0; i < params->GetStreamCount(); ++i)
{
- WeakPointer<GLBuffer> streamBuffer = buffer->GetBuffer(params->GetBindingInfo(i));
+ ReferencePoiner<GLBuffer> streamBuffer = buffer->GetBuffer(params->GetBindingInfo(i));
streamBuffer->UploadData(params->GetRawPointer(i), vertexCount);
}
@@ -152,17 +152,17 @@ void Batcher::InsertTriangles(const GLState & state, strategy s, WeakPointer<Att
}
}
-void Batcher::InsertTriangleList(const GLState & state, WeakPointer<AttributeProvider> params)
+void Batcher::InsertTriangleList(const GLState & state, ReferencePoiner<AttributeProvider> params)
{
InsertTriangles(state, TrianglesListStrategy(), params);
}
-void Batcher::InsertTriangleStrip(const GLState & state, WeakPointer<AttributeProvider> params)
+void Batcher::InsertTriangleStrip(const GLState & state, ReferencePoiner<AttributeProvider> params)
{
InsertTriangles(state, TrianglesStripStrategy(), params);
}
-void Batcher::InsertTriangleFan(const GLState & state, WeakPointer<AttributeProvider> params)
+void Batcher::InsertTriangleFan(const GLState & state, ReferencePoiner<AttributeProvider> params)
{
InsertTriangles(state, TrianglesFanStrategy(), params);
}
@@ -173,13 +173,13 @@ void Batcher::RequestIncompleteBuckets()
m_flushInterface->UseIncompleteBucket(it->first, it->second.GetWeakPointer());
}
-WeakPointer<VertexArrayBuffer> Batcher::GetBuffer(const GLState & state)
+ReferencePoiner<VertexArrayBuffer> Batcher::GetBuffer(const GLState & state)
{
buckets_t::iterator it = m_buckets.find(state);
if (it != m_buckets.end())
return it->second.GetWeakPointer();
- StrongPointer<VertexArrayBuffer> buffer(new VertexArrayBuffer(768, 512));
+ OwnedPointer<VertexArrayBuffer> buffer(new VertexArrayBuffer(768, 512));
m_buckets.insert(make_pair(state, buffer));
return buffer.GetWeakPointer();
}
diff --git a/drape/batcher.hpp b/drape/batcher.hpp
index 1268208ef2..16479c46cd 100644
--- a/drape/batcher.hpp
+++ b/drape/batcher.hpp
@@ -11,35 +11,35 @@ class IBatchFlush
public:
virtual ~IBatchFlush() {}
- virtual void FlushFullBucket(const GLState & state, StrongPointer<VertexArrayBuffer> backet) = 0;
- virtual void UseIncompleteBucket(const GLState & state, WeakPointer<VertexArrayBuffer> backet) = 0;
+ virtual void FlushFullBucket(const GLState & state, OwnedPointer<VertexArrayBuffer> backet) = 0;
+ virtual void UseIncompleteBucket(const GLState & state, ReferencePoiner<VertexArrayBuffer> backet) = 0;
};
class Batcher
{
public:
- Batcher(WeakPointer<IBatchFlush> flushInterface);
+ Batcher(ReferencePoiner<IBatchFlush> flushInterface);
~Batcher();
- void InsertTriangleList(const GLState & state, WeakPointer<AttributeProvider> params);
- void InsertTriangleStrip(const GLState & state, WeakPointer<AttributeProvider> params);
- void InsertTriangleFan(const GLState & state, WeakPointer<AttributeProvider> params);
+ void InsertTriangleList(const GLState & state, ReferencePoiner<AttributeProvider> params);
+ void InsertTriangleStrip(const GLState & state, ReferencePoiner<AttributeProvider> params);
+ void InsertTriangleFan(const GLState & state, ReferencePoiner<AttributeProvider> params);
void RequestIncompleteBuckets();
private:
template <typename strategy>
- void InsertTriangles(const GLState & state, strategy s, WeakPointer<AttributeProvider> params);
+ void InsertTriangles(const GLState & state, strategy s, ReferencePoiner<AttributeProvider> params);
- WeakPointer<VertexArrayBuffer> GetBuffer(const GLState & state);
+ ReferencePoiner<VertexArrayBuffer> GetBuffer(const GLState & state);
/// return true if GLBuffer is finished
- bool UploadBufferData(WeakPointer<GLBuffer> vertexBuffer, WeakPointer<AttributeProvider> params);
+ bool UploadBufferData(ReferencePoiner<GLBuffer> vertexBuffer, ReferencePoiner<AttributeProvider> params);
void FinalizeBuffer(const GLState & state);
private:
- WeakPointer<IBatchFlush> m_flushInterface;
+ ReferencePoiner<IBatchFlush> m_flushInterface;
private:
- typedef map<GLState, StrongPointer<VertexArrayBuffer> > buckets_t;
+ typedef map<GLState, OwnedPointer<VertexArrayBuffer> > buckets_t;
buckets_t m_buckets;
};
diff --git a/drape/binding_info.cpp b/drape/binding_info.cpp
index 5cc23cfe9d..f80face487 100644
--- a/drape/binding_info.cpp
+++ b/drape/binding_info.cpp
@@ -2,25 +2,26 @@
#include "../base/assert.hpp"
-#ifdef DEBUG
-#include "glIncludes.hpp"
-uint16_t sizeOfType(glConst type)
+namespace
{
- if (type == GLConst::GLByteType || type == GLConst::GLUnsignedByteType)
- return sizeof(GLbyte);
- else if (type == GLConst::GLShortType || type == GLConst::GLUnsignedShortType)
- return sizeof(GLshort);
- else if (type == GLConst::GLIntType || type == GLConst::GLUnsignedIntType)
- return sizeof(GLint);
- else if (type == GLConst::GLFloatType)
- return sizeof(GLfloat);
- else if (type == GLConst::GLDoubleType)
- return sizeof(GLdouble);
+ #include "glIncludes.hpp"
+ uint16_t sizeOfType(glConst type)
+ {
+ if (type == GLConst::GLByteType || type == GLConst::GLUnsignedByteType)
+ return sizeof(GLbyte);
+ else if (type == GLConst::GLShortType || type == GLConst::GLUnsignedShortType)
+ return sizeof(GLshort);
+ else if (type == GLConst::GLIntType || type == GLConst::GLUnsignedIntType)
+ return sizeof(GLint);
+ else if (type == GLConst::GLFloatType)
+ return sizeof(GLfloat);
+ else if (type == GLConst::GLDoubleType)
+ return sizeof(GLdouble);
- ASSERT(false, ());
- return 0;
+ ASSERT(false, ());
+ return 0;
+ }
}
-#endif
BindingInfo::BindingInfo()
{
@@ -44,13 +45,13 @@ uint16_t BindingInfo::GetCount() const
const BindingDecl & BindingInfo::GetBindingDecl(uint16_t index) const
{
- ASSERT(index < m_size, ("Binding decl index = ", index, " out of range [0 : ", m_size, ")"));
+ ASSERT_LESS(index, m_size, ());
return m_bindings[index];
}
BindingDecl & BindingInfo::GetBindingDecl(uint16_t index)
{
- ASSERT(index < m_size, ("Binding decl index = ", index, " out of range [0 : ", m_size, ")"));
+ ASSERT_LESS(index, m_size, ());
return m_bindings[index];
}
diff --git a/drape/drape.pro b/drape/drape.pro
index 3d6057825f..6165562e1b 100644
--- a/drape/drape.pro
+++ b/drape/drape.pro
@@ -7,7 +7,6 @@
TARGET = drape
TEMPLATE = lib
CONFIG += staticlib warn_on
-DEFINES += DRAPE_ENGINE
DEPENDENCIES = base
diff --git a/drape/glfunctions.cpp b/drape/glfunctions.cpp
index 15d4f8ff47..99a9ee519f 100644
--- a/drape/glfunctions.cpp
+++ b/drape/glfunctions.cpp
@@ -6,10 +6,7 @@ namespace
{
inline GLboolean convert(bool v)
{
- if (v)
- return GL_TRUE;
-
- return GL_FALSE;
+ return (v == true) ? GL_TRUE : GL_FALSE;
}
/// VAO
@@ -155,8 +152,19 @@ void GLFunctions::Init()
bool GLFunctions::glHasExtension(const string & name)
{
- string allExtensions(reinterpret_cast<char const * >(glGetString(GL_EXTENSIONS)));
- return allExtensions.find(name) != string::npos;
+ const char * extensions = reinterpret_cast<char const * >(glGetString(GL_EXTENSIONS));
+ const char * extName = name.c_str();
+ const char * ptr = NULL;
+ while ((ptr = strstr(extensions, extName)) != NULL)
+ {
+ const char * end = ptr + strlen(extName);
+ if (isspace(*end) || *end == '\0')
+ return true;
+
+ extensions = ptr;
+ }
+
+ return false;
}
int GLFunctions::glGenVertexArray()
@@ -227,7 +235,7 @@ void GLFunctions::glShaderSource(uint32_t shaderID, const string & src)
GLCHECK(glShaderSourceFn(shaderID, 1, &source, &length));
}
-bool GLFunctions::glCompileShader(uint32_t shaderID, std::string &errorLog)
+bool GLFunctions::glCompileShader(uint32_t shaderID, string &errorLog)
{
ASSERT(glCompileShaderFn != NULL, ());
ASSERT(glGetShaderivFn != NULL, ());
diff --git a/drape/glstate.cpp b/drape/glstate.cpp
index 32b848390e..634c114183 100644
--- a/drape/glstate.cpp
+++ b/drape/glstate.cpp
@@ -33,7 +33,7 @@ vector<UniformValue> & GLState::GetUniformValues()
return m_uniforms;
}
-void ApplyState(GLState state, WeakPointer<GpuProgram> program)
+void ApplyState(GLState state, ReferencePoiner<GpuProgram> program)
{
TextureBinding & binding = state.GetTextureBinding();
program->Bind();
diff --git a/drape/glstate.hpp b/drape/glstate.hpp
index 93b0c47647..95f0688323 100644
--- a/drape/glstate.hpp
+++ b/drape/glstate.hpp
@@ -32,4 +32,4 @@ private:
vector<UniformValue> m_uniforms;
};
-void ApplyState(GLState state, WeakPointer<GpuProgram> program);
+void ApplyState(GLState state, ReferencePoiner<GpuProgram> program);
diff --git a/drape/gpu_program.cpp b/drape/gpu_program.cpp
index 2d447e471d..1e3613c4c3 100644
--- a/drape/gpu_program.cpp
+++ b/drape/gpu_program.cpp
@@ -3,7 +3,7 @@
#include "../base/assert.hpp"
-GpuProgram::GpuProgram(WeakPointer<ShaderReference> vertexShader, WeakPointer<ShaderReference> fragmentShader)
+GpuProgram::GpuProgram(ReferencePoiner<ShaderReference> vertexShader, ReferencePoiner<ShaderReference> fragmentShader)
{
vertexShader->Ref();
fragmentShader->Ref();
@@ -13,8 +13,7 @@ GpuProgram::GpuProgram(WeakPointer<ShaderReference> vertexShader, WeakPointer<Sh
GLFunctions::glAttachShader(m_programID, fragmentShader->GetID());
string errorLog;
- if (!GLFunctions::glLinkProgram(m_programID, errorLog))
- ASSERT(false, ());
+ VERIFY(GLFunctions::glLinkProgram(m_programID, errorLog), ());
GLFunctions::glDetachShader(m_programID, vertexShader->GetID());
GLFunctions::glDetachShader(m_programID, fragmentShader->GetID());
diff --git a/drape/gpu_program.hpp b/drape/gpu_program.hpp
index 4de6ef2a58..74f7285bd2 100644
--- a/drape/gpu_program.hpp
+++ b/drape/gpu_program.hpp
@@ -8,8 +8,8 @@
class GpuProgram
{
public:
- GpuProgram(WeakPointer<ShaderReference> vertexShader,
- WeakPointer<ShaderReference> fragmentShader);
+ GpuProgram(ReferencePoiner<ShaderReference> vertexShader,
+ ReferencePoiner<ShaderReference> fragmentShader);
~GpuProgram();
void Bind();
diff --git a/drape/gpu_program_manager.cpp b/drape/gpu_program_manager.cpp
index 55eadb3f3a..221241e2b2 100644
--- a/drape/gpu_program_manager.cpp
+++ b/drape/gpu_program_manager.cpp
@@ -72,31 +72,31 @@ GpuProgramManager::~GpuProgramManager()
pit->second.Destroy();
}
-WeakPointer<GpuProgram> GpuProgramManager::GetProgram(int index)
+ReferencePoiner<GpuProgram> GpuProgramManager::GetProgram(int index)
{
program_map_t::iterator it = m_programs.find(index);
if (it != m_programs.end())
return it->second.GetWeakPointer();
ShadersInfo const & shaders = s_mapper.GetShaders(index);
- WeakPointer<ShaderReference> vertexShader = GetShader(shaders.VertexShaderIndex,
+ ReferencePoiner<ShaderReference> vertexShader = GetShader(shaders.VertexShaderIndex,
shaders.VertexShaderSource,
ShaderReference::VertexShader);
- WeakPointer<ShaderReference> fragmentShader = GetShader(shaders.FragmentShaderIndex,
+ ReferencePoiner<ShaderReference> fragmentShader = GetShader(shaders.FragmentShaderIndex,
shaders.FragmentShaderSource,
ShaderReference::FragmentShader);
- StrongPointer<GpuProgram> p(new GpuProgram(vertexShader, fragmentShader));
+ OwnedPointer<GpuProgram> p(new GpuProgram(vertexShader, fragmentShader));
m_programs.insert(std::make_pair(index, p));
return p.GetWeakPointer();
}
-WeakPointer<ShaderReference> GpuProgramManager::GetShader(int index, const string & source, ShaderReference::Type t)
+ReferencePoiner<ShaderReference> GpuProgramManager::GetShader(int index, const string & source, ShaderReference::Type t)
{
shader_map_t::iterator it = m_shaders.find(index);
if (it == m_shaders.end())
{
- StrongPointer<ShaderReference> r(new ShaderReference(source, t));
+ OwnedPointer<ShaderReference> r(new ShaderReference(source, t));
r->Ref();
m_shaders.insert(std::make_pair(index, r));
}
diff --git a/drape/gpu_program_manager.hpp b/drape/gpu_program_manager.hpp
index ebcc223fb1..c97dc59dd2 100644
--- a/drape/gpu_program_manager.hpp
+++ b/drape/gpu_program_manager.hpp
@@ -13,14 +13,14 @@ public:
GpuProgramManager();
~GpuProgramManager();
- WeakPointer<GpuProgram> GetProgram(int index);
+ ReferencePoiner<GpuProgram> GetProgram(int index);
private:
- WeakPointer<ShaderReference> GetShader(int index, const string & source, ShaderReference::Type t);
+ ReferencePoiner<ShaderReference> GetShader(int index, const string & source, ShaderReference::Type t);
private:
- typedef map<int, StrongPointer<GpuProgram> > program_map_t;
- typedef map<int, StrongPointer<ShaderReference> > shader_map_t;
+ typedef map<int, OwnedPointer<GpuProgram> > program_map_t;
+ typedef map<int, OwnedPointer<ShaderReference> > shader_map_t;
program_map_t m_programs;
shader_map_t m_shaders;
};
diff --git a/drape/pointers.hpp b/drape/pointers.hpp
index 978fb52730..0edadc764d 100644
--- a/drape/pointers.hpp
+++ b/drape/pointers.hpp
@@ -3,15 +3,15 @@
#include <cassert>
template <typename T>
-class WeakPointer
+class ReferencePoiner
{
public:
- WeakPointer()
+ ReferencePoiner()
: m_p(NULL)
{
}
- WeakPointer(T * p)
+ ReferencePoiner(T * p)
: m_p(p)
{
}
@@ -41,12 +41,12 @@ public:
return m_p;
}
- bool operator != (const WeakPointer<T> & other) const
+ bool operator != (const ReferencePoiner<T> & other) const
{
return *m_p != *other.m_p;
}
- bool operator < (const WeakPointer<T> & other) const
+ bool operator < (const ReferencePoiner<T> & other) const
{
return *m_p < *other.m_p;
}
@@ -56,23 +56,21 @@ private:
};
template <typename T>
-class StrongPointer
+class OwnedPointer
{
public:
- StrongPointer()
+ OwnedPointer()
: m_p(NULL)
{
-
}
- StrongPointer(T * p)
+ OwnedPointer(T * p)
: m_p(p)
{
}
- ~StrongPointer()
+ ~OwnedPointer()
{
- //assert(m_p == NULL);
}
void Reset(T * p)
@@ -87,20 +85,20 @@ public:
m_p = NULL;
}
- WeakPointer<T> GetWeakPointer()
+ ReferencePoiner<T> GetWeakPointer()
{
- return WeakPointer<T>(m_p);
+ return ReferencePoiner<T>(m_p);
}
- const WeakPointer<T> GetWeakPointer() const
+ const ReferencePoiner<T> GetWeakPointer() const
{
- return WeakPointer<T>(m_p);
+ return ReferencePoiner<T>(m_p);
}
template <typename U>
- WeakPointer<U> GetWeakPointer()
+ ReferencePoiner<U> GetWeakPointer()
{
- return WeakPointer<U>(m_p);
+ return ReferencePoiner<U>(m_p);
}
bool IsNull()
@@ -128,12 +126,12 @@ public:
return m_p;
}
- bool operator != (const StrongPointer<T> & other) const
+ bool operator != (const OwnedPointer<T> & other) const
{
return *m_p != *other.m_p;
}
- bool operator < (const StrongPointer<T> & other) const
+ bool operator < (const OwnedPointer<T> & other) const
{
return *m_p < *other.m_p;
}
diff --git a/drape/texture.cpp b/drape/texture.cpp
index 6d769bd69a..1eabe609c2 100644
--- a/drape/texture.cpp
+++ b/drape/texture.cpp
@@ -54,7 +54,7 @@ void Texture::Init(const TextureInfo &info, void * data)
TextureBinding::TextureBinding(const std::string & uniformName,
bool isEnabled,
uint8_t samplerBlock,
- WeakPointer<Texture> texture)
+ ReferencePoiner<Texture> texture)
: m_uniformName(uniformName)
, m_isEnabled(isEnabled)
, m_samplerBlock(samplerBlock)
@@ -87,7 +87,7 @@ void TextureBinding::SetIsEnabled(bool isEnabled)
m_isEnabled = isEnabled;
}
-void TextureBinding::SetTexture(WeakPointer<Texture> texture)
+void TextureBinding::SetTexture(ReferencePoiner<Texture> texture)
{
m_texture = texture;
}
diff --git a/drape/texture.hpp b/drape/texture.hpp
index f03724d2a9..4d18f11163 100644
--- a/drape/texture.hpp
+++ b/drape/texture.hpp
@@ -56,13 +56,13 @@ private:
class TextureBinding
{
public:
- TextureBinding(const string & uniformName, bool isEnabled, uint8_t samplerBlock, WeakPointer<Texture> texture);
+ TextureBinding(const string & uniformName, bool isEnabled, uint8_t samplerBlock, ReferencePoiner<Texture> texture);
void Bind(int8_t uniformLocation);
bool IsEnabled() const;
const string & GetUniformName() const;
void SetIsEnabled(bool isEnabled);
- void SetTexture(WeakPointer<Texture> texture);
+ void SetTexture(ReferencePoiner<Texture> texture);
bool operator<(const TextureBinding & other) const
{
@@ -75,5 +75,5 @@ private:
string m_uniformName;
bool m_isEnabled;
uint8_t m_samplerBlock;
- WeakPointer<Texture> m_texture;
+ ReferencePoiner<Texture> m_texture;
};
diff --git a/drape/uniform_value.cpp b/drape/uniform_value.cpp
index 406d4af652..c0d330f590 100644
--- a/drape/uniform_value.cpp
+++ b/drape/uniform_value.cpp
@@ -128,7 +128,7 @@ UniformValue::UniformValue(const string & name, float * matrixValue)
m_componentCount = 16;
}
-void UniformValue::Apply(WeakPointer<GpuProgram> program)
+void UniformValue::Apply(ReferencePoiner<GpuProgram> program)
{
uint8_t location = program->GetUniformLocation(m_name);
switch (m_type) {
@@ -148,5 +148,5 @@ void UniformValue::Apply(WeakPointer<GpuProgram> program)
void UniformValue::Allocate(size_t byteCount)
{
- m_values = make_shared_ptr(new uint8_t[byteCount]);
+ m_values.reset(new uint8_t[byteCount]);
}
diff --git a/drape/uniform_value.hpp b/drape/uniform_value.hpp
index cd02d3e6eb..b4528f09e9 100644
--- a/drape/uniform_value.hpp
+++ b/drape/uniform_value.hpp
@@ -4,7 +4,7 @@
#include "gpu_program.hpp"
#include "../std/string.hpp"
-#include "../std/shared_ptr.hpp"
+#include "../std/shared_array.hpp"
class UniformValue
{
@@ -21,7 +21,7 @@ public:
UniformValue(const string & name, float * matrixValue);
- void Apply(WeakPointer<GpuProgram> program);
+ void Apply(ReferencePoiner<GpuProgram> program);
bool operator<(const UniformValue & other) const
{
@@ -53,5 +53,5 @@ private:
Type m_type;
size_t m_componentCount;
- shared_ptr<uint8_t> m_values;
+ shared_array<uint8_t> m_values;
};
diff --git a/drape/vertex_array_buffer.cpp b/drape/vertex_array_buffer.cpp
index 2b684198dd..3afa8cde4f 100644
--- a/drape/vertex_array_buffer.cpp
+++ b/drape/vertex_array_buffer.cpp
@@ -39,7 +39,7 @@ void VertexArrayBuffer::Render()
GLFunctions::glDrawElements(m_indexBuffer->GetCurrentSize());
}
-void VertexArrayBuffer::BuildVertexArray(WeakPointer<GpuProgram> program)
+void VertexArrayBuffer::BuildVertexArray(ReferencePoiner<GpuProgram> program)
{
if (m_buffers.empty())
return;
@@ -51,7 +51,7 @@ void VertexArrayBuffer::BuildVertexArray(WeakPointer<GpuProgram> program)
for (; it != m_buffers.end(); ++it)
{
const BindingInfo & binding = it->first;
- WeakPointer<DataBuffer> buffer = it->second.GetWeakPointer();
+ ReferencePoiner<DataBuffer> buffer = it->second.GetWeakPointer();
buffer->Bind();
for (uint16_t i = 0; i < binding.GetCount(); ++i)
@@ -76,12 +76,12 @@ void VertexArrayBuffer::BuildVertexArray(WeakPointer<GpuProgram> program)
program->Unbind();
}
-WeakPointer<GLBuffer> VertexArrayBuffer::GetBuffer(const BindingInfo & bindingInfo)
+ReferencePoiner<GLBuffer> VertexArrayBuffer::GetBuffer(const BindingInfo & bindingInfo)
{
buffers_map_t::iterator it = m_buffers.find(bindingInfo);
if (it == m_buffers.end())
{
- StrongPointer<DataBuffer> buffer(new DataBuffer(bindingInfo.GetElementSize(), m_dataBufferSize));
+ OwnedPointer<DataBuffer> buffer(new DataBuffer(bindingInfo.GetElementSize(), m_dataBufferSize));
m_buffers.insert(make_pair(bindingInfo, buffer));
return buffer.GetWeakPointer<GLBuffer>();
}
diff --git a/drape/vertex_array_buffer.hpp b/drape/vertex_array_buffer.hpp
index bc841949ec..d7dbbbd31f 100644
--- a/drape/vertex_array_buffer.hpp
+++ b/drape/vertex_array_buffer.hpp
@@ -18,9 +18,9 @@ public:
void Unbind();
void Render();
- void BuildVertexArray(WeakPointer<GpuProgram> program);
+ void BuildVertexArray(ReferencePoiner<GpuProgram> program);
- WeakPointer<GLBuffer> GetBuffer(const BindingInfo & bindingInfo);
+ ReferencePoiner<GLBuffer> GetBuffer(const BindingInfo & bindingInfo);
uint16_t GetAvailableVertexCount() const;
uint16_t GetAvailableIndexCount() const;
@@ -29,9 +29,9 @@ public:
private:
int m_VAO;
- typedef map<BindingInfo, StrongPointer<DataBuffer> > buffers_map_t;
+ typedef map<BindingInfo, OwnedPointer<DataBuffer> > buffers_map_t;
buffers_map_t m_buffers;
- StrongPointer<IndexBuffer> m_indexBuffer;
+ OwnedPointer<IndexBuffer> m_indexBuffer;
uint32_t m_dataBufferSize;
};