Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp126
1 files changed, 65 insertions, 61 deletions
diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
index fa02f0f3356..40299d33306 100644
--- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
@@ -22,87 +22,91 @@
ProjectorLensDistortionOperation::ProjectorLensDistortionOperation() : NodeOperation()
{
- this->addInputSocket(COM_DT_COLOR);
- this->addInputSocket(COM_DT_VALUE);
- this->addOutputSocket(COM_DT_COLOR);
- this->setComplex(true);
- this->m_inputProgram = NULL;
- this->m_dispersionAvailable = false;
- this->m_dispersion = 0.0f;
+ this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_VALUE);
+ this->addOutputSocket(COM_DT_COLOR);
+ this->setComplex(true);
+ this->m_inputProgram = NULL;
+ this->m_dispersionAvailable = false;
+ this->m_dispersion = 0.0f;
}
void ProjectorLensDistortionOperation::initExecution()
{
- this->initMutex();
- this->m_inputProgram = this->getInputSocketReader(0);
+ this->initMutex();
+ this->m_inputProgram = this->getInputSocketReader(0);
}
void *ProjectorLensDistortionOperation::initializeTileData(rcti * /*rect*/)
{
- updateDispersion();
- void *buffer = this->m_inputProgram->initializeTileData(NULL);
- return buffer;
+ updateDispersion();
+ void *buffer = this->m_inputProgram->initializeTileData(NULL);
+ return buffer;
}
void ProjectorLensDistortionOperation::executePixel(float output[4], int x, int y, void *data)
{
- float inputValue[4];
- const float height = this->getHeight();
- const float width = this->getWidth();
- const float v = (y + 0.5f) / height;
- const float u = (x + 0.5f) / width;
- MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
- inputBuffer->readBilinear(inputValue, (u * width + this->m_kr2) - 0.5f, v * height - 0.5f);
- output[0] = inputValue[0];
- inputBuffer->read(inputValue, x, y);
- output[1] = inputValue[1];
- inputBuffer->readBilinear(inputValue, (u * width - this->m_kr2) - 0.5f, v * height - 0.5f);
- output[2] = inputValue[2];
- output[3] = 1.0f;
+ float inputValue[4];
+ const float height = this->getHeight();
+ const float width = this->getWidth();
+ const float v = (y + 0.5f) / height;
+ const float u = (x + 0.5f) / width;
+ MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
+ inputBuffer->readBilinear(inputValue, (u * width + this->m_kr2) - 0.5f, v * height - 0.5f);
+ output[0] = inputValue[0];
+ inputBuffer->read(inputValue, x, y);
+ output[1] = inputValue[1];
+ inputBuffer->readBilinear(inputValue, (u * width - this->m_kr2) - 0.5f, v * height - 0.5f);
+ output[2] = inputValue[2];
+ output[3] = 1.0f;
}
void ProjectorLensDistortionOperation::deinitExecution()
{
- this->deinitMutex();
- this->m_inputProgram = NULL;
+ this->deinitMutex();
+ this->m_inputProgram = NULL;
}
-bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(
+ rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
- rcti newInput;
- if (this->m_dispersionAvailable) {
- newInput.ymax = input->ymax;
- newInput.ymin = input->ymin;
- newInput.xmin = input->xmin - this->m_kr2 - 2;
- newInput.xmax = input->xmax + this->m_kr2 + 2;
- }
- else {
- rcti dispInput;
- BLI_rcti_init(&dispInput, 0, 5, 0, 5);
- if (this->getInputOperation(1)->determineDependingAreaOfInterest(&dispInput, readOperation, output)) {
- return true;
- }
- newInput.xmin = input->xmin - 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */
- newInput.ymin = input->ymin;
- newInput.ymax = input->ymax;
- newInput.xmax = input->xmax + 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */
- }
- if (this->getInputOperation(0)->determineDependingAreaOfInterest(&newInput, readOperation, output)) {
- return true;
- }
- return false;
+ rcti newInput;
+ if (this->m_dispersionAvailable) {
+ newInput.ymax = input->ymax;
+ newInput.ymin = input->ymin;
+ newInput.xmin = input->xmin - this->m_kr2 - 2;
+ newInput.xmax = input->xmax + this->m_kr2 + 2;
+ }
+ else {
+ rcti dispInput;
+ BLI_rcti_init(&dispInput, 0, 5, 0, 5);
+ if (this->getInputOperation(1)->determineDependingAreaOfInterest(
+ &dispInput, readOperation, output)) {
+ return true;
+ }
+ newInput.xmin = input->xmin - 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */
+ newInput.ymin = input->ymin;
+ newInput.ymax = input->ymax;
+ newInput.xmax = input->xmax + 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */
+ }
+ if (this->getInputOperation(0)->determineDependingAreaOfInterest(
+ &newInput, readOperation, output)) {
+ return true;
+ }
+ return false;
}
void ProjectorLensDistortionOperation::updateDispersion()
{
- if (this->m_dispersionAvailable) return;
- this->lockMutex();
- if (!this->m_dispersionAvailable) {
- float result[4];
- this->getInputSocketReader(1)->readSampled(result, 1, 1, COM_PS_NEAREST);
- this->m_dispersion = result[0];
- this->m_kr = 0.25f * max_ff(min_ff(this->m_dispersion, 1.0f), 0.0f);
- this->m_kr2 = this->m_kr * 20;
- this->m_dispersionAvailable = true;
- }
- this->unlockMutex();
+ if (this->m_dispersionAvailable)
+ return;
+ this->lockMutex();
+ if (!this->m_dispersionAvailable) {
+ float result[4];
+ this->getInputSocketReader(1)->readSampled(result, 1, 1, COM_PS_NEAREST);
+ this->m_dispersion = result[0];
+ this->m_kr = 0.25f * max_ff(min_ff(this->m_dispersion, 1.0f), 0.0f);
+ this->m_kr2 = this->m_kr * 20;
+ this->m_dispersionAvailable = true;
+ }
+ this->unlockMutex();
}