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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-03-04 17:14:21 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-03-04 17:14:21 +0400
commit7a1086d9a19152ec986e350a0db9a02398bd4761 (patch)
tree2ede289715bb37adc1a4f75f82f468bfb300ace2 /source/blender/compositor/operations/COM_TextureOperation.cpp
parent86ff11fe4713672a58deb8b054c936330954a721 (diff)
Fix #34475: Weird noise bug with Texture nodes
Made Texture compositor input node single-threaded since texture trees are not thread-safe. Also fixed texture being flipped horizontally and vertically. Why nobody noticed this for 3 releases already??
Diffstat (limited to 'source/blender/compositor/operations/COM_TextureOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp
index 23a3abe61ee..08f6f8ada4a 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.cpp
+++ b/source/blender/compositor/operations/COM_TextureOperation.cpp
@@ -25,7 +25,7 @@
#include "BLI_listbase.h"
#include "BKE_image.h"
-TextureBaseOperation::TextureBaseOperation() : NodeOperation()
+TextureBaseOperation::TextureBaseOperation() : SingleThreadedNodeOperation()
{
this->addInputSocket(COM_DT_VECTOR); //offset
this->addInputSocket(COM_DT_VECTOR); //size
@@ -48,6 +48,7 @@ void TextureBaseOperation::initExecution()
this->m_inputOffset = getInputSocketReader(0);
this->m_inputSize = getInputSocketReader(1);
this->m_pool = BKE_image_pool_new();
+ SingleThreadedNodeOperation::initExecution();
}
void TextureBaseOperation::deinitExecution()
{
@@ -55,6 +56,7 @@ void TextureBaseOperation::deinitExecution()
this->m_inputOffset = NULL;
BKE_image_pool_free(this->m_pool);
this->m_pool = NULL;
+ SingleThreadedNodeOperation::deinitExecution();
}
void TextureBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
@@ -89,8 +91,8 @@ void TextureBaseOperation::executePixel(float output[4], float x, float y, Pixel
int retval;
const float cx = this->getWidth() / 2;
const float cy = this->getHeight() / 2;
- const float u = (cx - x) / this->getWidth() * 2;
- const float v = (cy - y) / this->getHeight() * 2;
+ const float u = (x - cx) / this->getWidth() * 2;
+ const float v = (y - cy) / this->getHeight() * 2;
this->m_inputSize->read(textureSize, x, y, sampler);
this->m_inputOffset->read(textureOffset, x, y, sampler);
@@ -115,3 +117,26 @@ void TextureBaseOperation::executePixel(float output[4], float x, float y, Pixel
output[0] = output[1] = output[2] = output[3];
}
}
+
+MemoryBuffer *TextureBaseOperation::createMemoryBuffer(rcti *rect2)
+{
+ int height = getHeight();
+ int width = getWidth();
+
+ rcti rect;
+ rect.xmin = 0;
+ rect.ymin = 0;
+ rect.xmax = width;
+ rect.ymax = height;
+ MemoryBuffer *result = new MemoryBuffer(NULL, &rect);
+
+ float *data = result->getBuffer();
+
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++, data += 4) {
+ this->executePixel(data, x, y, COM_PS_NEAREST);
+ }
+ }
+
+ return result;
+}