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:
authorJeroen Bakker <jeroen@blender.org>2021-03-26 16:59:26 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-26 17:51:06 +0300
commit9d80b3a69c490ed9d68173766872e341e6cf4245 (patch)
treed1af2479f3c9807ffe139ed9c17dcb0af89fd5a2 /source/blender/compositor/intern
parentf725f42af5a2c992c8cef8aa79bfc8e687df13c7 (diff)
Cleanup: Replaced Typedef Enum With Enum Class.
Diffstat (limited to 'source/blender/compositor/intern')
-rw-r--r--source/blender/compositor/intern/COM_Converter.cc28
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.h12
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.cc6
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h26
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.cc2
5 files changed, 36 insertions, 38 deletions
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<Link> 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()) {