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:
authorManuel Castilla <manzanillawork@gmail.com>2021-08-10 16:25:10 +0300
committerManuel Castilla <manzanillawork@gmail.com>2021-08-10 17:16:23 +0300
commitd481c6651d149bdc83a8c0bbb675d3d296f7c530 (patch)
tree96f7fca0fdf2a08eb1dabbfb2025ad88ae378c03 /source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc
parent8f6cc16490843bec88806c2f76c0aa012db938dd (diff)
Compositor: Full frame color nodes
Adds full frame implementation to "Alpha Over", "Hue Saturation Value", "Invert", "Tonemap" and "ZCombine" nodes. The other nodes in "Color" submenu are implemented separately. No functional changes. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D12092
Diffstat (limited to 'source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc')
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc
index c68c79d2263..0cc179ea209 100644
--- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc
+++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc
@@ -23,6 +23,7 @@ namespace blender::compositor {
AlphaOverMixedOperation::AlphaOverMixedOperation()
{
this->m_x = 0.0f;
+ this->flags.can_be_constant = true;
}
void AlphaOverMixedOperation::executePixelSampled(float output[4],
@@ -56,4 +57,30 @@ void AlphaOverMixedOperation::executePixelSampled(float output[4],
}
}
+void AlphaOverMixedOperation::update_memory_buffer_row(PixelCursor &p)
+{
+ for (; p.out < p.row_end; p.next()) {
+ const float *color1 = p.color1;
+ const float *over_color = p.color2;
+ const float value = *p.value;
+
+ if (over_color[3] <= 0.0f) {
+ copy_v4_v4(p.out, color1);
+ }
+ else if (value == 1.0f && over_color[3] >= 1.0f) {
+ copy_v4_v4(p.out, over_color);
+ }
+ else {
+ const float addfac = 1.0f - this->m_x + over_color[3] * this->m_x;
+ const float premul = value * addfac;
+ const float mul = 1.0f - value * over_color[3];
+
+ p.out[0] = (mul * color1[0]) + premul * over_color[0];
+ p.out[1] = (mul * color1[1]) + premul * over_color[1];
+ p.out[2] = (mul * color1[2]) + premul * over_color[2];
+ p.out[3] = (mul * color1[3]) + value * over_color[3];
+ }
+ }
+}
+
} // namespace blender::compositor