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:
authorCampbell Barton <ideasman42@gmail.com>2014-04-16 17:25:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-16 17:25:10 +0400
commitd1b1d194dc9cc741d87dc63e701402de0776c694 (patch)
tree344bde4783c61c65412fa1fd2435e705ead26965 /source/blender/compositor
parentb3972aeea05bc6c60d7b7da4e6b59a64b822448a (diff)
Fix for half pixel offset rasterizing masks
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.h3
2 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp
index 112b5912ad3..8c8ba93327d 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_MaskOperation.cpp
@@ -129,8 +129,9 @@ void MaskOperation::determineResolution(unsigned int resolution[2], unsigned int
void MaskOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
- const float xy[2] = {x * this->m_maskWidthInv,
- y * this->m_maskHeightInv};
+ const float xy[2] = {
+ (x * this->m_maskWidthInv) + this->m_mask_px_ofs[0],
+ (y * this->m_maskHeightInv) + this->m_mask_px_ofs[1]};
if (this->m_rasterMaskHandleTot == 1) {
if (this->m_rasterMaskHandles[0]) {
diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h
index 18d7e594104..522b873e167 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.h
+++ b/source/blender/compositor/operations/COM_MaskOperation.h
@@ -43,6 +43,7 @@ protected:
int m_maskHeight;
float m_maskWidthInv; /* 1 / m_maskWidth */
float m_maskHeightInv; /* 1 / m_maskHeight */
+ float m_mask_px_ofs[2];
float m_frame_shutter;
int m_frame_number;
@@ -70,11 +71,13 @@ public:
{
this->m_maskWidth = width;
this->m_maskWidthInv = 1.0f / (float)width;
+ this->m_mask_px_ofs[0] = this->m_maskWidthInv * 0.5f;
}
void setMaskHeight(int height)
{
this->m_maskHeight = height;
this->m_maskHeightInv = 1.0f / (float)height;
+ this->m_mask_px_ofs[1] = this->m_maskHeightInv * 0.5f;
}
void setFramenumber(int frame_number) { this->m_frame_number = frame_number; }
void setSmooth(bool smooth) { this->m_do_smooth = smooth; }