Welcome to mirror list, hosted at ThFree Co, Russian Federation.

COM_ConvertColorProfileOperation.cc « operations « compositor « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 01911b3bcd5d2430d69c55cb5da1e133db8f34be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright 2011 Blender Foundation. */

#include "COM_ConvertColorProfileOperation.h"

#include "IMB_imbuf.h"

namespace blender::compositor {

ConvertColorProfileOperation::ConvertColorProfileOperation()
{
  this->add_input_socket(DataType::Color);
  this->add_output_socket(DataType::Color);
  input_operation_ = nullptr;
  predivided_ = false;
}

void ConvertColorProfileOperation::init_execution()
{
  input_operation_ = this->get_input_socket_reader(0);
}

void ConvertColorProfileOperation::execute_pixel_sampled(float output[4],
                                                         float x,
                                                         float y,
                                                         PixelSampler sampler)
{
  float color[4];
  input_operation_->read_sampled(color, x, y, sampler);
  IMB_buffer_float_from_float(
      output, color, 4, to_profile_, from_profile_, predivided_, 1, 1, 0, 0);
}

void ConvertColorProfileOperation::deinit_execution()
{
  input_operation_ = nullptr;
}

}  // namespace blender::compositor