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:
authorJeroen Bakker <j.bakker@atmind.nl>2012-08-28 14:41:37 +0400
committerJeroen Bakker <j.bakker@atmind.nl>2012-08-28 14:41:37 +0400
commit8fd747114388dbbb10733415eaa707f9801abf1a (patch)
treea8207827aceb7d52fcf5a97bcb7695feab15f5e3 /source/blender/compositor
parentc43583a23ae0e552779148236f973d20275f9bd0 (diff)
cleanup pixel sampler code (pixel interpolations in compositor)
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/intern/COM_SocketReader.h6
-rw-r--r--source/blender/compositor/nodes/COM_RotateNode.cpp14
-rw-r--r--source/blender/compositor/nodes/COM_Stabilize2dNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_TransformNode.cpp12
4 files changed, 12 insertions, 29 deletions
diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h
index 01e1403b021..88b018ef8ba 100644
--- a/source/blender/compositor/intern/COM_SocketReader.h
+++ b/source/blender/compositor/intern/COM_SocketReader.h
@@ -30,9 +30,9 @@
#endif
typedef enum PixelSampler {
- COM_PS_NEAREST,
- COM_PS_BILINEAR,
- COM_PS_BICUBIC
+ COM_PS_NEAREST = 0,
+ COM_PS_BILINEAR = 1,
+ COM_PS_BICUBIC = 2
} PixelSampler;
class MemoryBuffer;
diff --git a/source/blender/compositor/nodes/COM_RotateNode.cpp b/source/blender/compositor/nodes/COM_RotateNode.cpp
index bb058d18b80..d7712323a27 100644
--- a/source/blender/compositor/nodes/COM_RotateNode.cpp
+++ b/source/blender/compositor/nodes/COM_RotateNode.cpp
@@ -39,19 +39,7 @@ void RotateNode::convertToOperations(ExecutionSystem *system, CompositorContext
RotateOperation *operation = new RotateOperation();
SetSamplerOperation *sampler = new SetSamplerOperation();
- switch (this->getbNode()->custom1) {
- case 0:
- sampler->setSampler(COM_PS_NEAREST);
- break;
- case 1:
- sampler->setSampler(COM_PS_BILINEAR);
- break;
- case 2:
- sampler->setSampler(COM_PS_BICUBIC);
- break;
-
- }
-
+ sampler->setSampler((PixelSampler)this->getbNode()->custom1);
addLink(system, sampler->getOutputSocket(), operation->getInputSocket(0));
inputSocket->relinkConnections(sampler->getInputSocket(0), 0, system);
diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
index 85b8695263f..b28ee3eade1 100644
--- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
+++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
@@ -26,6 +26,7 @@
#include "COM_RotateOperation.h"
#include "COM_ScaleOperation.h"
#include "COM_MovieClipAttributeOperation.h"
+#include "COM_SetSamplerOperation.h"
extern "C" {
#include "DNA_movieclip_types.h"
@@ -49,6 +50,7 @@ void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorCont
MovieClipAttributeOperation *angleAttribute = new MovieClipAttributeOperation();
MovieClipAttributeOperation *xAttribute = new MovieClipAttributeOperation();
MovieClipAttributeOperation *yAttribute = new MovieClipAttributeOperation();
+ SetSamplerOperation *psoperation = new SetSamplerOperation();
scaleAttribute->setAttribute(MCA_SCALE);
scaleAttribute->setFramenumber(context->getFramenumber());
@@ -77,8 +79,10 @@ void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorCont
addLink(graph, rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0));
addLink(graph, xAttribute->getOutputSocket(), translateOperation->getInputSocket(1));
addLink(graph, yAttribute->getOutputSocket(), translateOperation->getInputSocket(2));
-
- this->getOutputSocket()->relinkConnections(translateOperation->getOutputSocket());
+
+ psoperation->setSampler((PixelSampler)this->getbNode()->custom1);
+ addLink(graph, translateOperation->getOutputSocket(), psoperation->getInputSocket(0));
+ this->getOutputSocket()->relinkConnections(psoperation->getOutputSocket());
graph->addOperation(scaleAttribute);
graph->addOperation(angleAttribute);
@@ -87,4 +91,5 @@ void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorCont
graph->addOperation(scaleOperation);
graph->addOperation(translateOperation);
graph->addOperation(rotateOperation);
+ graph->addOperation(psoperation);
}
diff --git a/source/blender/compositor/nodes/COM_TransformNode.cpp b/source/blender/compositor/nodes/COM_TransformNode.cpp
index ff6e276d1ac..154761665cf 100644
--- a/source/blender/compositor/nodes/COM_TransformNode.cpp
+++ b/source/blender/compositor/nodes/COM_TransformNode.cpp
@@ -46,17 +46,7 @@ void TransformNode::convertToOperations(ExecutionSystem *graph, CompositorContex
TranslateOperation *translateOperation = new TranslateOperation();
SetSamplerOperation *sampler = new SetSamplerOperation();
- switch (this->getbNode()->custom1) {
- case 0:
- sampler->setSampler(COM_PS_NEAREST);
- break;
- case 1:
- sampler->setSampler(COM_PS_BILINEAR);
- break;
- case 2:
- sampler->setSampler(COM_PS_BICUBIC);
- break;
- }
+ sampler->setSampler((PixelSampler)this->getbNode()->custom1);
imageInput->relinkConnections(sampler->getInputSocket(0), 0, graph);
addLink(graph, sampler->getOutputSocket(), scaleOperation->getInputSocket(0));