Cleanup: Pass interpolation directly to transform algorithm

The transform algorithm currently takes realization options, but it only
uses the interpolation from it. So pass interpolation directly for
clarity.
This commit is contained in:
Omar Emara 2025-01-15 15:45:51 +02:00
parent 7e5af160bd
commit e545b6e764
6 changed files with 15 additions and 21 deletions

View file

@ -12,8 +12,8 @@
namespace blender::compositor {
/* Transforms the given result based on the given transformation and realization options, writing
* the transformed result to the given output.
/* Transforms the given result based on the given transformation and interpolation, writing the
* transformed result to the given output.
*
* The rotation and scale components of the transformation are realized and the size of the result
* is increased/reduced to adapt to the new transformation. For instance, if the transformation is
@ -27,12 +27,11 @@ namespace blender::compositor {
* in which case, the result will be translated such that it is clipped on the one side and wrapped
* on the opposite side.
*
* The empty areas around the image after rotation will either be transparent or repetitions of the
* image based on the realization options. */
* The empty areas around the image after rotation will be transparent. */
void transform(Context &context,
Result &input,
Result &output,
const float3x3 &transformation,
RealizationOptions realization_options);
Interpolation interpolation);
} // namespace blender::compositor

View file

@ -81,7 +81,7 @@ void transform(Context &context,
Result &input,
Result &output,
const float3x3 &transformation,
RealizationOptions realization_options)
Interpolation interpolation)
{
Domain transformed_domain = input.domain();
transformed_domain.transform(transformation);
@ -93,9 +93,9 @@ void transform(Context &context,
output,
target_domain,
transformation * input.domain().transformation,
realization_options);
{interpolation});
output.get_realization_options().interpolation = realization_options.interpolation;
output.get_realization_options().interpolation = interpolation;
}
} // namespace blender::compositor

View file

@ -60,10 +60,7 @@ class RotateOperation : public NodeOperation {
const math::AngleRadian rotation = get_input("Degr").get_single_value_default(0.0f);
const float3x3 transformation = math::from_rotation<float3x3>(rotation);
RealizationOptions realization_options = input.get_realization_options();
realization_options.interpolation = get_interpolation();
transform(context(), input, output, transformation, realization_options);
transform(this->context(), input, output, transformation, this->get_interpolation());
}
Interpolation get_interpolation()

View file

@ -108,7 +108,11 @@ class ScaleOperation : public NodeOperation {
const float3x3 transformation = math::from_loc_rot_scale<float3x3>(
translation, rotation, scale);
transform(context(), input, output, transformation, input.get_realization_options());
transform(this->context(),
input,
output,
transformation,
input.get_realization_options().interpolation);
}
void execute_variable_size()

View file

@ -99,10 +99,7 @@ class Stabilize2DOperation : public NodeOperation {
transformation = math::invert(transformation);
}
RealizationOptions realization_options = input.get_realization_options();
realization_options.interpolation = get_interpolation();
transform(context(), input, output, transformation, realization_options);
transform(this->context(), input, output, transformation, this->get_interpolation());
}
Interpolation get_interpolation()

View file

@ -75,10 +75,7 @@ class TransformOperation : public NodeOperation {
const float3x3 transformation = math::from_loc_rot_scale<float3x3>(
translation, rotation, scale);
RealizationOptions realization_options = input.get_realization_options();
realization_options.interpolation = get_interpolation();
transform(context(), input, output, transformation, realization_options);
transform(this->context(), input, output, transformation, this->get_interpolation());
}
Interpolation get_interpolation()