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>2012-06-13 14:03:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-13 14:03:39 +0400
commit6fa1af2a216cf4c4c944818bc0b9f68b4cc7ff6b (patch)
treeeb92256d58db2d930c89dc4e9be5d3acd919f918 /source/blender/compositor
parentc83d37ccc07c40813e44658857fc79886099b485 (diff)
style cleanup: scale node
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/nodes/COM_ScaleNode.cpp84
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.cpp72
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.h12
3 files changed, 84 insertions, 84 deletions
diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp
index d709781299f..fd4e4331fca 100644
--- a/source/blender/compositor/nodes/COM_ScaleNode.cpp
+++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp
@@ -31,7 +31,7 @@ ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode)
{
}
-void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
InputSocket *inputXSocket = this->getInputSocket(1);
@@ -39,50 +39,50 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
OutputSocket *outputSocket = this->getOutputSocket(0);
bNode *bnode = this->getbNode();
switch (bnode->custom1) {
- case CMP_SCALE_RELATIVE: {
- ScaleOperation *operation = new ScaleOperation();
-
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
- inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- }
+ case CMP_SCALE_RELATIVE: {
+ ScaleOperation *operation = new ScaleOperation();
+
+ inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+ inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
+ inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
+ outputSocket->relinkConnections(operation->getOutputSocket(0));
+ graph->addOperation(operation);
+ }
break;
- case CMP_SCALE_SCENEPERCENT: {
- SetValueOperation * scaleFactorOperation = new SetValueOperation();
- scaleFactorOperation->setValue(context->getScene()->r.size/100.0f);
- ScaleOperation * operation = new ScaleOperation();
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- addLink(graph, scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1));
- addLink(graph, scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2));
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(scaleFactorOperation);
- graph->addOperation(operation);
- }
+ case CMP_SCALE_SCENEPERCENT: {
+ SetValueOperation *scaleFactorOperation = new SetValueOperation();
+ scaleFactorOperation->setValue(context->getScene()->r.size / 100.0f);
+ ScaleOperation *operation = new ScaleOperation();
+ inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+ addLink(graph, scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1));
+ addLink(graph, scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2));
+ outputSocket->relinkConnections(operation->getOutputSocket(0));
+ graph->addOperation(scaleFactorOperation);
+ graph->addOperation(operation);
+ }
break;
-
- case CMP_SCALE_RENDERPERCENT: {
- const RenderData *data = &context->getScene()->r;
- ScaleFixedSizeOperation * operation = new ScaleFixedSizeOperation();
- operation->setNewWidth(data->xsch*data->size/100.0f);
- operation->setNewHeight(data->ysch*data->size/100.0f);
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- operation->getInputSocket(0)->getConnection()->setIgnoreResizeCheck(true);
- graph->addOperation(operation);
- }
+
+ case CMP_SCALE_RENDERPERCENT: {
+ const RenderData *data = &context->getScene()->r;
+ ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation();
+ operation->setNewWidth(data->xsch * data->size / 100.0f);
+ operation->setNewHeight(data->ysch * data->size / 100.0f);
+ inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+ outputSocket->relinkConnections(operation->getOutputSocket(0));
+ operation->getInputSocket(0)->getConnection()->setIgnoreResizeCheck(true);
+ graph->addOperation(operation);
+ }
break;
-
- case CMP_SCALE_ABSOLUTE: {
- ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); // TODO: what is the use of this one.... perhaps some issues when the ui was updated....
-
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
- inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
- outputSocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- }
+
+ case CMP_SCALE_ABSOLUTE: {
+ ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); // TODO: what is the use of this one.... perhaps some issues when the ui was updated....
+
+ inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+ inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
+ inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
+ outputSocket->relinkConnections(operation->getOutputSocket(0));
+ graph->addOperation(operation);
+ }
break;
}
}
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cpp b/source/blender/compositor/operations/COM_ScaleOperation.cpp
index ca2095c3170..ef1199cfa32 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScaleOperation.cpp
@@ -15,8 +15,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
+ * Contributor:
+ * Jeroen Bakker
* Monique Dewanchand
*/
@@ -38,8 +38,8 @@ void ScaleOperation::initExecution()
this->inputOperation = this->getInputSocketReader(0);
this->inputXOperation = this->getInputSocketReader(1);
this->inputYOperation = this->getInputSocketReader(2);
- this->centerX = this->getWidth()/2.0;
- this->centerY = this->getHeight()/2.0;
+ this->centerX = this->getWidth() / 2.0;
+ this->centerY = this->getHeight() / 2.0;
}
void ScaleOperation::deinitExecution()
@@ -50,7 +50,7 @@ void ScaleOperation::deinitExecution()
}
-void ScaleOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ScaleOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
{
float scaleX[4];
float scaleY[4];
@@ -61,8 +61,8 @@ void ScaleOperation::executePixel(float *color,float x, float y, PixelSampler sa
const float scx = scaleX[0];
const float scy = scaleY[0];
- float nx = this->centerX+ (x - this->centerX) / scx;
- float ny = this->centerY+ (y - this->centerY) / scy;
+ float nx = this->centerX + (x - this->centerX) / scx;
+ float ny = this->centerY + (y - this->centerY) / scy;
this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
}
@@ -71,18 +71,18 @@ bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOpe
rcti newInput;
float scaleX[4];
float scaleY[4];
-
+
this->inputXOperation->read(scaleX, 0, 0, COM_PS_NEAREST, NULL);
this->inputYOperation->read(scaleY, 0, 0, COM_PS_NEAREST, NULL);
-
+
const float scx = scaleX[0];
const float scy = scaleY[0];
-
- newInput.xmax = this->centerX+ (input->xmax - this->centerX) / scx;
- newInput.xmin = this->centerX+ (input->xmin - this->centerX) / scx;
- newInput.ymax = this->centerY+ (input->ymax - this->centerY) / scy;
- newInput.ymin = this->centerY+ (input->ymin - this->centerY) / scy;
-
+
+ newInput.xmax = this->centerX + (input->xmax - this->centerX) / scx;
+ newInput.xmin = this->centerX + (input->xmin - this->centerX) / scx;
+ newInput.ymax = this->centerY + (input->ymax - this->centerY) / scy;
+ newInput.ymin = this->centerY + (input->ymin - this->centerY) / scy;
+
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
@@ -92,7 +92,7 @@ ScaleAbsoluteOperation::ScaleAbsoluteOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VALUE);
- this->addInputSocket(COM_DT_VALUE);
+ this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_COLOR);
this->setResolutionInputSocketIndex(0);
this->inputOperation = NULL;
@@ -104,8 +104,8 @@ void ScaleAbsoluteOperation::initExecution()
this->inputOperation = this->getInputSocketReader(0);
this->inputXOperation = this->getInputSocketReader(1);
this->inputYOperation = this->getInputSocketReader(2);
- this->centerX = this->getWidth()/2.0;
- this->centerY = this->getHeight()/2.0;
+ this->centerX = this->getWidth() / 2.0;
+ this->centerY = this->getHeight() / 2.0;
}
void ScaleAbsoluteOperation::deinitExecution()
@@ -116,7 +116,7 @@ void ScaleAbsoluteOperation::deinitExecution()
}
-void ScaleAbsoluteOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
{
float scaleX[4];
float scaleY[4];
@@ -129,11 +129,11 @@ void ScaleAbsoluteOperation::executePixel(float *color,float x, float y, PixelSa
const float width = this->getWidth();
const float height = this->getHeight();
//div
- float relativeXScale = scx/width;
- float relativeYScale = scy/height;
+ float relativeXScale = scx / width;
+ float relativeYScale = scy / height;
- float nx = this->centerX+ (x - this->centerX) / relativeXScale;
- float ny = this->centerY+ (y - this->centerY) / relativeYScale;
+ float nx = this->centerX + (x - this->centerX) / relativeXScale;
+ float ny = this->centerY + (y - this->centerY) / relativeYScale;
this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
}
@@ -151,13 +151,13 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadB
const float width = this->getWidth();
const float height = this->getHeight();
//div
- float relateveXScale = scx/width;
- float relateveYScale = scy/height;
+ float relateveXScale = scx / width;
+ float relateveYScale = scy / height;
- newInput.xmax = this->centerX+ (input->xmax - this->centerX) / relateveXScale;
- newInput.xmin = this->centerX+ (input->xmin - this->centerX) / relateveXScale;
- newInput.ymax = this->centerY+ (input->ymax - this->centerY) / relateveYScale;
- newInput.ymin = this->centerY+ (input->ymin - this->centerY) / relateveYScale;
+ newInput.xmax = this->centerX + (input->xmax - this->centerX) / relateveXScale;
+ newInput.xmin = this->centerX + (input->xmin - this->centerX) / relateveXScale;
+ newInput.ymax = this->centerY + (input->ymax - this->centerY) / relateveYScale;
+ newInput.ymin = this->centerY + (input->ymin - this->centerY) / relateveYScale;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
@@ -184,19 +184,19 @@ void ScaleFixedSizeOperation::deinitExecution()
}
-void ScaleFixedSizeOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ScaleFixedSizeOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
{
- this->inputOperation->read(color, x*relX, y*relY, sampler, inputBuffers);
+ this->inputOperation->read(color, x * relX, y * relY, sampler, inputBuffers);
}
bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInput;
-
- newInput.xmax = input->xmax *relX;
- newInput.xmin = input->xmin *relX;
- newInput.ymax = input->ymax *relY;
- newInput.ymin = input->ymin *relY;
+
+ newInput.xmax = input->xmax * relX;
+ newInput.xmin = input->xmin * relX;
+ newInput.ymax = input->ymax * relY;
+ newInput.ymin = input->ymin * relY;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h
index 3e075249fa1..2c99cb63978 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.h
+++ b/source/blender/compositor/operations/COM_ScaleOperation.h
@@ -25,7 +25,7 @@
#include "COM_NodeOperation.h"
-class ScaleOperation: public NodeOperation {
+class ScaleOperation : public NodeOperation {
private:
SocketReader *inputOperation;
SocketReader *inputXOperation;
@@ -35,13 +35,13 @@ private:
public:
ScaleOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
void initExecution();
void deinitExecution();
};
-class ScaleAbsoluteOperation: public NodeOperation {
+class ScaleAbsoluteOperation : public NodeOperation {
SocketReader *inputOperation;
SocketReader *inputXOperation;
SocketReader *inputYOperation;
@@ -50,13 +50,13 @@ class ScaleAbsoluteOperation: public NodeOperation {
public:
ScaleAbsoluteOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
void initExecution();
void deinitExecution();
};
-class ScaleFixedSizeOperation: public NodeOperation {
+class ScaleFixedSizeOperation : public NodeOperation {
SocketReader *inputOperation;
int newWidth;
int newHeight;
@@ -66,7 +66,7 @@ public:
ScaleFixedSizeOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
void initExecution();
void deinitExecution();