From 9d80b3a69c490ed9d68173766872e341e6cf4245 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 26 Mar 2021 14:59:26 +0100 Subject: Cleanup: Replaced Typedef Enum With Enum Class. --- source/blender/compositor/intern/COM_Converter.cc | 28 +++++++++++----------- .../compositor/intern/COM_ExecutionSystem.h | 12 +++++----- .../blender/compositor/intern/COM_NodeOperation.cc | 6 ++--- .../blender/compositor/intern/COM_NodeOperation.h | 26 ++++++++++---------- .../compositor/intern/COM_NodeOperationBuilder.cc | 2 +- source/blender/compositor/nodes/COM_BoxMaskNode.cc | 2 +- .../compositor/nodes/COM_EllipseMaskNode.cc | 2 +- source/blender/compositor/nodes/COM_GlareNode.cc | 2 +- source/blender/compositor/nodes/COM_ScaleNode.cc | 2 +- .../operations/COM_BokehBlurOperation.cc | 2 +- .../operations/COM_CalculateMeanOperation.cc | 2 +- .../compositor/operations/COM_CropOperation.cc | 2 +- .../operations/COM_GlareThresholdOperation.cc | 2 +- .../compositor/operations/COM_MapUVOperation.cc | 2 +- .../operations/COM_PlaneDistortCommonOperation.cc | 2 +- .../compositor/operations/COM_PreviewOperation.cc | 2 +- .../compositor/operations/COM_ScaleOperation.cc | 2 +- .../compositor/operations/COM_TonemapOperation.cc | 2 +- .../COM_VariableSizeBokehBlurOperation.cc | 6 ++--- 19 files changed, 52 insertions(+), 54 deletions(-) (limited to 'source') diff --git a/source/blender/compositor/intern/COM_Converter.cc b/source/blender/compositor/intern/COM_Converter.cc index d5bce636b8c..125d6e5faee 100644 --- a/source/blender/compositor/intern/COM_Converter.cc +++ b/source/blender/compositor/intern/COM_Converter.cc @@ -454,7 +454,7 @@ void COM_convert_resolution(NodeOperationBuilder &builder, NodeOperationOutput *fromSocket, NodeOperationInput *toSocket) { - InputResizeMode mode = toSocket->getResizeMode(); + ResizeMode mode = toSocket->getResizeMode(); NodeOperation *toOperation = &toSocket->getOperation(); const float toWidth = toOperation->getWidth(); @@ -470,22 +470,22 @@ void COM_convert_resolution(NodeOperationBuilder &builder, float scaleY = 0; switch (mode) { - case COM_SC_NO_RESIZE: + case ResizeMode::None: break; - case COM_SC_CENTER: + case ResizeMode::Center: doCenter = true; break; - case COM_SC_FIT_WIDTH: + case ResizeMode::FitWidth: doCenter = true; doScale = true; scaleX = scaleY = toWidth / fromWidth; break; - case COM_SC_FIT_HEIGHT: + case ResizeMode::FitHeight: doCenter = true; doScale = true; scaleX = scaleY = toHeight / fromHeight; break; - case COM_SC_FIT: + case ResizeMode::FitAny: doCenter = true; doScale = true; scaleX = toWidth / fromWidth; @@ -497,7 +497,7 @@ void COM_convert_resolution(NodeOperationBuilder &builder, scaleY = scaleX; } break; - case COM_SC_STRETCH: + case ResizeMode::Stretch: doCenter = true; doScale = true; scaleX = toWidth / fromWidth; @@ -510,8 +510,8 @@ void COM_convert_resolution(NodeOperationBuilder &builder, ScaleOperation *scaleOperation = nullptr; if (doScale) { scaleOperation = new ScaleOperation(); - scaleOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE); - scaleOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE); + scaleOperation->getInputSocket(1)->setResizeMode(ResizeMode::None); + scaleOperation->getInputSocket(2)->setResizeMode(ResizeMode::None); first = scaleOperation; SetValueOperation *sxop = new SetValueOperation(); sxop->setValue(scaleX); @@ -530,8 +530,8 @@ void COM_convert_resolution(NodeOperationBuilder &builder, } TranslateOperation *translateOperation = new TranslateOperation(); - translateOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE); - translateOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE); + translateOperation->getInputSocket(1)->setResizeMode(ResizeMode::None); + translateOperation->getInputSocket(2)->setResizeMode(ResizeMode::None); if (!first) { first = translateOperation; } @@ -551,14 +551,14 @@ void COM_convert_resolution(NodeOperationBuilder &builder, builder.addOperation(translateOperation); if (doScale) { - translateOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + translateOperation->getInputSocket(0)->setResizeMode(ResizeMode::None); builder.addLink(scaleOperation->getOutputSocket(), translateOperation->getInputSocket(0)); } /* remove previous link and replace */ builder.removeInputLink(toSocket); - first->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); - toSocket->setResizeMode(COM_SC_NO_RESIZE); + first->getInputSocket(0)->setResizeMode(ResizeMode::None); + toSocket->setResizeMode(ResizeMode::None); builder.addLink(fromSocket, first->getInputSocket(0)); builder.addLink(translateOperation->getOutputSocket(), toSocket); } diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index c12380fe839..4d1dad7e5ed 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -70,17 +70,17 @@ class ExecutionGroup; * * - Image size conversions: the system can automatically convert when resolutions do not match. * An NodeInput has a resize mode. This can be any of the following settings. - * - [@ref InputSocketResizeMode.COM_SC_CENTER]: + * - [@ref InputSocketResizeMode.ResizeMode::Center]: * The center of both images are aligned - * - [@ref InputSocketResizeMode.COM_SC_FIT_WIDTH]: + * - [@ref InputSocketResizeMode.ResizeMode::FitWidth]: * The width of both images are aligned - * - [@ref InputSocketResizeMode.COM_SC_FIT_HEIGHT]: + * - [@ref InputSocketResizeMode.ResizeMode::FitHeight]: * The height of both images are aligned - * - [@ref InputSocketResizeMode.COM_SC_FIT]: + * - [@ref InputSocketResizeMode.ResizeMode::FitAny]: * The width, or the height of both images are aligned to make sure that it fits. - * - [@ref InputSocketResizeMode.COM_SC_STRETCH]: + * - [@ref InputSocketResizeMode.ResizeMode::Stretch]: * The width and the height of both images are aligned. - * - [@ref InputSocketResizeMode.COM_SC_NO_RESIZE]: + * - [@ref InputSocketResizeMode.ResizeMode::None]: * Bottom left of the images are aligned. * * \see COM_convert_data_type Datatype conversions diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc index 0cc642479ac..d14471bd301 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cc +++ b/source/blender/compositor/intern/COM_NodeOperation.cc @@ -63,7 +63,7 @@ NodeOperationInput *NodeOperation::getInputSocket(unsigned int index) const return m_inputs[index]; } -void NodeOperation::addInputSocket(DataType datatype, InputResizeMode resize_mode) +void NodeOperation::addInputSocket(DataType datatype, ResizeMode resize_mode) { NodeOperationInput *socket = new NodeOperationInput(this, datatype, resize_mode); m_inputs.push_back(socket); @@ -195,9 +195,7 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, **** OpInput **** *****************/ -NodeOperationInput::NodeOperationInput(NodeOperation *op, - DataType datatype, - InputResizeMode resizeMode) +NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, ResizeMode resizeMode) : m_operation(op), m_datatype(datatype), m_resizeMode(resizeMode), m_link(nullptr) { } diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index 7ac48ad00dd..d7321fe8df8 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -48,24 +48,24 @@ typedef NodeOperation SocketReader; * How are the input and working resolutions matched * \ingroup Model */ -typedef enum InputResizeMode { +enum class ResizeMode { /** \brief Center the input image to the center of the working area of the node, no resizing * occurs */ - COM_SC_CENTER = NS_CR_CENTER, + Center = NS_CR_CENTER, /** \brief The bottom left of the input image is the bottom left of the working area of the node, * no resizing occurs */ - COM_SC_NO_RESIZE = NS_CR_NONE, + None = NS_CR_NONE, /** \brief Fit the width of the input image to the width of the working area of the node */ - COM_SC_FIT_WIDTH = NS_CR_FIT_WIDTH, + FitWidth = NS_CR_FIT_WIDTH, /** \brief Fit the height of the input image to the height of the working area of the node */ - COM_SC_FIT_HEIGHT = NS_CR_FIT_HEIGHT, + FitHeight = NS_CR_FIT_HEIGHT, /** \brief Fit the width or the height of the input image to the width or height of the working * area of the node, image will be larger than the working area */ - COM_SC_FIT = NS_CR_FIT, + FitAny = NS_CR_FIT, /** \brief Fit the width and the height of the input image to the width and height of the working * area of the node, image will be equally larger than the working area */ - COM_SC_STRETCH = NS_CR_STRETCH, -} InputResizeMode; + Stretch = NS_CR_STRETCH, +}; enum class PixelSampler { Nearest = 0, @@ -444,7 +444,7 @@ class NodeOperation { protected: NodeOperation(); - void addInputSocket(DataType datatype, InputResizeMode resize_mode = COM_SC_CENTER); + void addInputSocket(DataType datatype, ResizeMode resize_mode = ResizeMode::Center); void addOutputSocket(DataType datatype); void setWidth(unsigned int width) @@ -546,7 +546,7 @@ class NodeOperationInput { DataType m_datatype; /** Resize mode of this socket */ - InputResizeMode m_resizeMode; + ResizeMode m_resizeMode; /** Connected output */ NodeOperationOutput *m_link; @@ -554,7 +554,7 @@ class NodeOperationInput { public: NodeOperationInput(NodeOperation *op, DataType datatype, - InputResizeMode resizeMode = COM_SC_CENTER); + ResizeMode resizeMode = ResizeMode::Center); NodeOperation &getOperation() const { @@ -578,11 +578,11 @@ class NodeOperationInput { return m_link; } - void setResizeMode(InputResizeMode resizeMode) + void setResizeMode(ResizeMode resizeMode) { this->m_resizeMode = resizeMode; } - InputResizeMode getResizeMode() const + ResizeMode getResizeMode() const { return this->m_resizeMode; } diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc index da9cadd05b6..e1c643fc31d 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc @@ -399,7 +399,7 @@ void NodeOperationBuilder::determineResolutions() { blender::Vector convert_links; for (const Link &link : m_links) { - if (link.to()->getResizeMode() != COM_SC_NO_RESIZE) { + if (link.to()->getResizeMode() != ResizeMode::None) { NodeOperation &from_op = link.from()->getOperation(); NodeOperation &to_op = link.to()->getOperation(); if (from_op.getWidth() != to_op.getWidth() || from_op.getHeight() != to_op.getHeight()) { diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.cc b/source/blender/compositor/nodes/COM_BoxMaskNode.cc index fe59bd32939..2776089d503 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.cc +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cc @@ -60,7 +60,7 @@ void BoxMaskNode::convertToOperations(NodeConverter &converter, scaleOperation->setOffset(0.0f, 0.0f); scaleOperation->setNewWidth(rd->xsch * render_size_factor); scaleOperation->setNewHeight(rd->ysch * render_size_factor); - scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + scaleOperation->getInputSocket(0)->setResizeMode(ResizeMode::None); converter.addOperation(scaleOperation); converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.cc b/source/blender/compositor/nodes/COM_EllipseMaskNode.cc index 1ae855c0f1d..7d74623ab1f 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.cc +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.cc @@ -60,7 +60,7 @@ void EllipseMaskNode::convertToOperations(NodeConverter &converter, scaleOperation->setOffset(0.0f, 0.0f); scaleOperation->setNewWidth(rd->xsch * render_size_factor); scaleOperation->setNewHeight(rd->ysch * render_size_factor); - scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + scaleOperation->getInputSocket(0)->setResizeMode(ResizeMode::None); converter.addOperation(scaleOperation); converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_GlareNode.cc b/source/blender/compositor/nodes/COM_GlareNode.cc index ef088e42205..d59d7ce4b1d 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cc +++ b/source/blender/compositor/nodes/COM_GlareNode.cc @@ -65,7 +65,7 @@ void GlareNode::convertToOperations(NodeConverter &converter, MixGlareOperation *mixoperation = new MixGlareOperation(); mixoperation->setResolutionInputSocketIndex(1); - mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT); + mixoperation->getInputSocket(2)->setResizeMode(ResizeMode::FitAny); converter.addOperation(glareoperation); converter.addOperation(thresholdOperation); diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cc b/source/blender/compositor/nodes/COM_ScaleNode.cc index 9ffcd5306b0..f164e1cf19e 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cc +++ b/source/blender/compositor/nodes/COM_ScaleNode.cc @@ -79,7 +79,7 @@ void ScaleNode::convertToOperations(NodeConverter &converter, operation->setOffset(bnode->custom3, bnode->custom4); operation->setNewWidth(rd->xsch * render_size_factor); operation->setNewHeight(rd->ysch * render_size_factor); - operation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + operation->getInputSocket(0)->setResizeMode(ResizeMode::None); converter.addOperation(operation); converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cc b/source/blender/compositor/operations/COM_BokehBlurOperation.cc index 8041cb2c6cf..af25c35bc14 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cc @@ -25,7 +25,7 @@ BokehBlurOperation::BokehBlurOperation() { this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addInputSocket(DataType::Value); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Color); diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cc b/source/blender/compositor/operations/COM_CalculateMeanOperation.cc index fdeecd0cb29..6ac40802017 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cc +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cc @@ -24,7 +24,7 @@ CalculateMeanOperation::CalculateMeanOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Value); this->m_imageReader = nullptr; this->m_iscalculated = false; diff --git a/source/blender/compositor/operations/COM_CropOperation.cc b/source/blender/compositor/operations/COM_CropOperation.cc index 55a1e505ec8..f8effb87041 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cc +++ b/source/blender/compositor/operations/COM_CropOperation.cc @@ -21,7 +21,7 @@ CropBaseOperation::CropBaseOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Color); this->m_inputOperation = nullptr; this->m_settings = nullptr; diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cc b/source/blender/compositor/operations/COM_GlareThresholdOperation.cc index 984b433469a..38a0444f5ec 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cc +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cc @@ -23,7 +23,7 @@ GlareThresholdOperation::GlareThresholdOperation() { - this->addInputSocket(DataType::Color, COM_SC_FIT); + this->addInputSocket(DataType::Color, ResizeMode::FitAny); this->addOutputSocket(DataType::Color); this->m_inputProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cc b/source/blender/compositor/operations/COM_MapUVOperation.cc index dd0fbf89e3a..ac510d958cb 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cc +++ b/source/blender/compositor/operations/COM_MapUVOperation.cc @@ -21,7 +21,7 @@ MapUVOperation::MapUVOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addInputSocket(DataType::Vector); this->addOutputSocket(DataType::Color); this->m_alpha = 0.0f; diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc index 87f837973d2..56cf1c55819 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc @@ -46,7 +46,7 @@ BLI_INLINE void warpCoord(float x, float y, float matrix[3][3], float uv[2], flo PlaneDistortWarpImageOperation::PlaneDistortWarpImageOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Color); this->m_pixelReader = nullptr; this->m_motion_blur_samples = 1; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cc b/source/blender/compositor/operations/COM_PreviewOperation.cc index e347ff706b9..870e27321f2 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cc +++ b/source/blender/compositor/operations/COM_PreviewOperation.cc @@ -39,7 +39,7 @@ PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings, const unsigned int defaultHeight) { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->m_preview = nullptr; this->m_outputBuffer = nullptr; this->m_input = nullptr; diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cc b/source/blender/compositor/operations/COM_ScaleOperation.cc index 917d0d453e3..68505d09af1 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cc +++ b/source/blender/compositor/operations/COM_ScaleOperation.cc @@ -203,7 +203,7 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, // Absolute fixed size ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Color); this->setResolutionInputSocketIndex(0); this->m_inputOperation = nullptr; diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cc b/source/blender/compositor/operations/COM_TonemapOperation.cc index 85011171432..9dda6f2b3f0 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cc +++ b/source/blender/compositor/operations/COM_TonemapOperation.cc @@ -24,7 +24,7 @@ TonemapOperation::TonemapOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Color); this->m_imageReader = nullptr; this->m_data = nullptr; diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc index 0b032d9a2d5..ce7519c426e 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc @@ -25,11 +25,11 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() { this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); // do not resize the bokeh image. + this->addInputSocket(DataType::Color, ResizeMode::None); // do not resize the bokeh image. this->addInputSocket(DataType::Value); // radius #ifdef COM_DEFOCUS_SEARCH this->addInputSocket(DataType::Color, - COM_SC_NO_RESIZE); // inverse search radius optimization structure. + ResizeMode::None); // inverse search radius optimization structure. #endif this->addOutputSocket(DataType::Color); this->setComplex(true); @@ -278,7 +278,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest( // InverseSearchRadiusOperation InverseSearchRadiusOperation::InverseSearchRadiusOperation() { - this->addInputSocket(DataType::Value, COM_SC_NO_RESIZE); // radius + this->addInputSocket(DataType::Value, ResizeMode::None); // radius this->addOutputSocket(DataType::Color); this->setComplex(true); this->m_inputRadius = nullptr; -- cgit v1.2.3