diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-05-14 15:56:16 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-05-14 15:56:16 +0300 |
commit | 4d6dacb8dc0c2bab72d7e5a438d63abf0b05f2c6 (patch) | |
tree | d09671f1212f685ffae343fc9fb33d4dc8ff75ef /source/blender/compositor/intern/COM_ExecutionModel.cc | |
parent | e9b1b49e17d27e2641bb59b7d26aa92612520c35 (diff) |
Create ExecutionModel classes to reduce complexity
Diffstat (limited to 'source/blender/compositor/intern/COM_ExecutionModel.cc')
-rw-r--r-- | source/blender/compositor/intern/COM_ExecutionModel.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionModel.cc b/source/blender/compositor/intern/COM_ExecutionModel.cc new file mode 100644 index 00000000000..ec07d2de4cd --- /dev/null +++ b/source/blender/compositor/intern/COM_ExecutionModel.cc @@ -0,0 +1,42 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2021, Blender Foundation. + */ + +#include "COM_ExecutionModel.h" + +namespace blender::compositor { + +ExecutionModel::ExecutionModel(CompositorContext &context, Span<NodeOperation *> operations) + : m_context(context), m_operations(operations) +{ + const bNodeTree *node_tree = m_context.getbNodeTree(); + + const rctf *viewer_border = &node_tree->viewer_border; + m_border.use_viewer_border = (node_tree->flag & NTREE_VIEWER_BORDER) && + viewer_border->xmin < viewer_border->xmax && + viewer_border->ymin < viewer_border->ymax; + m_border.viewer_border = viewer_border; + + const RenderData *rd = m_context.getRenderData(); + /* Case when cropping to render border happens is handled in + * compositor output and render layer nodes. */ + m_border.use_render_border = context.isRendering() && (rd->mode & R_BORDER) && + !(rd->mode & R_CROP); + m_border.render_border = &rd->border; +} + +} // namespace blender::compositor |