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-06-04 22:07:29 +0400
committerJeroen Bakker <j.bakker@atmind.nl>2012-06-04 22:07:29 +0400
commit5024996eea206252adc098f44c9a3a1d01ae6167 (patch)
tree4a458dc0b79ac35cdf94fe3198d73ff9a5b7f5be /source/blender
parentd46a6dc59c76c4b5f9210aba51f5f6347c7ccd26 (diff)
* modified vieweroperation to not calculate based on the DO_NODE_OUTPUT
flag of the editorbNode.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.cpp2
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp73
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_ViewerBaseOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ViewerBaseOperation.h2
6 files changed, 55 insertions, 42 deletions
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp
index db4fd115d73..679589a7ce1 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp
@@ -37,7 +37,7 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
Image *image = (Image*)this->getbNode()->id;
ImageUser * imageUser = (ImageUser*) this->getbNode()->storage;
bNode *editorNode = this->getbNode();
- if (imageSocket->isConnected() && (editorNode->flag & NODE_DO_OUTPUT)) {
+ if (imageSocket->isConnected()) {
ViewerOperation *viewerOperation = new ViewerOperation();
viewerOperation->setColorManagement(context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT);
viewerOperation->setColorPredivide(context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index babea459d6a..2280ee3a435 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -101,7 +101,10 @@ void BlurBaseOperation::deinitExecution()
void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers)
{
- float result[4];
- this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers);
- this->size = result[0];
+ if (!this->sizeavailable) {
+ float result[4];
+ this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers);
+ this->size = result[0];
+ this->sizeavailable = true;
+ }
}
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index ad8f3b12387..ad58631f2c1 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -26,13 +26,12 @@
FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation()
{
- this->iirgaus = false;
+ this->iirgaus = NULL;
}
void FastGaussianBlurOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
MemoryBuffer *newData = (MemoryBuffer*)data;
-
newData->read(color, x, y);
}
@@ -51,10 +50,7 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, Re
}
else {
if (this->iirgaus) {
- newInput.xmax = input->xmax + (sx);
- newInput.xmin = input->xmin - (sx);
- newInput.ymax = input->ymax + (sy);
- newInput.ymin = input->ymin - (sy);
+ return false;
}
else {
newInput.xmin = 0;
@@ -66,38 +62,51 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, Re
}
}
-void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void FastGaussianBlurOperation::initExecution()
{
- MemoryBuffer *newBuf = (MemoryBuffer*)this->inputProgram->initializeTileData(rect, memoryBuffers);
- MemoryBuffer *copy = newBuf->duplicate();
- updateSize(memoryBuffers);
-
- int c;
- sx = data->sizex * this->size/2.0f;
- sy = data->sizey * this->size/2.0f;
- this->iirgaus = true;
-
- if ((sx == sy) && (sx > 0.f)) {
- for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
- IIR_gauss(copy, sx, c, 3);
+ BlurBaseOperation::initExecution();
+ BlurBaseOperation::initMutex();
+}
+
+void FastGaussianBlurOperation::deinitExecution()
+{
+ if (this->iirgaus) {
+ delete this->iirgaus;
+ this->iirgaus = NULL;
}
- else {
- if (sx > 0.f) {
+ BlurBaseOperation::deinitMutex();
+}
+
+void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+{
+ BLI_mutex_lock(this->getMutex());
+ if (!iirgaus) {
+ MemoryBuffer *newBuf = (MemoryBuffer*)this->inputProgram->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *copy = newBuf->duplicate();
+ updateSize(memoryBuffers);
+
+ int c;
+ sx = data->sizex * this->size/2.0f;
+ sy = data->sizey * this->size/2.0f;
+
+ if ((sx == sy) && (sx > 0.f)) {
for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
- IIR_gauss(copy, sx, c, 1);
+ IIR_gauss(copy, sx, c, 3);
}
- if (sy > 0.f) {
- for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
- IIR_gauss(copy, sy, c, 2);
+ else {
+ if (sx > 0.f) {
+ for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
+ IIR_gauss(copy, sx, c, 1);
+ }
+ if (sy > 0.f) {
+ for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
+ IIR_gauss(copy, sy, c, 2);
+ }
}
+ this->iirgaus = copy;
}
- return copy;
-}
-
-void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
-{
- MemoryBuffer *newData = (MemoryBuffer*)data;
- delete newData;
+ BLI_mutex_unlock(this->getMutex());
+ return iirgaus;
}
void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int chan, int xy)
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
index 6c3e373472b..1f71fe7f9ed 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
@@ -30,7 +30,7 @@ class FastGaussianBlurOperation: public BlurBaseOperation {
private:
float sx;
float sy;
- bool iirgaus;
+ MemoryBuffer* iirgaus;
public:
FastGaussianBlurOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
@@ -38,7 +38,8 @@ public:
static void IIR_gauss(MemoryBuffer *src, float sigma, int channel, int xy);
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
- void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
+ void deinitExecution();
+ void initExecution();
};
#endif
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
index 44b4c26fb64..71fc53e8f8e 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
@@ -50,8 +50,9 @@ ViewerBaseOperation::ViewerBaseOperation() : NodeOperation()
void ViewerBaseOperation::initExecution()
{
- // When initializing the tree during initial load the width and height can be zero.
- initImage();
+ if (isActiveViewerOutput()) {
+ initImage();
+ }
}
void ViewerBaseOperation::initImage()
@@ -79,7 +80,6 @@ void ViewerBaseOperation::initImage()
}
void ViewerBaseOperation:: updateImage(rcti *rect)
{
- /// @todo: introduce new event to update smaller area
WM_main_add_notifier(NC_WINDOW|ND_DRAW, NULL);
}
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.h b/source/blender/compositor/operations/COM_ViewerBaseOperation.h
index 58101911550..f5f30809f65 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.h
@@ -42,7 +42,7 @@ protected:
bool doColorPredivide;
public:
- bool isOutputOperation(bool rendering) const {return true;}
+ bool isOutputOperation(bool rendering) const {return isActiveViewerOutput();}
void initExecution();
void deinitExecution();
void setImage(Image *image) {this->image = image;}