Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
57
libs/drape/buffer_base.cpp
Normal file
57
libs/drape/buffer_base.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#include "drape/buffer_base.hpp"
|
||||
#include "base/assert.hpp"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
|
||||
BufferBase::BufferBase(uint8_t elementSize, uint32_t capacity)
|
||||
: m_elementSize(elementSize)
|
||||
, m_capacity(capacity)
|
||||
, m_size(0)
|
||||
{}
|
||||
|
||||
uint32_t BufferBase::GetCapacity() const
|
||||
{
|
||||
return m_capacity;
|
||||
}
|
||||
|
||||
uint32_t BufferBase::GetCurrentSize() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
uint32_t BufferBase::GetAvailableSize() const
|
||||
{
|
||||
return m_capacity - m_size;
|
||||
}
|
||||
|
||||
void BufferBase::Resize(uint32_t elementCount)
|
||||
{
|
||||
m_capacity = elementCount;
|
||||
m_size = 0;
|
||||
}
|
||||
|
||||
uint8_t BufferBase::GetElementSize() const
|
||||
{
|
||||
return m_elementSize;
|
||||
}
|
||||
|
||||
void BufferBase::Seek(uint32_t elementNumber)
|
||||
{
|
||||
ASSERT(elementNumber <= m_capacity, ());
|
||||
m_size = elementNumber;
|
||||
}
|
||||
|
||||
void BufferBase::UploadData(uint32_t elementCount)
|
||||
{
|
||||
ASSERT(m_size + elementCount <= m_capacity, ());
|
||||
m_size += elementCount;
|
||||
}
|
||||
|
||||
void BufferBase::SetDataSize(uint32_t elementCount)
|
||||
{
|
||||
ASSERT(elementCount <= m_capacity, ());
|
||||
m_size = elementCount;
|
||||
}
|
||||
|
||||
} // namespace dp
|
||||
Loading…
Add table
Add a link
Reference in a new issue