diff options
Diffstat (limited to 'source/blender')
13 files changed, 72 insertions, 70 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index d69fe238e61..46c99623244 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -47,7 +47,7 @@ int MemoryBuffer::getHeight() const return this->m_height; } -MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti &rect) +MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, const rcti &rect) { m_rect = rect; this->m_width = BLI_rcti_size_x(&this->m_rect); @@ -61,7 +61,7 @@ MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, r this->m_datatype = memoryProxy->getDataType(); } -MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, rcti &rect) +MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect) { m_rect = rect; this->m_width = BLI_rcti_size_x(&this->m_rect); @@ -74,7 +74,7 @@ MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, rcti &rect) this->m_state = COM_MB_TEMPORARILY; this->m_datatype = memoryProxy->getDataType(); } -MemoryBuffer::MemoryBuffer(DataType dataType, rcti &rect) +MemoryBuffer::MemoryBuffer(DataType dataType, const rcti &rect) { m_rect = rect; this->m_width = BLI_rcti_size_x(&this->m_rect); diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 3242f4a3d75..b80124ca136 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -98,17 +98,17 @@ class MemoryBuffer { /** * \brief construct new MemoryBuffer for a chunk */ - MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti &rect); + MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, const rcti &rect); /** * \brief construct new temporarily MemoryBuffer for an area */ - MemoryBuffer(MemoryProxy *memoryProxy, rcti &rect); + MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect); /** * \brief construct new temporarily MemoryBuffer for an area */ - MemoryBuffer(DataType datatype, rcti &rect); + MemoryBuffer(DataType datatype, const rcti &rect); /** * \brief destructor @@ -319,9 +319,9 @@ class MemoryBuffer { /** * \brief get the rect of this MemoryBuffer */ - rcti *getRect() + const rcti &get_rect() const { - return &this->m_rect; + return this->m_rect; } /** diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cc b/source/blender/compositor/intern/COM_OpenCLDevice.cc index 838376d2e63..d5aed2052ac 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cc +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cc @@ -152,8 +152,8 @@ void OpenCLDevice::COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel ker { if (offsetIndex != -1) { cl_int error; - rcti *rect = memoryBuffer->getRect(); - cl_int2 offset = {{rect->xmin, rect->ymin}}; + const rcti &rect = memoryBuffer->get_rect(); + cl_int2 offset = {{rect.xmin, rect.ymin}}; error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset); if (error != CL_SUCCESS) { diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cc b/source/blender/compositor/operations/COM_BokehBlurOperation.cc index b0ab3906b60..7bb8cd49bfc 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cc @@ -80,10 +80,11 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) if (tempBoundingBox[0] > 0.0f) { float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; MemoryBuffer *inputBuffer = (MemoryBuffer *)data; + const rcti &input_rect = inputBuffer->get_rect(); float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); - int bufferstartx = inputBuffer->getRect()->xmin; - int bufferstarty = inputBuffer->getRect()->ymin; + int bufferstartx = input_rect.xmin; + int bufferstarty = input_rect.ymin; const float max_dim = MAX2(this->getWidth(), this->getHeight()); int pixelSize = this->m_size * max_dim / 100.0f; zero_v4(color_accum); @@ -99,10 +100,10 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) int maxy = y + pixelSize; int minx = x - pixelSize; int maxx = x + pixelSize; - miny = MAX2(miny, inputBuffer->getRect()->ymin); - minx = MAX2(minx, inputBuffer->getRect()->xmin); - maxy = MIN2(maxy, inputBuffer->getRect()->ymax); - maxx = MIN2(maxx, inputBuffer->getRect()->xmax); + miny = MAX2(miny, input_rect.ymin); + minx = MAX2(minx, input_rect.xmin); + maxy = MIN2(maxy, input_rect.ymax); + maxx = MIN2(maxx, input_rect.xmax); int step = getStep(); int offsetadd = getOffsetAdd() * COM_NUM_CHANNELS_COLOR; diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cc b/source/blender/compositor/operations/COM_DilateErodeOperation.cc index dc8792fc59a..33ddf9187b0 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cc +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cc @@ -70,19 +70,19 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); - rcti *rect = inputBuffer->getRect(); - const int minx = MAX2(x - this->m_scope, rect->xmin); - const int miny = MAX2(y - this->m_scope, rect->ymin); - const int maxx = MIN2(x + this->m_scope, rect->xmax); - const int maxy = MIN2(y + this->m_scope, rect->ymax); - const int bufferWidth = BLI_rcti_size_x(rect); + const rcti &input_rect = inputBuffer->get_rect(); + const int minx = MAX2(x - this->m_scope, input_rect.xmin); + const int miny = MAX2(y - this->m_scope, input_rect.ymin); + const int maxx = MIN2(x + this->m_scope, input_rect.xmax); + const int maxy = MIN2(y + this->m_scope, input_rect.ymax); + const int bufferWidth = inputBuffer->getWidth(); int offset; inputBuffer->read(inputValue, x, y); if (inputValue[0] > sw) { for (int yi = miny; yi < maxy; yi++) { const float dy = yi - y; - offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin)); + offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin)); for (int xi = minx; xi < maxx; xi++) { if (buffer[offset] < sw) { const float dx = xi - x; @@ -97,7 +97,7 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, else { for (int yi = miny; yi < maxy; yi++) { const float dy = yi - y; - offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin)); + offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin)); for (int xi = minx; xi < maxx; xi++) { if (buffer[offset] > sw) { const float dx = xi - x; @@ -190,19 +190,19 @@ void DilateDistanceOperation::executePixel(float output[4], int x, int y, void * MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); - rcti *rect = inputBuffer->getRect(); - const int minx = MAX2(x - this->m_scope, rect->xmin); - const int miny = MAX2(y - this->m_scope, rect->ymin); - const int maxx = MIN2(x + this->m_scope, rect->xmax); - const int maxy = MIN2(y + this->m_scope, rect->ymax); - const int bufferWidth = BLI_rcti_size_x(rect); + const rcti &input_rect = inputBuffer->get_rect(); + const int minx = MAX2(x - this->m_scope, input_rect.xmin); + const int miny = MAX2(y - this->m_scope, input_rect.ymin); + const int maxx = MIN2(x + this->m_scope, input_rect.xmax); + const int maxy = MIN2(y + this->m_scope, input_rect.ymax); + const int bufferWidth = inputBuffer->getWidth(); int offset; float value = 0.0f; for (int yi = miny; yi < maxy; yi++) { const float dy = yi - y; - offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin)); + offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin)); for (int xi = minx; xi < maxx; xi++) { const float dx = xi - x; const float dis = dx * dx + dy * dy; @@ -269,19 +269,19 @@ void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *d MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); - rcti *rect = inputBuffer->getRect(); - const int minx = MAX2(x - this->m_scope, rect->xmin); - const int miny = MAX2(y - this->m_scope, rect->ymin); - const int maxx = MIN2(x + this->m_scope, rect->xmax); - const int maxy = MIN2(y + this->m_scope, rect->ymax); - const int bufferWidth = BLI_rcti_size_x(rect); + const rcti &input_rect = inputBuffer->get_rect(); + const int minx = MAX2(x - this->m_scope, input_rect.xmin); + const int miny = MAX2(y - this->m_scope, input_rect.ymin); + const int maxx = MIN2(x + this->m_scope, input_rect.xmax); + const int maxy = MIN2(y + this->m_scope, input_rect.ymax); + const int bufferWidth = inputBuffer->getWidth(); int offset; float value = 1.0f; for (int yi = miny; yi < maxy; yi++) { const float dy = yi - y; - offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin)); + offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin)); for (int xi = minx; xi < maxx; xi++) { const float dx = xi - x; const float dis = dx * dx + dy * dy; diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc index 1d3cce45e10..1f03bb8d9cb 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc @@ -87,10 +87,11 @@ void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, vo MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); - int bufferstartx = inputBuffer->getRect()->xmin; - int bufferstarty = inputBuffer->getRect()->ymin; + const rcti &input_rect = inputBuffer->get_rect(); + int bufferstartx = input_rect.xmin; + int bufferstarty = input_rect.ymin; - rcti &rect = *inputBuffer->getRect(); + const rcti &rect = inputBuffer->get_rect(); int xmin = max_ii(x - m_filtersize, rect.xmin); int xmax = min_ii(x + m_filtersize + 1, rect.xmax); int ymin = max_ii(y, rect.ymin); diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc index ce2e75db95c..de35c164fc7 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc @@ -85,15 +85,15 @@ void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, vo { const bool do_invert = this->m_do_subtract; MemoryBuffer *inputBuffer = (MemoryBuffer *)data; + const rcti &input_rect = inputBuffer->get_rect(); float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); - int bufferstartx = inputBuffer->getRect()->xmin; - int bufferstarty = inputBuffer->getRect()->ymin; + int bufferstartx = input_rect.xmin; + int bufferstarty = input_rect.ymin; - rcti &rect = *inputBuffer->getRect(); - int xmin = max_ii(x, rect.xmin); - int ymin = max_ii(y - m_filtersize, rect.ymin); - int ymax = min_ii(y + m_filtersize + 1, rect.ymax); + int xmin = max_ii(x, input_rect.xmin); + int ymin = max_ii(y - m_filtersize, input_rect.ymin); + int ymax = min_ii(y + m_filtersize + 1, input_rect.ymax); /* *** this is the main part which is different to 'GaussianYBlurOperation' *** */ int step = getStep(); diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc index b83fceb038f..73b0914c086 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc @@ -121,14 +121,14 @@ void GaussianBokehBlurOperation::executePixel(float output[4], int x, int y, voi MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); - int bufferstartx = inputBuffer->getRect()->xmin; - int bufferstarty = inputBuffer->getRect()->ymin; - - rcti &rect = *inputBuffer->getRect(); - int ymin = max_ii(y - this->m_rady, rect.ymin); - int ymax = min_ii(y + this->m_rady + 1, rect.ymax); - int xmin = max_ii(x - this->m_radx, rect.xmin); - int xmax = min_ii(x + this->m_radx + 1, rect.xmax); + const rcti &input_rect = inputBuffer->get_rect(); + int bufferstartx = input_rect.xmin; + int bufferstarty = input_rect.ymin; + + int ymin = max_ii(y - this->m_rady, input_rect.ymin); + int ymax = min_ii(y + this->m_rady + 1, input_rect.ymax); + int xmin = max_ii(x - this->m_radx, input_rect.xmin); + int xmax = min_ii(x + this->m_radx + 1, input_rect.xmax); int index; int step = QualityStepHelper::getStep(); diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc index b1c24edc9fd..43bf961cfc4 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc @@ -81,15 +81,15 @@ void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *d float ATTR_ALIGN(16) color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float multiplier_accum = 0.0f; MemoryBuffer *inputBuffer = (MemoryBuffer *)data; + const rcti &input_rect = inputBuffer->get_rect(); float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); - int bufferstartx = inputBuffer->getRect()->xmin; - int bufferstarty = inputBuffer->getRect()->ymin; + int bufferstartx = input_rect.xmin; + int bufferstarty = input_rect.ymin; - rcti &rect = *inputBuffer->getRect(); - int xmin = max_ii(x - m_filtersize, rect.xmin); - int xmax = min_ii(x + m_filtersize + 1, rect.xmax); - int ymin = max_ii(y, rect.ymin); + int xmin = max_ii(x - m_filtersize, input_rect.xmin); + int xmax = min_ii(x + m_filtersize + 1, input_rect.xmax); + int ymin = max_ii(y, input_rect.ymin); int step = getStep(); int offsetadd = getOffsetAdd(); diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc index 3800f2b8040..1e853dfb8f9 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc @@ -80,15 +80,15 @@ void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *d float ATTR_ALIGN(16) color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float multiplier_accum = 0.0f; MemoryBuffer *inputBuffer = (MemoryBuffer *)data; + const rcti &input_rect = inputBuffer->get_rect(); float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); - int bufferstartx = inputBuffer->getRect()->xmin; - int bufferstarty = inputBuffer->getRect()->ymin; + int bufferstartx = input_rect.xmin; + int bufferstarty = input_rect.ymin; - rcti &rect = *inputBuffer->getRect(); - int xmin = max_ii(x, rect.xmin); - int ymin = max_ii(y - m_filtersize, rect.ymin); - int ymax = min_ii(y + m_filtersize + 1, rect.ymax); + int xmin = max_ii(x, input_rect.xmin); + int ymin = max_ii(y - m_filtersize, input_rect.ymin); + int ymax = min_ii(y + m_filtersize + 1, input_rect.ymax); int index; int step = getStep(); diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc index 8e34210ab4d..23dfc95f9e3 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc @@ -268,7 +268,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) float *kernelBuffer = in2->getBuffer(); float *imageBuffer = in1->getBuffer(); - MemoryBuffer *rdst = new MemoryBuffer(DataType::Color, *in1->getRect()); + MemoryBuffer *rdst = new MemoryBuffer(DataType::Color, in1->get_rect()); memset(rdst->getBuffer(), 0, rdst->getWidth() * rdst->getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float)); diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc index f48692fec04..0da1174199d 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc @@ -34,7 +34,7 @@ void GlareStreaksOperation::generateGlare(float *data, bool breaked = false; MemoryBuffer *tsrc = inputTile->duplicate(); - MemoryBuffer *tdst = new MemoryBuffer(DataType::Color, *inputTile->getRect()); + MemoryBuffer *tdst = new MemoryBuffer(DataType::Color, inputTile->get_rect()); tdst->clear(); memset(data, 0, size4 * sizeof(float)); diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cc b/source/blender/compositor/operations/COM_SunBeamsOperation.cc index af5cdeba547..23bf5897297 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cc +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cc @@ -156,7 +156,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { float dist_min, float dist_max) { - rcti rect = *input->getRect(); + const rcti &rect = input->get_rect(); int buffer_width = input->getWidth(); int x, y, num; float v, dv; |