80 std::unique_ptr<CPDF_Function> pFuncs[3];
81 const CPDF_Array* pArray = pObj->AsArray();
83 if (pArray->size() < 3)
86 for (uint32_t i = 0; i < 3; ++i) {
87 pFuncs[2 - i] = CPDF_Function::Load(pArray->GetDirectObjectAt(i));
92 pFuncs[0] = CPDF_Function::Load(pObj);
97 float output[kMaxOutputs];
98 std::fill(
std::begin(output),
std::end(output), 0.0f);
100 bool bIdentity =
true;
101 auto samples_r = FixedSizeDataVector<uint8_t>::Uninit(
102 CPDF_TransferFunc::kChannelSampleSize);
103 auto samples_g = FixedSizeDataVector<uint8_t>::Uninit(
104 CPDF_TransferFunc::kChannelSampleSize);
105 auto samples_b = FixedSizeDataVector<uint8_t>::Uninit(
106 CPDF_TransferFunc::kChannelSampleSize);
108 std::array<pdfium::span<uint8_t>, 3> samples = {
109 samples_r.span(), samples_g.span(), samples_b.span()};
111 for (size_t v = 0; v < CPDF_TransferFunc::kChannelSampleSize; ++v) {
112 float input =
static_cast<
float>(v) / 255.0f;
113 for (
int i = 0; i < 3; ++i) {
114 if (pFuncs[i]->CountOutputs() > kMaxOutputs) {
118 pFuncs[i]->Call(pdfium::span_from_ref(input), output);
119 size_t o = FXSYS_roundf(output[0] * 255);
126 for (size_t v = 0; v < CPDF_TransferFunc::kChannelSampleSize; ++v) {
127 float input =
static_cast<
float>(v) / 255.0f;
128 if (pFuncs[0]->CountOutputs() <= kMaxOutputs)
129 pFuncs[0]->Call(pdfium::span_from_ref(input), output);
130 size_t o = FXSYS_roundf(output[0] * 255);
133 for (
auto& channel : samples)
138 return pdfium::MakeRetain<CPDF_TransferFunc>(bIdentity,
std::move(samples_r),
139 std::move(samples_g),
140 std::move(samples_b));