Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/operations/COM_ImageOperation.cc
| Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | void BaseImageOperation::deinitExecution() | ||||
| this->m_imageByteBuffer = nullptr; | this->m_imageByteBuffer = nullptr; | ||||
| BKE_image_release_ibuf(this->m_image, this->m_buffer, nullptr); | BKE_image_release_ibuf(this->m_image, this->m_buffer, nullptr); | ||||
| if (depth_buffer_) { | if (depth_buffer_) { | ||||
| delete depth_buffer_; | delete depth_buffer_; | ||||
| depth_buffer_ = nullptr; | depth_buffer_ = nullptr; | ||||
| } | } | ||||
| } | } | ||||
| void BaseImageOperation::determineResolution(unsigned int resolution[2], | void BaseImageOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area) | ||||
| unsigned int /*preferredResolution*/[2]) | |||||
| { | { | ||||
| ImBuf *stackbuf = getImBuf(); | ImBuf *stackbuf = getImBuf(); | ||||
| resolution[0] = 0; | r_area = COM_AREA_NONE; | ||||
| resolution[1] = 0; | |||||
| if (stackbuf) { | if (stackbuf) { | ||||
| resolution[0] = stackbuf->x; | BLI_rcti_init(&r_area, 0, stackbuf->x, 0, stackbuf->y); | ||||
| resolution[1] = stackbuf->y; | |||||
| } | } | ||||
| BKE_image_release_ibuf(this->m_image, stackbuf, nullptr); | BKE_image_release_ibuf(this->m_image, stackbuf, nullptr); | ||||
| } | } | ||||
| static void sampleImageAtLocation( | static void sampleImageAtLocation( | ||||
| ImBuf *ibuf, float x, float y, PixelSampler sampler, bool make_linear_rgb, float color[4]) | ImBuf *ibuf, float x, float y, PixelSampler sampler, bool make_linear_rgb, float color[4]) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | void ImageDepthOperation::executePixelSampled(float output[4], | ||||
| if (this->m_depthBuffer == nullptr) { | if (this->m_depthBuffer == nullptr) { | ||||
| output[0] = 0.0f; | output[0] = 0.0f; | ||||
| } | } | ||||
| else { | else { | ||||
| if (x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight()) { | if (x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight()) { | ||||
| output[0] = 0.0f; | output[0] = 0.0f; | ||||
| } | } | ||||
| else { | else { | ||||
| int offset = y * this->m_width + x; | int offset = y * getWidth() + x; | ||||
| output[0] = this->m_depthBuffer[offset]; | output[0] = this->m_depthBuffer[offset]; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void ImageDepthOperation::update_memory_buffer_partial(MemoryBuffer *output, | void ImageDepthOperation::update_memory_buffer_partial(MemoryBuffer *output, | ||||
| const rcti &area, | const rcti &area, | ||||
| Span<MemoryBuffer *> UNUSED(inputs)) | Span<MemoryBuffer *> UNUSED(inputs)) | ||||
| Show All 10 Lines | |||||