Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/operations/COM_CropOperation.cc
| Show All 17 Lines | |||||
| #include "COM_CropOperation.h" | #include "COM_CropOperation.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| namespace blender::compositor { | namespace blender::compositor { | ||||
| CropBaseOperation::CropBaseOperation() | CropBaseOperation::CropBaseOperation() | ||||
| { | { | ||||
| this->addInputSocket(DataType::Color, ResizeMode::None); | this->addInputSocket(DataType::Color, ResizeMode::Align); | ||||
| this->addOutputSocket(DataType::Color); | this->addOutputSocket(DataType::Color); | ||||
| this->m_inputOperation = nullptr; | this->m_inputOperation = nullptr; | ||||
| this->m_settings = nullptr; | this->m_settings = nullptr; | ||||
| } | } | ||||
| void CropBaseOperation::updateArea() | void CropBaseOperation::updateArea() | ||||
| { | { | ||||
| SocketReader *inputReference = this->getInputSocketReader(0); | SocketReader *inputReference = this->getInputSocketReader(0); | ||||
| ▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | void CropImageOperation::get_area_of_interest(const int input_idx, | ||||
| BLI_assert(input_idx == 0); | BLI_assert(input_idx == 0); | ||||
| UNUSED_VARS_NDEBUG(input_idx); | UNUSED_VARS_NDEBUG(input_idx); | ||||
| r_input_area.xmax = output_area.xmax + this->m_xmin; | r_input_area.xmax = output_area.xmax + this->m_xmin; | ||||
| r_input_area.xmin = output_area.xmin + this->m_xmin; | r_input_area.xmin = output_area.xmin + this->m_xmin; | ||||
| r_input_area.ymax = output_area.ymax + this->m_ymin; | r_input_area.ymax = output_area.ymax + this->m_ymin; | ||||
| r_input_area.ymin = output_area.ymin + this->m_ymin; | r_input_area.ymin = output_area.ymin + this->m_ymin; | ||||
| } | } | ||||
| void CropImageOperation::determineResolution(unsigned int resolution[2], | void CropImageOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) | ||||
| unsigned int preferredResolution[2]) | |||||
| { | { | ||||
| NodeOperation::determineResolution(resolution, preferredResolution); | NodeOperation::determine_canvas(preferred_area, r_area); | ||||
| updateArea(); | updateArea(); | ||||
| resolution[0] = this->m_xmax - this->m_xmin; | r_area.xmax = r_area.xmin + (m_xmax - m_xmin); | ||||
| resolution[1] = this->m_ymax - this->m_ymin; | r_area.ymax = r_area.ymin + (m_ymax - m_ymin); | ||||
| } | } | ||||
| void CropImageOperation::executePixelSampled(float output[4], | void CropImageOperation::executePixelSampled(float output[4], | ||||
| float x, | float x, | ||||
| float y, | float y, | ||||
| PixelSampler sampler) | PixelSampler sampler) | ||||
| { | { | ||||
| if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) { | if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) { | ||||
| Show All 25 Lines | |||||