当前位置: 首页>>代码示例>>C++>>正文


C++ MemoryBuffer::duplicate方法代码示例

本文整理汇总了C++中MemoryBuffer::duplicate方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBuffer::duplicate方法的具体用法?C++ MemoryBuffer::duplicate怎么用?C++ MemoryBuffer::duplicate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MemoryBuffer的用法示例。


在下文中一共展示了MemoryBuffer::duplicate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
{
	lockMutex();
	if (!this->m_iirgaus) {
		MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputprogram->initializeTileData(rect);
		MemoryBuffer *copy = newBuf->duplicate();
		FastGaussianBlurOperation::IIR_gauss(copy, this->m_sigma, 0, 3);

		if (this->m_overlay == FAST_GAUSS_OVERLAY_MIN) {
			float *src = newBuf->getBuffer();
			float *dst = copy->getBuffer();
			for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--, src += COM_NUM_CHANNELS_VALUE, dst += COM_NUM_CHANNELS_VALUE) {
				if (*src < *dst) {
					*dst = *src;
				}
			}
		}
		else if (this->m_overlay == FAST_GAUSS_OVERLAY_MAX) {
			float *src = newBuf->getBuffer();
			float *dst = copy->getBuffer();
			for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--, src += COM_NUM_CHANNELS_VALUE, dst += COM_NUM_CHANNELS_VALUE) {
				if (*src > *dst) {
					*dst = *src;
				}
			}
		}

//		newBuf->

		this->m_iirgaus = copy;
	}
	unlockMutex();
	return this->m_iirgaus;
}
开发者ID:wchargin,项目名称:blender,代码行数:34,代码来源:COM_FastGaussianBlurOperation.cpp

示例2:

void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
{
	lockMutex();
	if (!this->m_iirgaus) {
		MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect);
		MemoryBuffer *copy = newBuf->duplicate();
		updateSize();

		int c;
		this->m_sx = this->m_data.sizex * this->m_size / 2.0f;
		this->m_sy = this->m_data.sizey * this->m_size / 2.0f;

		if ((this->m_sx == this->m_sy) && (this->m_sx > 0.0f)) {
			for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c)
				IIR_gauss(copy, this->m_sx, c, 3);
		}
		else {
			if (this->m_sx > 0.0f) {
				for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c)
					IIR_gauss(copy, this->m_sx, c, 1);
			}
			if (this->m_sy > 0.0f) {
				for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c)
					IIR_gauss(copy, this->m_sy, c, 2);
			}
		}
		this->m_iirgaus = copy;
	}
	unlockMutex();
	return this->m_iirgaus;
}
开发者ID:wchargin,项目名称:blender,代码行数:31,代码来源:COM_FastGaussianBlurOperation.cpp

示例3: getDAI

void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
{
#if 0
	lockMutex();
	if (!this->m_iirgaus) {
		MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect);
		MemoryBuffer *copy = newBuf->duplicate();
		updateSize();

		int c;
		this->m_sx = this->m_data->sizex * this->m_size / 2.0f;
		this->m_sy = this->m_data->sizey * this->m_size / 2.0f;
		
		if ((this->m_sx == this->m_sy) && (this->m_sx > 0.f)) {
			for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c)
				IIR_gauss(copy, this->m_sx, c, 3);
		}
		else {
			if (this->m_sx > 0.0f) {
				for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c)
					IIR_gauss(copy, this->m_sx, c, 1);
			}
			if (this->m_sy > 0.0f) {
				for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c)
					IIR_gauss(copy, this->m_sy, c, 2);
			}
		}
		this->m_iirgaus = copy;
	}
	unlockMutex();
	return this->m_iirgaus;
#else

	lockMutex();
	if (this->m_iirgaus) {
		// if this->m_iirgaus is set, we don't do tile rendering, so
		// we can return the already calculated cache
		unlockMutex();
		return this->m_iirgaus;
	}
	updateSize();
	rcti dai;
	bool use_tiles = getDAI(rect, &dai);
	if (use_tiles) {
		unlockMutex();
	}

	MemoryBuffer *buffer = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL);
	rcti *buf_rect = buffer->getRect();

	dai.xmin = max(dai.xmin, buf_rect->xmin);
	dai.xmax = min(dai.xmax, buf_rect->xmax);
	dai.ymin = max(dai.ymin, buf_rect->ymin);
	dai.ymax = min(dai.ymax, buf_rect->ymax);

	MemoryBuffer *tile = new MemoryBuffer(NULL, &dai);
	tile->copyContentFrom(buffer);

	int c;
	float sx = this->m_data->sizex * this->m_size / 2.0f;
	float sy = this->m_data->sizey * this->m_size / 2.0f;

	if ((sx == sy) && (sx > 0.f)) {
		for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c)
			IIR_gauss(tile, sx, c, 3);
	}
	else {
		if (sx > 0.0f) {
			for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c)
				IIR_gauss(tile, sx, c, 1);
		}
		if (sy > 0.0f) {
			for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c)
				IIR_gauss(tile, sy, c, 2);
		}
	}
	if (!use_tiles) {
		this->m_iirgaus = tile;
		unlockMutex();
	}
	return tile;
#endif
}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:83,代码来源:COM_FastGaussianBlurOperation.cpp


注:本文中的MemoryBuffer::duplicate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。