diff options
-rw-r--r-- | source/blender/compositor/operations/COM_MovieDistortionOperation.cpp | 13 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_MovieDistortionOperation.h | 18 |
2 files changed, 25 insertions, 6 deletions
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp index 28b1fc11a7c..eb8e5a8cc50 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp @@ -68,13 +68,10 @@ void MovieDistortionOperation::initExecution() { this->m_cache = c; this->m_cache->updateLastUsage(); + this->m_cache->getMargin(this->m_margin); return; } } - DistortionCache *newC = new DistortionCache(this->m_movieClip, this->m_width, this->m_height, - calibration_width, calibration_height, this->m_distortion); - s_cache.push_back(newC); - this->m_cache = newC; if (this->m_distortion) { float delta[2]; @@ -96,6 +93,14 @@ void MovieDistortionOperation::initExecution() */ m_margin[0] = m_margin[1] = 0; } + + DistortionCache *newC = new DistortionCache(this->m_movieClip, + this->m_width, this->m_height, + calibration_width, calibration_height, + this->m_distortion, + this->m_margin); + s_cache.push_back(newC); + this->m_cache = newC; } else { this->m_cache = NULL; diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h index a1dd08d8624..9e8d7eeba60 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h @@ -50,9 +50,14 @@ private: float *m_buffer; int *m_bufferCalculated; double timeLastUsage; + int m_margin[2]; public: - DistortionCache(MovieClip *movieclip, int width, int height, int calibration_width, int calibration_height, bool inverted) { + DistortionCache(MovieClip *movieclip, + int width, int height, + int calibration_width, int calibration_height, + bool inverted, + const int margin[2]) { this->m_k1 = movieclip->tracking.camera.k1; this->m_k2 = movieclip->tracking.camera.k2; this->m_k3 = movieclip->tracking.camera.k3; @@ -66,6 +71,7 @@ public: this->m_inverted = inverted; this->m_bufferCalculated = (int *)MEM_callocN(sizeof(int) * this->m_width * this->m_height, __func__); this->m_buffer = (float *)MEM_mallocN(sizeof(float) * this->m_width * this->m_height * 2, __func__); + copy_v2_v2_int(this->m_margin, margin); this->updateLastUsage(); } @@ -89,7 +95,10 @@ public: return this->timeLastUsage; } - bool isCacheFor(MovieClip *movieclip, int width, int height, int calibration_width, int claibration_height, bool inverted) { + bool isCacheFor(MovieClip *movieclip, + int width, int height, + int calibration_width, int claibration_height, + bool inverted) { return this->m_k1 == movieclip->tracking.camera.k1 && this->m_k2 == movieclip->tracking.camera.k2 && this->m_k3 == movieclip->tracking.camera.k3 && @@ -141,6 +150,11 @@ public: *v = this->m_buffer[offset2 + 1]; } } + + void getMargin(int margin[2]) + { + copy_v2_v2_int(margin, m_margin); + } }; class MovieDistortionOperation : public NodeOperation { |