25 #include "lv_buffer.h"
26 #include "lv_common.h"
49 void wrap (
void* data_, std::size_t size_,
bool own)
98 self->m_impl->wrap (data, size, own);
107 self->m_impl->allocate (size);
124 m_impl->wrap (data, size,
false);
134 m_impl->wrap (data, m_impl->size,
false);
139 m_impl->allocate (size);
149 return static_cast<uint8_t*
> (m_impl->data) + offset;
159 return m_impl->is_owner;
164 m_impl->allocate (src->m_impl->size);
165 visual_mem_copy (m_impl->data, src->m_impl->data, src->m_impl->size);
170 visual_return_if_fail (dest !=
nullptr);
172 visual_mem_copy (dest, m_impl->data, std::min (size, m_impl->size));
177 copy_to (dest->get_data (), dest->get_size ());
182 put (src->m_impl->data, src->m_impl->size, offset);
185 void Buffer::put (
void const* data, std::size_t size, std::size_t offset)
187 visual_return_if_fail (data !=
nullptr);
188 visual_return_if_fail (offset < m_impl->size);
190 size = std::min (m_impl->size - offset, size);
192 visual_mem_copy (static_cast<uint8_t*> (m_impl->data) + offset, data, size);
197 visual_mem_set (m_impl->data, value, m_impl->size);
202 visual_return_if_fail (data !=
nullptr);
204 for (std::size_t offset = 0; offset < m_impl->size; offset += size)
205 put (data, size, offset);