本文整理汇总了C++中MemoryBuffer::convertToValueBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBuffer::convertToValueBuffer方法的具体用法?C++ MemoryBuffer::convertToValueBuffer怎么用?C++ MemoryBuffer::convertToValueBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryBuffer
的用法示例。
在下文中一共展示了MemoryBuffer::convertToValueBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void *ErodeStepOperation::initializeTileData(rcti *rect)
{
if (this->m_cached_buffer != NULL) {
return this->m_cached_buffer;
}
lockMutex();
if (this->m_cached_buffer == NULL) {
MemoryBuffer *buffer = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL);
float *rectf = buffer->convertToValueBuffer();
int x, y, i;
float *p;
int bwidth = buffer->getWidth();
int bheight = buffer->getHeight();
for (i = 0; i < this->m_iterations; i++) {
for (y = 0; y < bheight; y++) {
for (x = 0; x < bwidth - 1; x++) {
p = rectf + (bwidth * y + x);
*p = MIN2(*p, *(p + 1));
}
}
for (y = 0; y < bheight; y++) {
for (x = bwidth - 1; x >= 1; x--) {
p = rectf + (bwidth * y + x);
*p = MIN2(*p, *(p - 1));
}
}
for (x = 0; x < bwidth; x++) {
for (y = 0; y < bheight - 1; y++) {
p = rectf + (bwidth * y + x);
*p = MIN2(*p, *(p + bwidth));
}
}
for (x = 0; x < bwidth; x++) {
for (y = bheight - 1; y >= 1; y--) {
p = rectf + (bwidth * y + x);
*p = MIN2(*p, *(p - bwidth));
}
}
}
this->m_cached_buffer = rectf;
}
unlockMutex();
return this->m_cached_buffer;
}