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:
authorStefan Werner <stefan.werner@tangent-animation.com>2021-08-21 23:03:31 +0300
committerStefan Werner <stefan.werner@tangent-animation.com>2021-08-21 23:03:31 +0300
commitc5b56a525cd6113caa2bd3ec7bfb91fe4a04513a (patch)
tree77dae5ae2fbeccf6703034c94ad3e1f3aa81140b /source/blender/compositor/operations/COM_MaskOperation.cc
parent34e8d79c3edbc58fd242cec0c1f2bed4e43855af (diff)
parent67c29bc5a273b66e278bd20c18187b425acf1869 (diff)
Merge branch 'master' into cycles_texture_cachecycles_texture_cache
Diffstat (limited to 'source/blender/compositor/operations/COM_MaskOperation.cc')
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cc b/source/blender/compositor/operations/COM_MaskOperation.cc
index c7763f08e71..84992f23924 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cc
+++ b/source/blender/compositor/operations/COM_MaskOperation.cc
@@ -161,4 +161,41 @@ void MaskOperation::executePixelSampled(float output[4],
}
}
+void MaskOperation::update_memory_buffer_partial(MemoryBuffer *output,
+ const rcti &area,
+ Span<MemoryBuffer *> UNUSED(inputs))
+{
+ Vector<MaskRasterHandle *> handles = get_non_null_handles();
+ if (handles.size() == 0) {
+ output->fill(area, COM_VALUE_ZERO);
+ return;
+ }
+
+ float xy[2];
+ for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) {
+ xy[0] = it.x * m_maskWidthInv + m_mask_px_ofs[0];
+ xy[1] = it.y * m_maskHeightInv + m_mask_px_ofs[1];
+ *it.out = 0.0f;
+ for (MaskRasterHandle *handle : handles) {
+ *it.out += BKE_maskrasterize_handle_sample(handle, xy);
+ }
+
+ /* Until we get better falloff. */
+ *it.out /= m_rasterMaskHandleTot;
+ }
+}
+
+Vector<MaskRasterHandle *> MaskOperation::get_non_null_handles() const
+{
+ Vector<MaskRasterHandle *> handles;
+ for (int i = 0; i < m_rasterMaskHandleTot; i++) {
+ MaskRasterHandle *handle = m_rasterMaskHandles[i];
+ if (handle == nullptr) {
+ continue;
+ }
+ handles.append(handle);
+ }
+ return handles;
+}
+
} // namespace blender::compositor