diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-03-19 18:15:08 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-03-19 19:11:47 +0300 |
commit | 8cb108979523ec55b5213a719a77358f9dad47a0 (patch) | |
tree | d38494f30f3b385d3cdf4ee12fba37362773e079 /source/blender/compositor/intern/COM_MemoryBuffer.cc | |
parent | dc9aea9903d2af0b4333fcc6992fc9ea8e72876e (diff) |
Cleanup: Rename copyContentFrom to fill_from.
Diffstat (limited to 'source/blender/compositor/intern/COM_MemoryBuffer.cc')
-rw-r--r-- | source/blender/compositor/intern/COM_MemoryBuffer.cc | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index 2664612beed..b812659543b 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -132,7 +132,7 @@ float MemoryBuffer::getMaximumValue(rcti *rect) if (!BLI_rcti_is_empty(&rect_clamp)) { MemoryBuffer temp_buffer(this->m_datatype, rect_clamp); - temp_buffer.copyContentFrom(this); + temp_buffer.fill_from(*this); return temp_buffer.getMaximumValue(); } @@ -148,28 +148,23 @@ MemoryBuffer::~MemoryBuffer() } } -void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer) +void MemoryBuffer::fill_from(const MemoryBuffer &src) { - if (!otherBuffer) { - BLI_assert(0); - return; - } unsigned int otherY; - unsigned int minX = MAX2(this->m_rect.xmin, otherBuffer->m_rect.xmin); - unsigned int maxX = MIN2(this->m_rect.xmax, otherBuffer->m_rect.xmax); - unsigned int minY = MAX2(this->m_rect.ymin, otherBuffer->m_rect.ymin); - unsigned int maxY = MIN2(this->m_rect.ymax, otherBuffer->m_rect.ymax); + unsigned int minX = MAX2(this->m_rect.xmin, src.m_rect.xmin); + unsigned int maxX = MIN2(this->m_rect.xmax, src.m_rect.xmax); + unsigned int minY = MAX2(this->m_rect.ymin, src.m_rect.ymin); + unsigned int maxY = MIN2(this->m_rect.ymax, src.m_rect.ymax); int offset; int otherOffset; for (otherY = minY; otherY < maxY; otherY++) { - otherOffset = ((otherY - otherBuffer->m_rect.ymin) * otherBuffer->m_width + minX - - otherBuffer->m_rect.xmin) * + otherOffset = ((otherY - src.m_rect.ymin) * src.m_width + minX - src.m_rect.xmin) * this->m_num_channels; offset = ((otherY - this->m_rect.ymin) * this->m_width + minX - this->m_rect.xmin) * this->m_num_channels; memcpy(&this->m_buffer[offset], - &otherBuffer->m_buffer[otherOffset], + &src.m_buffer[otherOffset], (maxX - minX) * this->m_num_channels * sizeof(float)); } } |