From 6d78936c43741b74f1226af9c096d7253f8fb266 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Jan 2015 01:59:09 +1100 Subject: cleanup: style --- .../blender/compositor/intern/COM_MemoryBuffer.cpp | 19 ++++++++++--------- source/blender/compositor/intern/COM_MemoryBuffer.h | 10 +++++----- .../blender/compositor/intern/COM_OpenCLDevice.cpp | 6 ++++-- source/blender/compositor/intern/COM_OpenCLDevice.h | 2 +- .../operations/COM_DilateErodeOperation.cpp | 2 +- .../compositor/operations/COM_InpaintOperation.cpp | 4 ++-- .../operations/COM_ReadBufferOperation.cpp | 21 ++++++++++----------- .../compositor/operations/COM_RenderLayersProg.cpp | 3 ++- 8 files changed, 35 insertions(+), 32 deletions(-) (limited to 'source/blender/compositor') diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp index 58767960cc8..37035c50d2c 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp @@ -27,15 +27,16 @@ using std::min; using std::max; -static unsigned int determine_num_channels(DataType datatype) { +static unsigned int determine_num_channels(DataType datatype) +{ switch (datatype) { - case COM_DT_VALUE: - return COM_NUM_CHANNELS_VALUE; - case COM_DT_VECTOR: - return COM_NUM_CHANNELS_VECTOR; - case COM_DT_COLOR: - default: - return COM_NUM_CHANNELS_COLOR; + case COM_DT_VALUE: + return COM_NUM_CHANNELS_VALUE; + case COM_DT_VECTOR: + return COM_NUM_CHANNELS_VECTOR; + case COM_DT_COLOR: + default: + return COM_NUM_CHANNELS_COLOR; } } @@ -226,7 +227,7 @@ static void read_ewa_pixel_sampled(void *userdata, int x, int y, float result[4] void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivatives[2][2], PixelSampler sampler) { - BLI_assert(this->m_datatype==COM_DT_COLOR); + BLI_assert(this->m_datatype == COM_DT_COLOR); ReadEWAData data; data.buffer = this; data.sampler = sampler; diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 320de3d67cd..e0c542108a1 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -215,7 +215,7 @@ public: bool clip_y = (extend_y == COM_MB_CLIP && (y < m_rect.ymin || y >= m_rect.ymax)); if (clip_x || clip_y) { /* clip result outside rect is zero */ - memset(result, 0, this->m_num_channels*sizeof(float)); + memset(result, 0, this->m_num_channels * sizeof(float)); } else { int u = x; @@ -223,7 +223,7 @@ public: this->wrap_pixel(u, v, extend_x, extend_y); const int offset = (this->m_width * y + x) * this->m_num_channels; float* buffer = &this->m_buffer[offset]; - memcpy(result, buffer, sizeof(float)*this->m_num_channels); + memcpy(result, buffer, sizeof(float) * this->m_num_channels); } } @@ -240,14 +240,14 @@ public: BLI_assert(offset >= 0); BLI_assert(offset < this->determineBufferSize() * this->m_num_channels); BLI_assert(!(extend_x == COM_MB_CLIP && (u < m_rect.xmin || u >= m_rect.xmax)) && - !(extend_y == COM_MB_CLIP && (v < m_rect.ymin || v >= m_rect.ymax))); + !(extend_y == COM_MB_CLIP && (v < m_rect.ymin || v >= m_rect.ymax))); #if 0 /* always true */ BLI_assert((int)(MEM_allocN_len(this->m_buffer) / sizeof(*this->m_buffer)) == (int)(this->determineBufferSize() * COM_NUMBER_OF_CHANNELS)); #endif - float* buffer = &this->m_buffer[offset]; - memcpy(result, buffer, sizeof(float)*this->m_num_channels); + float *buffer = &this->m_buffer[offset]; + memcpy(result, buffer, sizeof(float) * this->m_num_channels); } void writePixel(int x, int y, const float color[4]); diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp index 7fc4fd38abd..5960082c2fd 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp @@ -90,9 +90,11 @@ const cl_image_format* OpenCLDevice::determineImageFormat(MemoryBuffer *memoryBu int num_channels = memoryBuffer->get_num_channels(); if (num_channels == 1) { imageFormat = &IMAGE_FORMAT_VALUE; - } else if (num_channels == 3) { + } + else if (num_channels == 3) { imageFormat = &IMAGE_FORMAT_VECTOR; - } else { + } + else { imageFormat = &IMAGE_FORMAT_COLOR; } diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h index f8a8841ef47..a513954ee0d 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.h +++ b/source/blender/compositor/intern/COM_OpenCLDevice.h @@ -98,7 +98,7 @@ public: * @brief determine an image format * @param memorybuffer */ - static const cl_image_format* determineImageFormat(MemoryBuffer *memoryBuffer); + static const cl_image_format *determineImageFormat(MemoryBuffer *memoryBuffer); cl_context getContext() { return this->m_context; } diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index cee39994aed..6d15ef3395b 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -72,7 +72,7 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, const float inset = this->m_inset; float mindist = rd * 2; - MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); rcti *rect = inputBuffer->getRect(); const int minx = max(x - this->m_scope, rect->xmin); diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp index 922441a68b6..18611c051d3 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cpp +++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp @@ -83,8 +83,8 @@ float *InpaintSimpleOperation::get_pixel(int x, int y) ASSERT_XY_RANGE(x, y); return &this->m_cached_buffer[ - y * width * COM_NUM_CHANNELS_COLOR + - x * COM_NUM_CHANNELS_COLOR]; + y * width * COM_NUM_CHANNELS_COLOR + + x * COM_NUM_CHANNELS_COLOR]; } int InpaintSimpleOperation::mdist(int x, int y) diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp index 709c30f4015..ad4084a7092 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp @@ -60,18 +60,17 @@ void ReadBufferOperation::executePixelSampled(float output[4], float x, float y, } else { switch (sampler) { - case COM_PS_NEAREST: - m_buffer->read(output, x, y); - break; - case COM_PS_BILINEAR: - default: - m_buffer->readBilinear(output, x, y); - break; - case COM_PS_BICUBIC: - m_buffer->readBilinear(output, x, y); - break; + case COM_PS_NEAREST: + m_buffer->read(output, x, y); + break; + case COM_PS_BILINEAR: + default: + m_buffer->readBilinear(output, x, y); + break; + case COM_PS_BICUBIC: + m_buffer->readBilinear(output, x, y); + break; } - } } diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp index 8e778e44a79..4c6d5c24781 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp @@ -142,7 +142,8 @@ void RenderLayersBaseProg::executePixelSampled(float output[4], float x, float y } else if (elemsize == 3) { zero_v3(output); - } else { + } + else { BLI_assert(elemsize == 4); zero_v4(output); } -- cgit v1.2.3