diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2012-06-12 08:23:21 +0400 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2012-06-12 08:23:21 +0400 |
commit | ac5a735e3fe9fe29e38e3a20c20da87b27feb112 (patch) | |
tree | 52059f3dbc9827eb498abe772e763e541b3b3608 /source/blender/compositor/operations/COM_RotateOperation.cpp | |
parent | 7977078227d6da77e294dd860f4685387f0bae56 (diff) |
* FIX for
- [#31777] Border Crop gives black
- [#31768] Crash when connecting a Math node to a translate node in Tiles comp
- [#31638] View node in new node compo system crashes when inside a group
* make sure a very fast vignette can be made by using a EliipseMask + Fast Gaussian blur
Diffstat (limited to 'source/blender/compositor/operations/COM_RotateOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_RotateOperation.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp index af2633f0e53..a391a26b89c 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -32,6 +32,7 @@ RotateOperation::RotateOperation() : NodeOperation() this->imageSocket = NULL; this->degreeSocket = NULL; this->doDegree2RadConversion = false; + this->isDegreeSet = false; } void RotateOperation::initExecution() { @@ -39,17 +40,6 @@ void RotateOperation::initExecution() this->degreeSocket = this->getInputSocketReader(1); this->centerX = this->getWidth()/2.0; this->centerY = this->getHeight()/2.0; - float degree[4]; - this->degreeSocket->read(degree, 0, 0, COM_PS_NEAREST, NULL); - double rad; - if (this->doDegree2RadConversion) { - rad = DEG2RAD((double)degree[0]); - } - else { - rad = degree[0]; - } - this->cosine = cos(rad); - this->sine = sin(rad); } void RotateOperation::deinitExecution() @@ -58,9 +48,28 @@ void RotateOperation::deinitExecution() this->degreeSocket = NULL; } +inline void RotateOperation::ensureDegree() { + if (!isDegreeSet) { + float degree[4]; + this->degreeSocket->read(degree, 0, 0, COM_PS_NEAREST, NULL); + double rad; + if (this->doDegree2RadConversion) { + rad = DEG2RAD((double)degree[0]); + } + else { + rad = degree[0]; + } + this->cosine = cos(rad); + this->sine = sin(rad); + + isDegreeSet = true; + } +} + void RotateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { + ensureDegree(); const float dy = y - this->centerY; const float dx = x - this->centerX; const float nx = this->centerX+(this->cosine*dx + this->sine*dy); @@ -70,6 +79,7 @@ void RotateOperation::executePixel(float *color,float x, float y, PixelSampler s bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { + ensureDegree(); rcti newInput; const float dxmin = input->xmin - this->centerX; |